Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp544489pxy; Wed, 5 May 2021 08:11:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlaj6uTjwMhArAOb58LXsxVjo1u5bjJ0bhmS6cYBMcx0cDbCXS0OG4CTcCJxFM3gqcAp8m X-Received: by 2002:a17:906:c836:: with SMTP id dd22mr27415669ejb.427.1620227502414; Wed, 05 May 2021 08:11:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620227502; cv=none; d=google.com; s=arc-20160816; b=Qd4M/qplVg/7J7dtQIc0ylvoDzLADPoxawb9an0lpHeFds3KkS1lsViRRK8wNFvkaH B20I8jj5ea1ZKscwzOfqkNYrtCn4ja85flEiFxcvPZsoDMlfQNWxNS/L5gHQ0S1YSSfu ynrtpwYCR8MYPqAXVJ2QSsDoxqOOiZUysmk1TTykgoA8ytYWtIQnO55em8RHy/dLjKJD 9e4g2YF3mrl3RZQ0D8HVdolz637n+JIKJ7cBlK3qwd1zVs8KspdsnXbS9I8tIojYFZfR xw62/fNBjXx0UQH5XaG6oBV2aGBluj7x5s5amwQDQ8G3id3/gTt8JBuxtNkAbG9xcA5h 08ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from; bh=CyskUuvvhXODkGP4ciR0aasP5HyyA8WbvwLPbiDDhfc=; b=vmaxOBr+UBdxoxBqdL8GqLBacyfJ4llKLfyXQZVsJ3aThGlJpdhpJZDLfhUG04I6/J 0aRa+dAlo2Q7Zjlt9XYVfYEn5G0oF2tjTHIMNRPXMuL0E6w9l7spxRrJJgkcdPKl7em4 ztQkmbodeTQ0tmigk4gMWimRKIaR93WYohCh5yWqoxCxMYBQu5FMlDXJf2B36cURYbut /8I6U7pJ58nEshgNlECPkK2BAUqEZ7TiY4hHBwB6o6NKyBayLkbohh9mL2TNnfyZ65Ry r1tI7BLjcJEx1GhPMOENn7Yk3V4mBa0hHjJbn3skCNfmgWPB+NYg73IeD/LLV+azguMP ipUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p16si5501890ejf.257.2021.05.05.08.11.18; Wed, 05 May 2021 08:11:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233726AbhEEOMK (ORCPT + 99 others); Wed, 5 May 2021 10:12:10 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:42640 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233762AbhEEOMJ (ORCPT ); Wed, 5 May 2021 10:12:09 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out03.mta.xmission.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1leIF4-00CGM5-7L; Wed, 05 May 2021 08:11:10 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95] helo=fess.int.ebiederm.org) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1leIF2-00007y-JL; Wed, 05 May 2021 08:11:09 -0600 From: "Eric W. Beiderman" To: Marco Elver Cc: Arnd Bergmann , Florian Weimer , "David S. Miller" , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Peter Collingbourne , Dmitry Vyukov , Alexander Potapenko , sparclinux , linux-arch , Linux Kernel Mailing List , Linux API , kasan-dev , "Eric W . Biederman" Date: Wed, 5 May 2021 09:10:50 -0500 Message-Id: <20210505141101.11519-1-ebiederm@xmission.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-XM-SPF: eid=1leIF2-00007y-JL;;;mid=<20210505141101.11519-1-ebiederm@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+YennuAj8fnPcv5xPYkUhr4IS6Rpjrrvw= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa07.xmission.com X-Spam-Level: X-Spam-Status: No, score=0.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01, T_TooManySym_02,XMSubLong autolearn=disabled version=3.4.2 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 X-Spam-Combo: ;Marco Elver X-Spam-Relay-Country: X-Spam-Timing: total 1146 ms - load_scoreonly_sql: 0.07 (0.0%), signal_user_changed: 11 (0.9%), b_tie_ro: 9 (0.8%), parse: 1.77 (0.2%), extract_message_metadata: 26 (2.3%), get_uri_detail_list: 4.6 (0.4%), tests_pri_-1000: 23 (2.0%), tests_pri_-950: 1.96 (0.2%), tests_pri_-900: 1.70 (0.1%), tests_pri_-90: 271 (23.6%), check_bayes: 268 (23.4%), b_tokenize: 21 (1.8%), b_tok_get_all: 9 (0.8%), b_comp_prob: 3.3 (0.3%), b_tok_touch_all: 231 (20.2%), b_finish: 0.98 (0.1%), tests_pri_0: 787 (68.6%), check_dkim_signature: 0.95 (0.1%), check_dkim_adsp: 2.7 (0.2%), poll_dns_idle: 0.43 (0.0%), tests_pri_10: 3.8 (0.3%), tests_pri_500: 14 (1.3%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH v3 01/12] sparc64: Add compile-time asserts for siginfo_t offsets X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marco Elver To help catch ABI breaks at compile-time, add compile-time assertions to verify the siginfo_t layout. Unlike other architectures, sparc64 is special, because it is one of few architectures requiring si_trapno. ABI breaks around that field would only be caught here. Link: https://lkml.kernel.org/r/m11rat9f85.fsf@fess.ebiederm.org Suggested-by: Eric W. Biederman Acked-by: David S. Miller Signed-off-by: Marco Elver Signed-off-by: Eric W. Biederman --- arch/sparc/kernel/signal32.c | 34 ++++++++++++++++++++++++++++++++++ arch/sparc/kernel/signal_64.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c index e9695a06492f..778ed5c26d4a 100644 --- a/arch/sparc/kernel/signal32.c +++ b/arch/sparc/kernel/signal32.c @@ -745,3 +745,37 @@ asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp) out: return ret; } + +/* + * Compile-time assertions for siginfo_t offsets. Check NSIG* as well, as + * changes likely come with new fields that should be added below. + */ +static_assert(NSIGILL == 11); +static_assert(NSIGFPE == 15); +static_assert(NSIGSEGV == 9); +static_assert(NSIGBUS == 5); +static_assert(NSIGTRAP == 6); +static_assert(NSIGCHLD == 6); +static_assert(NSIGSYS == 2); +static_assert(offsetof(compat_siginfo_t, si_signo) == 0x00); +static_assert(offsetof(compat_siginfo_t, si_errno) == 0x04); +static_assert(offsetof(compat_siginfo_t, si_code) == 0x08); +static_assert(offsetof(compat_siginfo_t, si_pid) == 0x0c); +static_assert(offsetof(compat_siginfo_t, si_uid) == 0x10); +static_assert(offsetof(compat_siginfo_t, si_tid) == 0x0c); +static_assert(offsetof(compat_siginfo_t, si_overrun) == 0x10); +static_assert(offsetof(compat_siginfo_t, si_status) == 0x14); +static_assert(offsetof(compat_siginfo_t, si_utime) == 0x18); +static_assert(offsetof(compat_siginfo_t, si_stime) == 0x1c); +static_assert(offsetof(compat_siginfo_t, si_value) == 0x14); +static_assert(offsetof(compat_siginfo_t, si_int) == 0x14); +static_assert(offsetof(compat_siginfo_t, si_ptr) == 0x14); +static_assert(offsetof(compat_siginfo_t, si_addr) == 0x0c); +static_assert(offsetof(compat_siginfo_t, si_trapno) == 0x10); +static_assert(offsetof(compat_siginfo_t, si_addr_lsb) == 0x14); +static_assert(offsetof(compat_siginfo_t, si_lower) == 0x18); +static_assert(offsetof(compat_siginfo_t, si_upper) == 0x1c); +static_assert(offsetof(compat_siginfo_t, si_pkey) == 0x18); +static_assert(offsetof(compat_siginfo_t, si_perf) == 0x14); +static_assert(offsetof(compat_siginfo_t, si_band) == 0x0c); +static_assert(offsetof(compat_siginfo_t, si_fd) == 0x10); diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c index a0eec62c825d..c9bbf5f29078 100644 --- a/arch/sparc/kernel/signal_64.c +++ b/arch/sparc/kernel/signal_64.c @@ -556,3 +556,36 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long user_enter(); } +/* + * Compile-time assertions for siginfo_t offsets. Check NSIG* as well, as + * changes likely come with new fields that should be added below. + */ +static_assert(NSIGILL == 11); +static_assert(NSIGFPE == 15); +static_assert(NSIGSEGV == 9); +static_assert(NSIGBUS == 5); +static_assert(NSIGTRAP == 6); +static_assert(NSIGCHLD == 6); +static_assert(NSIGSYS == 2); +static_assert(offsetof(siginfo_t, si_signo) == 0x00); +static_assert(offsetof(siginfo_t, si_errno) == 0x04); +static_assert(offsetof(siginfo_t, si_code) == 0x08); +static_assert(offsetof(siginfo_t, si_pid) == 0x10); +static_assert(offsetof(siginfo_t, si_uid) == 0x14); +static_assert(offsetof(siginfo_t, si_tid) == 0x10); +static_assert(offsetof(siginfo_t, si_overrun) == 0x14); +static_assert(offsetof(siginfo_t, si_status) == 0x18); +static_assert(offsetof(siginfo_t, si_utime) == 0x20); +static_assert(offsetof(siginfo_t, si_stime) == 0x28); +static_assert(offsetof(siginfo_t, si_value) == 0x18); +static_assert(offsetof(siginfo_t, si_int) == 0x18); +static_assert(offsetof(siginfo_t, si_ptr) == 0x18); +static_assert(offsetof(siginfo_t, si_addr) == 0x10); +static_assert(offsetof(siginfo_t, si_trapno) == 0x18); +static_assert(offsetof(siginfo_t, si_addr_lsb) == 0x20); +static_assert(offsetof(siginfo_t, si_lower) == 0x28); +static_assert(offsetof(siginfo_t, si_upper) == 0x30); +static_assert(offsetof(siginfo_t, si_pkey) == 0x28); +static_assert(offsetof(siginfo_t, si_perf) == 0x20); +static_assert(offsetof(siginfo_t, si_band) == 0x10); +static_assert(offsetof(siginfo_t, si_fd) == 0x14); -- 2.30.1