From patchwork Wed Sep 3 21:19:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 36660 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5907A202E4 for ; Wed, 3 Sep 2014 21:24:05 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id et14sf87245670pad.6 for ; Wed, 03 Sep 2014 14:24:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=tn3zeT49A/3ndB02rS0nAL69jXJ5shFeTTUZxdwMrbU=; b=DcH9jRtFBm2gOmuBUdD7g28YaWyq8zK72n5qXwz+vO1SBUsO8nPXUtwGX0f/RtwHM7 z/1CIN2tWEfI3UGFI3oWje9puPmTAV+pJr8RVbt/Jrj6Rrt5pVI7hZ3hafn4vaJQOL3s ybmOcYBPFQbOgkuXp2U5kF8N9vRyKXKkAmRQWyJ0RYiKX+J95wuiEGNyZFfq11LSXhjh q26aeRumVoWR9X5tOD87knyh2FnoCRVfHjLrYR8xDt3H78x0B+yQImEmttRnOI1uTQNU +YT8p4MLtKASr4OL//vd3YdNrIgh6PhNRLldg8z3Xifg25Vb4UKU0SXO0Sr4y/iJJ7zs 5E4g== X-Gm-Message-State: ALoCoQmZsVfLxZIK2VVEH5R1boQAt5XaNYkvC3EdlU79nLAj/0nxXbP5K45lOEVf5EQ/WPIHFxTs X-Received: by 10.66.162.162 with SMTP id yb2mr142069pab.39.1409779443504; Wed, 03 Sep 2014 14:24:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.210 with SMTP id g76ls12630qge.74.gmail; Wed, 03 Sep 2014 14:24:03 -0700 (PDT) X-Received: by 10.52.30.2 with SMTP id o2mr93883vdh.12.1409779443364; Wed, 03 Sep 2014 14:24:03 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id xn5si4439423vcb.95.2014.09.03.14.24.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 14:24:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hy4so9567532vcb.38 for ; Wed, 03 Sep 2014 14:24:03 -0700 (PDT) X-Received: by 10.52.120.51 with SMTP id kz19mr115736vdb.95.1409779443273; Wed, 03 Sep 2014 14:24:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp740478vcb; Wed, 3 Sep 2014 14:24:02 -0700 (PDT) X-Received: by 10.70.102.106 with SMTP id fn10mr462122pdb.161.1409779442395; Wed, 03 Sep 2014 14:24:02 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qj8si13239336pac.189.2014.09.03.14.24.01 for ; Wed, 03 Sep 2014 14:24:02 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932901AbaICVX6 (ORCPT + 26 others); Wed, 3 Sep 2014 17:23:58 -0400 Received: from mail-ig0-f170.google.com ([209.85.213.170]:46805 "EHLO mail-ig0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932641AbaICVXM (ORCPT ); Wed, 3 Sep 2014 17:23:12 -0400 Received: by mail-ig0-f170.google.com with SMTP id h3so12782igd.1 for ; Wed, 03 Sep 2014 14:23:11 -0700 (PDT) X-Received: by 10.50.80.45 with SMTP id o13mr218714igx.7.1409779391548; Wed, 03 Sep 2014 14:23:11 -0700 (PDT) Received: from localhost.localdomain (64.2.3.195.ptr.us.xo.net. [64.2.3.195]) by mx.google.com with ESMTPSA id ig9sm6515653igb.13.2014.09.03.14.23.10 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 14:23:11 -0700 (PDT) Received: from localhost.localdomain (apinskidesktop [127.0.0.1]) by localhost.localdomain (8.14.3/8.14.3/Debian-9.4) with ESMTP id s83LJPtI031087 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Wed, 3 Sep 2014 14:19:25 -0700 Received: (from apinski@localhost) by localhost.localdomain (8.14.3/8.14.3/Submit) id s83LJPUG031086; Wed, 3 Sep 2014 14:19:25 -0700 From: Andrew Pinski To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pinskia@gmail.com Cc: Andrew Pinski Subject: [PATCH 19/24] ptrace: Allow compat to use the native siginfo Date: Wed, 3 Sep 2014 14:19:13 -0700 Message-Id: <1409779158-30963-20-git-send-email-apinski@cavium.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1409779158-30963-1-git-send-email-apinski@cavium.com> References: <1409779158-30963-1-git-send-email-apinski@cavium.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: apinski@cavium.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , With ARM64 ILP32 ABI, we want to use the non-compat siginfo as we want to simplify signal handling for this new ABI. This patch just adds a new define COMPAT_USE_NATIVE_SIGINFO and if it is true then read/write in the compat case as it was the non-compat case. Signed-off-by: Andrew Pinski --- include/linux/compat.h | 4 ++++ kernel/ptrace.c | 25 ++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/include/linux/compat.h b/include/linux/compat.h index e649426..2d8c535 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -24,6 +24,10 @@ #define COMPAT_USE_64BIT_TIME 0 #endif +#ifndef COMPAT_USE_NATIVE_SIGINFO +#define COMPAT_USE_NATIVE_SIGINFO 0 +#endif + #ifndef __SC_DELOUSE #define __SC_DELOUSE(t,v) ((t)(unsigned long)(v)) #endif diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 54e7522..40ae023 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -657,7 +657,7 @@ static int ptrace_peek_siginfo(struct task_struct *child, break; #ifdef CONFIG_COMPAT - if (unlikely(is_compat_task())) { + if (unlikely(is_compat_task() && !COMPAT_USE_NATIVE_SIGINFO)) { compat_siginfo_t __user *uinfo = compat_ptr(data); if (copy_siginfo_to_user32(uinfo, &info) || @@ -1126,16 +1126,27 @@ int compat_ptrace_request(struct task_struct *child, compat_long_t request, case PTRACE_GETSIGINFO: ret = ptrace_getsiginfo(child, &siginfo); - if (!ret) - ret = copy_siginfo_to_user32( - (struct compat_siginfo __user *) datap, - &siginfo); + if (!ret) { + if (COMPAT_USE_NATIVE_SIGINFO) + ret = copy_siginfo_to_user( + (struct siginfo __user *) datap, + &siginfo); + else + ret = copy_siginfo_to_user32( + (struct compat_siginfo __user *) datap, + &siginfo); + } break; case PTRACE_SETSIGINFO: memset(&siginfo, 0, sizeof siginfo); - if (copy_siginfo_from_user32( - &siginfo, (struct compat_siginfo __user *) datap)) + if (COMPAT_USE_NATIVE_SIGINFO) + ret = copy_from_user(&siginfo, datap, sizeof(siginfo)); + else + ret = copy_siginfo_from_user32( + &siginfo, + (struct compat_siginfo __user *) datap); + if (ret) ret = -EFAULT; else ret = ptrace_setsiginfo(child, &siginfo);