Received: by 10.213.65.68 with SMTP id h4csp589688imn; Fri, 16 Mar 2018 12:26:19 -0700 (PDT) X-Google-Smtp-Source: AG47ELtWMtxiZYwFEalAsoCRE1qT8EJsdTkY5aezgAeafYbIlpbkDL5neFQfu9FYXmBGKurxL8dK X-Received: by 10.101.69.75 with SMTP id x11mr2372457pgr.69.1521228379512; Fri, 16 Mar 2018 12:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521228379; cv=none; d=google.com; s=arc-20160816; b=rAgS3afxSAlRide2BsTyqkItoSyeKn0IUZvr3UgBe3gMq09dGpF85cx11GwdHhf9sm 8xN8qR7Z1oAoyByQkqwROnZq7rwDZQoN1udv7aipYFStkSJpPMfJBCFtgn2qFULd2Fou eRlfg9kFT1LfNxWIOUgJRcZpv8XOdY0GCrqBaZeYfGgE2y7dgFAFg+/c3TCWC73jXpVR 5oufChFa3rEOduYGjeguVHZIVrkzTT63qsWhCYfN/m/4gghHIsSJ6gDEamQilyaC0ZkQ HEv8vSHdupbgsIz/PjhleIepPffWr/B+u3Ms9P1Gr5Qzv42bf/AodZS5Qd7WSY/jelMq ai7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:in-reply-to:mime-version :user-agent:date:message-id:cc:references:to:from:subject :arc-authentication-results; bh=9mC8gavdekL5bUxjI47rDWb79lna5xpD05L4miusXgw=; b=a4octyqBAqb7uPqfidM621HbYL5mInd2Ykg0Z3Yfwt++CAr97FRBe96JDvzJs1jDV+ Xg6novKA4vmXzazui3rEicU0OfxqWWHskZe8w9pl/gWYHDJEs2VOz++CvxyseAeXxO8d UF6gWUn79GfcL1pleuGKeinYjBn1mj0i3/JK5tErwIuZyDdGoQkfaeTZDRJfCGtouyGo +Ir7mvvxa9n9ZrQNqX9urAH4q1aYSatcn3vgK4TYXUZNMZijMO8kAIc06fI9iX+8p66C ychQoVQHO7eq5/3bwFHlDAWJvqaZpPXJs1Df0flPS74uvyt3YS8VuHvG/X5n6bNX9aJJ wUZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j11si1792970pff.363.2018.03.16.12.26.04; Fri, 16 Mar 2018 12:26:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752307AbeCPTYy (ORCPT + 99 others); Fri, 16 Mar 2018 15:24:54 -0400 Received: from mga04.intel.com ([192.55.52.120]:30325 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751562AbeCPTYw (ORCPT ); Fri, 16 Mar 2018 15:24:52 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 12:24:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,317,1517904000"; d="scan'208";a="25336226" Received: from ray.jf.intel.com (HELO [10.7.201.16]) ([10.7.201.16]) by orsmga007.jf.intel.com with ESMTP; 16 Mar 2018 12:24:51 -0700 Subject: Re: [PATCH 13/22] signal: Move addr_lsb into the _sigfault union for clarity From: Dave Hansen To: "Eric W. Biederman" , linux-kernel@vger.kernel.org References: <87k1wimybi.fsf_-_@xmission.com> <20180116004009.31036-13-ebiederm@xmission.com> <29eb3438-0891-36ee-e5f6-36e26ccf2b89@intel.com> Cc: Al Viro , Oleg Nesterov , linux-arch@vger.kernel.org, Ram Pai Message-ID: <818f8945-f990-a770-476e-f82bdc77dbda@intel.com> Date: Fri, 16 Mar 2018 12:24:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <29eb3438-0891-36ee-e5f6-36e26ccf2b89@intel.com> Content-Type: multipart/mixed; boundary="------------E4E5380CCEAD534ACA4BA262" Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------E4E5380CCEAD534ACA4BA262 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 03/16/2018 12:00 PM, Dave Hansen wrote: > On 01/15/2018 04:40 PM, Eric W. Biederman wrote: >> The addr_lsb fields is only valid and available when the >> signal is SIGBUS and the si_code is BUS_MCEERR_AR or BUS_MCEERR_AO. >> Document this with a comment and place the field in the _sigfault union >> to make this clear. >> >> All of the fields stay in the same physical location so both the old >> and new definitions of struct siginfo will continue to work. > > This breaks the ABI and breaks protection keys. The physical locations > *DO* change. > > Before this patch: > > #define si_pkey _sifields._sigfault._pkey > (gdb) print &((siginfo_t *)0)->_sifields._sigfault._pkey > $1 = (__u32 *) 0x20 > > and after: > > +#define si_pkey _sifields._sigfault._addr_pkey._pkey > (gdb) print &((siginfo_t *)0)->_sifields._sigfault._addr_pkey._pkey > $1 = (__u32 *) 0x1c > > Can we revert this, please? It does not revert cleanly so I reverted it manually. Patch doing that is attached. Should we do this, or is there a better option? --------------E4E5380CCEAD534ACA4BA262 Content-Type: text/x-patch; name="revert-b68a68d3dcc15ebbf23cbe91af1abf57591bd96b.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="revert-b68a68d3dcc15ebbf23cbe91af1abf57591bd96b.patch" index e698ec1..8f8e3ef 100644 --- b/include/linux/compat.h | 12 ++---------- b/include/uapi/asm-generic/siginfo.h | 14 +++----------- 2 files changed, 5 insertions(+), 21 deletions(-) diff -puN include/linux/compat.h~revert-b68a68d3dcc15ebbf23cbe91af1abf57591bd96b include/linux/compat.h --- a/include/linux/compat.h~revert-b68a68d3dcc15ebbf23cbe91af1abf57591bd96b 2018-03-16 12:02:22.156310058 -0700 +++ b/include/linux/compat.h 2018-03-16 12:03:11.341309936 -0700 @@ -222,23 +222,15 @@ typedef struct compat_siginfo { #ifdef __ARCH_SI_TRAPNO int _trapno; /* TRAP # which caused the signal */ #endif + short int _addr_lsb; /* Valid LSB of the reported address. */ union { - /* - * used when si_code=BUS_MCEERR_AR or - * used when si_code=BUS_MCEERR_AO - */ - short int _addr_lsb; /* Valid LSB of the reported address. */ /* used when si_code=SEGV_BNDERR */ struct { - compat_uptr_t _dummy_bnd; compat_uptr_t _lower; compat_uptr_t _upper; } _addr_bnd; /* used when si_code=SEGV_PKUERR */ - struct { - compat_uptr_t _dummy_pkey; - u32 _pkey; - } _addr_pkey; + u32 _pkey; }; } _sigfault; diff -puN include/uapi/asm-generic/siginfo.h~revert-b68a68d3dcc15ebbf23cbe91af1abf57591bd96b include/uapi/asm-generic/siginfo.h --- a/include/uapi/asm-generic/siginfo.h~revert-b68a68d3dcc15ebbf23cbe91af1abf57591bd96b 2018-03-16 12:02:22.157310058 -0700 +++ b/include/uapi/asm-generic/siginfo.h 2018-03-16 12:03:37.071309872 -0700 @@ -94,23 +94,15 @@ typedef struct siginfo { unsigned int _flags; /* see ia64 si_flags */ unsigned long _isr; /* isr */ #endif + short _addr_lsb; /* LSB of the reported address */ union { - /* - * used when si_code=BUS_MCEERR_AR or - * used when si_code=BUS_MCEERR_AO - */ - short _addr_lsb; /* LSB of the reported address */ /* used when si_code=SEGV_BNDERR */ struct { - void *_dummy_bnd; void __user *_lower; void __user *_upper; } _addr_bnd; /* used when si_code=SEGV_PKUERR */ - struct { - void *_dummy_pkey; - __u32 _pkey; - } _addr_pkey; + __u32 _pkey; }; } _sigfault; @@ -150,7 +142,7 @@ typedef struct siginfo { #define si_addr_lsb _sifields._sigfault._addr_lsb #define si_lower _sifields._sigfault._addr_bnd._lower #define si_upper _sifields._sigfault._addr_bnd._upper -#define si_pkey _sifields._sigfault._addr_pkey._pkey +#define si_pkey _sifields._sigfault._pkey #define si_band _sifields._sigpoll._band #define si_fd _sifields._sigpoll._fd #define si_call_addr _sifields._sigsys._call_addr _ --------------E4E5380CCEAD534ACA4BA262--