Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp612291pxv; Thu, 15 Jul 2021 11:30:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJDMIYznaBwRrgWHVrCdtNWQe2EFfeLkaAYgqjAoD8cMO4M66jx8NxFGbLIFSspkNHDwpe X-Received: by 2002:a6b:db18:: with SMTP id t24mr4275048ioc.163.1626373839981; Thu, 15 Jul 2021 11:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626373839; cv=none; d=google.com; s=arc-20160816; b=fEmmU2bz5LXXOBdi41J4jq5ChmX+QhRewp6JPIICUsWShgvVQ1wxce2trdW7dFr+oh GxT28/5lG6xg/KwZm7IRyUPQZf4boTBtPcuJSif5cyzHt4MOk2t5EDs10VXQrIEbehI1 Sql0LMOPP26glRbbsGM6ZOkN+reKEyJEMyZ1Ed9zLN4CnzPB7BlMstwrfKqL1u6ix20l uPYyMafxSqMPZguur5VAlAPFiknIvzxgJmDu2sF0RYOOj6YaP7wzq4w15yK7Bj0ozTTN qTAZK8YOePjWRZPl0hu7qWxL2lyVSUGtAA2HzlKNs0kCi8DC+wkRpo9ixZHo7Iaghqt8 Qewg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:mime-version:user-agent:message-id :in-reply-to:date:references:cc:to:from; bh=+LyX8cMI2EEHE/Y2HID/uKOM5Mpz4iJQ85dLLK8CQ/c=; b=xh4SE22StCzJqz2OxyRWW6OMzxaFmKOVPsAyKQHpjtr6crmhAYZIt7fkb1JE0gvcwg LMoQrq/wlP3jqzhOM27e6DpRYutAL4jnkxpczFU8pwRRT0rW4Z841BvjMr3OvLAoDUf0 v8yPxlgDE9XpTYtH8EQMiO9SnrVS83b3Pkexz7KNAss6G6j5em3Q64luu/PvpOy58Ra7 xZmReaxxW91mXNdie/4p4FaXnGQBfYTl5ib3HTyYI+KXAKJ2pJL0uSQsU16uIkPR0SA4 gzKv+LeBFLPniZe5BN1QDULU9VQgU4z9eFLGUEaNRWN5KOj3csyRf1R8y8DZRp147+tp D0Yw== 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 n26si7047902jam.80.2021.07.15.11.30.26; Thu, 15 Jul 2021 11:30:39 -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 S237563AbhGOSOc (ORCPT + 99 others); Thu, 15 Jul 2021 14:14:32 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:47968 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233916AbhGOSOc (ORCPT ); Thu, 15 Jul 2021 14:14:32 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1m45ph-00Beo1-Pm; Thu, 15 Jul 2021 12:11:37 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95]:57024 helo=email.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1m45pg-00CT9t-8u; Thu, 15 Jul 2021 12:11:37 -0600 From: ebiederm@xmission.com (Eric W. Biederman) 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 References: <87a6mnzbx2.fsf_-_@disp2133> Date: Thu, 15 Jul 2021 13:11:29 -0500 In-Reply-To: <87a6mnzbx2.fsf_-_@disp2133> (Eric W. Biederman's message of "Thu, 15 Jul 2021 13:09:45 -0500") Message-ID: <87y2a7xx9q.fsf_-_@disp2133> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1m45pg-00CT9t-8u;;;mid=<87y2a7xx9q.fsf_-_@disp2133>;;;hst=in01.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18F+kMpLYBfdBjbPofyGBUsL5UJA13sRFA= 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=2.0 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01, T_TooManySym_02,XMNoVowels,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.4957] * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 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 546 ms - load_scoreonly_sql: 0.07 (0.0%), signal_user_changed: 9 (1.6%), b_tie_ro: 7 (1.3%), parse: 1.17 (0.2%), extract_message_metadata: 13 (2.4%), get_uri_detail_list: 2.3 (0.4%), tests_pri_-1000: 15 (2.7%), tests_pri_-950: 1.34 (0.2%), tests_pri_-900: 1.11 (0.2%), tests_pri_-90: 74 (13.6%), check_bayes: 73 (13.3%), b_tokenize: 10 (1.8%), b_tok_get_all: 6 (1.0%), b_comp_prob: 2.8 (0.5%), b_tok_touch_all: 51 (9.3%), b_finish: 0.91 (0.2%), tests_pri_0: 347 (63.6%), check_dkim_signature: 0.69 (0.1%), check_dkim_adsp: 2.7 (0.5%), poll_dns_idle: 0.40 (0.1%), tests_pri_10: 3.9 (0.7%), tests_pri_500: 77 (14.1%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 2/6] arm: Add compile-time asserts for siginfo_t offsets X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) 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. This could have caught that we cannot portably add 64-bit integers to siginfo_t on 32-bit architectures like Arm before reaching -next: https://lkml.kernel.org/r/20210422191823.79012-1-elver@google.com Link: https://lkml.kernel.org/r/20210429190734.624918-2-elver@google.com Link: https://lkml.kernel.org/r/20210505141101.11519-2-ebiederm@xmission.com Signed-off-by: Marco Elver Signed-off-by: Eric W. Biederman --- arch/arm/kernel/signal.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index a3a38d0a4c85..7ef453e8a96f 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -725,3 +725,40 @@ asmlinkage void do_rseq_syscall(struct pt_regs *regs) rseq_syscall(regs); } #endif + +/* + * 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) == 0x0c); +static_assert(offsetof(siginfo_t, si_uid) == 0x10); +static_assert(offsetof(siginfo_t, si_tid) == 0x0c); +static_assert(offsetof(siginfo_t, si_overrun) == 0x10); +static_assert(offsetof(siginfo_t, si_status) == 0x14); +static_assert(offsetof(siginfo_t, si_utime) == 0x18); +static_assert(offsetof(siginfo_t, si_stime) == 0x1c); +static_assert(offsetof(siginfo_t, si_value) == 0x14); +static_assert(offsetof(siginfo_t, si_int) == 0x14); +static_assert(offsetof(siginfo_t, si_ptr) == 0x14); +static_assert(offsetof(siginfo_t, si_addr) == 0x0c); +static_assert(offsetof(siginfo_t, si_addr_lsb) == 0x10); +static_assert(offsetof(siginfo_t, si_lower) == 0x14); +static_assert(offsetof(siginfo_t, si_upper) == 0x18); +static_assert(offsetof(siginfo_t, si_pkey) == 0x14); +static_assert(offsetof(siginfo_t, si_perf_data) == 0x10); +static_assert(offsetof(siginfo_t, si_perf_type) == 0x14); +static_assert(offsetof(siginfo_t, si_band) == 0x0c); +static_assert(offsetof(siginfo_t, si_fd) == 0x10); +static_assert(offsetof(siginfo_t, si_call_addr) == 0x0c); +static_assert(offsetof(siginfo_t, si_syscall) == 0x10); +static_assert(offsetof(siginfo_t, si_arch) == 0x14); -- 2.20.1