Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3038403pxy; Mon, 3 May 2021 13:40:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzo6fr1j/YDLV8dOvqFjzIj+ll3HJijVXQeOG1U3/PtO1KCa6p6k/O1S9viqVKBvdRCPr4x X-Received: by 2002:a17:906:270a:: with SMTP id z10mr18042990ejc.204.1620074435385; Mon, 03 May 2021 13:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620074435; cv=none; d=google.com; s=arc-20160816; b=K1D7HlLn066OianN+zrrAUKY9qb0sRZiI1N0YokNb3FCNe6XhzjjIAuJMvKrL9P4/M EF1NMx3e/aoBkrxP5FwLdikhtd81VwQNdkvDcufYNeVptS4YDve7S6TxkfvjtlGn864T u4AyhZjDzCK0nfdONzywk+an1BK+S/OOn5Bx4ypTlOx94s1RhLr3Ux4a4BW7YuFbkxG2 1gCtTKQR2M47QZYGxMVZVI22etuFdIrRZbqcW1ATZSRBcHQ28dniI3dLthW22Es3ydAR NRc3i2LN0V8zY7JV1YwAwU2oYi/qnAruGOVWC6ttM5OCwwP66/old3i2oaYWpmlqODz5 m1gQ== 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=dn7AvFl/JnkAuhxQgsh+STg+HqsuBRo/BtQuioqDot4=; b=gIOdf2ghBW2LG9PHCH7w63EhMM6DxilhK96JIR3TKga85jP/aFFdBl0AwrRSZkqi6h w2nS8sK0cWDbiGKhmB6+NCQ9UvVZgIJiTVVuONmVL4CemWz8smA5JloWt7rhHADbenMe MVe13oiveSQExJLlj2tkpkuWqCZEIEh6UbfkSC5nRPAdeLM+1kz1qfbdF9SBVV2okc+f jECHfb/AwOFMWEdgWHwBlWJfp3O9De66Hul4yubbusrcsPlfXFJaHwjjlGbTTby02kSf d0lvpWJEvhXEfRq01a0Q8gIht7qCuk/80NmaRtdJZ3o7eye6xv1KInqixY0WacItDMZw Bq+w== 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 f19si10695125eds.552.2021.05.03.13.40.12; Mon, 03 May 2021 13:40:35 -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 S229725AbhECUj5 (ORCPT + 99 others); Mon, 3 May 2021 16:39:57 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:58890 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229687AbhECUjw (ORCPT ); Mon, 3 May 2021 16:39:52 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1ldfLF-00Gyht-Nu; Mon, 03 May 2021 14:38:57 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95] helo=fess.int.ebiederm.org) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1ldfLE-00E76Y-EF; Mon, 03 May 2021 14:38:57 -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: Mon, 3 May 2021 15:38:05 -0500 Message-Id: <20210503203814.25487-3-ebiederm@xmission.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210503203814.25487-1-ebiederm@xmission.com> References: <20210503203814.25487-1-ebiederm@xmission.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-XM-SPF: eid=1ldfLE-00E76Y-EF;;;mid=<20210503203814.25487-3-ebiederm@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18aqVjhVCfZ9EPyVLBUkpnE5ieCrnKAZ+w= 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 sa01.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-Virus: No 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] * 1.5 XMNoVowels Alpha-numberic number with no vowels * 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 * [sa01 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; sa01 1397; Body=1 Fuz1=1 X-Spam-Combo: **;Marco Elver X-Spam-Relay-Country: X-Spam-Timing: total 652 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.9 (0.6%), b_tie_ro: 2.7 (0.4%), parse: 0.76 (0.1%), extract_message_metadata: 9 (1.4%), get_uri_detail_list: 1.90 (0.3%), tests_pri_-1000: 11 (1.7%), tests_pri_-950: 1.05 (0.2%), tests_pri_-900: 0.83 (0.1%), tests_pri_-90: 219 (33.5%), check_bayes: 217 (33.3%), b_tokenize: 9 (1.3%), b_tok_get_all: 7 (1.1%), b_comp_prob: 1.35 (0.2%), b_tok_touch_all: 197 (30.2%), b_finish: 0.72 (0.1%), tests_pri_0: 395 (60.6%), check_dkim_signature: 0.43 (0.1%), check_dkim_adsp: 2.4 (0.4%), poll_dns_idle: 1.04 (0.2%), tests_pri_10: 2.4 (0.4%), tests_pri_500: 7 (1.1%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 03/12] arm64: 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 in02.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. Signed-off-by: Marco Elver Signed-off-by: Eric W. Biederman --- arch/arm64/kernel/signal.c | 36 ++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/signal32.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index 6237486ff6bb..af8bd2af1298 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -973,3 +973,39 @@ void __init minsigstksz_setup(void) round_up(sizeof(struct frame_record), 16) + 16; /* max alignment padding */ } + +/* + * 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_addr_lsb) == 0x18); +static_assert(offsetof(siginfo_t, si_lower) == 0x20); +static_assert(offsetof(siginfo_t, si_upper) == 0x28); +static_assert(offsetof(siginfo_t, si_pkey) == 0x20); +static_assert(offsetof(siginfo_t, si_perf) == 0x18); +static_assert(offsetof(siginfo_t, si_band) == 0x10); +static_assert(offsetof(siginfo_t, si_fd) == 0x18); +static_assert(offsetof(siginfo_t, si_call_addr) == 0x10); +static_assert(offsetof(siginfo_t, si_syscall) == 0x18); +static_assert(offsetof(siginfo_t, si_arch) == 0x1c); diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c index 2f507f565c48..b6afb646515f 100644 --- a/arch/arm64/kernel/signal32.c +++ b/arch/arm64/kernel/signal32.c @@ -457,3 +457,39 @@ void compat_setup_restart_syscall(struct pt_regs *regs) { regs->regs[7] = __NR_compat_restart_syscall; } + +/* + * 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_addr_lsb) == 0x10); +static_assert(offsetof(compat_siginfo_t, si_lower) == 0x14); +static_assert(offsetof(compat_siginfo_t, si_upper) == 0x18); +static_assert(offsetof(compat_siginfo_t, si_pkey) == 0x14); +static_assert(offsetof(compat_siginfo_t, si_perf) == 0x10); +static_assert(offsetof(compat_siginfo_t, si_band) == 0x0c); +static_assert(offsetof(compat_siginfo_t, si_fd) == 0x10); +static_assert(offsetof(compat_siginfo_t, si_call_addr) == 0x0c); +static_assert(offsetof(compat_siginfo_t, si_syscall) == 0x10); +static_assert(offsetof(compat_siginfo_t, si_arch) == 0x14); -- 2.30.1