From patchwork Sat May 24 07:02:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 30869 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8C4FA2066E for ; Sat, 24 May 2014 07:03:55 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id ij19sf20353981vcb.9 for ; Sat, 24 May 2014 00:03:55 -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:to:to:to:to:sender :precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=r5GX0bSGWdcjlWL5RLrMEFtOX9TOLeJrYUtvTD5U8o0=; b=Bk3TqynsDeMggajH6mAs8Ucxhak5IRh+AIxZNMXqxviSg8gepmsd6o8SpHUnYnVJqT bLKZMp3ek7AI00D7i1qi7rx0VtkepzweLSQvhPS5ADNw3KiY4BmcBJZy0j5/2elygBi+ O2Mm16Gm2QysSDPOqYT+4PODlzCLue48K7jAnUaCSQcFpJf0r/V3Fy2auE0wrFg+N9dM iifl7gmlJptxktV5JSOnH/ky7MjtzaWIt4QKta0H5Ryu/l1NrpCZTUYQx5/gjrgD06Kc opQlxNDPA3cGag2ElpH2qjOMootUnqBL3UuHcNu5KQ2vkHYPA7pX5IIC8sk+ddfA880c OokA== X-Gm-Message-State: ALoCoQlyh0eV0dKGM+BIuMRKX8na/eY7/IJRqPhr/0InvUsPysBf3Gbt/2oRuzikm68viYRxFg9f X-Received: by 10.236.1.198 with SMTP id 46mr3886613yhd.16.1400915035393; Sat, 24 May 2014 00:03:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.232 with SMTP id i95ls2077717qge.7.gmail; Sat, 24 May 2014 00:03:55 -0700 (PDT) X-Received: by 10.58.182.129 with SMTP id ee1mr8707254vec.14.1400915035241; Sat, 24 May 2014 00:03:55 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id ev1si3066637vdb.21.2014.05.24.00.03.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 24 May 2014 00:03:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.179 as permitted sender) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id oy12so7226630veb.24 for ; Sat, 24 May 2014 00:03:55 -0700 (PDT) X-Received: by 10.58.136.168 with SMTP id qb8mr8510044veb.21.1400915035171; Sat, 24 May 2014 00:03:55 -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.220.221.72 with SMTP id ib8csp87410vcb; Sat, 24 May 2014 00:03:54 -0700 (PDT) X-Received: by 10.68.143.231 with SMTP id sh7mr11763167pbb.7.1400915034418; Sat, 24 May 2014 00:03:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vl14si1266837pab.139.2014.05.24.00.03.53 for ; Sat, 24 May 2014 00:03:53 -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 S1751616AbaEXHDT (ORCPT + 27 others); Sat, 24 May 2014 03:03:19 -0400 Received: from mail-ig0-f182.google.com ([209.85.213.182]:45589 "EHLO mail-ig0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751423AbaEXHC0 (ORCPT ); Sat, 24 May 2014 03:02:26 -0400 Received: by mail-ig0-f182.google.com with SMTP id uy17so1523329igb.3 for ; Sat, 24 May 2014 00:02:26 -0700 (PDT) X-Received: by 10.42.21.207 with SMTP id l15mr9527456icb.8.1400914946061; Sat, 24 May 2014 00:02:26 -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 x13sm4676631igp.0.2014.05.24.00.02.23 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 24 May 2014 00:02:25 -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 s4O72Mlv009824 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Sat, 24 May 2014 00:02:22 -0700 Received: (from apinski@localhost) by localhost.localdomain (8.14.3/8.14.3/Submit) id s4O72MSW009823; Sat, 24 May 2014 00:02:22 -0700 From: Andrew Pinski To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Andrew Pinski Subject: [PATCH 20/24] ptrace: Allow compat to use the native siginfo. Date: Sat, 24 May 2014 00:02:15 -0700 Message-Id: <1400914939-9708-21-git-send-email-apinski@cavium.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1400914939-9708-1-git-send-email-apinski@cavium.com> References: <1400914939-9708-1-git-send-email-apinski@cavium.com> To: linux-arm-kernel@lists.infradead.org To: linux-kernel@vger.kernel.org To: Roland McGrath To: Oleg Nesterov 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.128.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. Thanks, Andrew Pinski Signed-off-by: Andrew Pinski --- include/linux/compat.h | 4 ++++ kernel/ptrace.c | 24 +++++++++++++++++------- 2 files changed, 21 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 adf9862..5f8bb5c 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -663,7 +663,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) || @@ -1132,16 +1132,26 @@ 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);