From patchwork Thu Apr 29 19:07:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Elver X-Patchwork-Id: 12231793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBE62C433ED for ; Thu, 29 Apr 2021 19:09:44 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 239B061441 for ; Thu, 29 Apr 2021 19:09:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 239B061441 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:From:Subject:References:Mime-Version: Message-Id:In-Reply-To:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3ErNz7VsJNhpvKUPa1UnmyB/lBQdrZ6od2BdvcJ0n+Q=; b=Ujif8evSL9veFd ZxvdxENY6kB/xF1zlbBkhW9My9OXatSG8TBDUYe1VeG+HefzZxt7j+SnTLKRK8HICm39Ai4JUE6Mu F+N2Bi286w7Av00pFKrd6vhPMdV7/lybJtF86In5fN/KwzGIVHiDZnZGuePXKj9EQsonhKUHPjg4a C3wtZpJCwpGMRM3SLYqJVSLOgW5oZeSMEKBJsk7fVnxcSh4qxgVtd15+JOigGyw/Z+kkdbsWYVacg J8bspJoalckV5GytqUhM8HGg1g4898GlHrsCXc8CDM5w6G3ZOdCeKoUsUQuNj0e/OGd8nwKHjkwHU wKSSxdbM+/gnyfmUQ7Qw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lcC15-006ErX-OD; Thu, 29 Apr 2021 19:08:03 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcC13-006ErL-HC for linux-arm-kernel@desiato.infradead.org; Thu, 29 Apr 2021 19:08:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=zxaAMw4akhCbciRHPnpZSHUl30YIRQsaz3gXR9kG1Po=; b=VEdauYLLx8mFy4+j9VXGPoBK8q WcocnOZ/hQ2znv1z6Hn2hu/l6h1X/lau1iXDpq/01C6J/6M3Fcc2QziaEg6P7gzmvHi15RYf+HG3v CS63QnhLPo6qgi8x9sUKkopkigjv3XtBkzENK2cNsgWpnQ5/yJKNfPFAG9zrwzEeFZm+Od4s5zcSF dqGyOiyH6S859klUz8ZYxoZXPtjIJifyY/VmBlnED9RMAD/IcZv2xwYUAJmzb+awv40Yk2vp6QJZN oChH2TNR/AJGMLaEpHLICaJyiB8rOtmFM1AFaB21b1B6CmKH9tKJIRaE3bUEFYKW94f2XOAC6SmP2 pgLANB8g==; Received: from mail-qt1-x849.google.com ([2607:f8b0:4864:20::849]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcC10-000sVD-Hp for linux-arm-kernel@lists.infradead.org; Thu, 29 Apr 2021 19:08:00 +0000 Received: by mail-qt1-x849.google.com with SMTP id p8-20020a05622a0488b02901bab8dfa0c5so7988712qtx.1 for ; Thu, 29 Apr 2021 12:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=zxaAMw4akhCbciRHPnpZSHUl30YIRQsaz3gXR9kG1Po=; b=d2dcs4BQqMnuAq7Rr2xTHD45zjt6wGFRFpEysevYk2/CGmmxeZMMpXnHYBKDqseXlR BcPpXMVzceP84eBbiOpZI1KIEKAgozCL4pT3/6KT2j2FZ8ODykcyIvKDurPZ8A1zQPQv uawZnMPzGMGpBe9kdh9k44bxDYQ8gNA4DN6IxqUqxuTu2OpoBLeAe0W0AvnxrX6bDjCJ x8HGM7mUjGdt3dFAKlyzhHDLNuaTY0QMI3Qj1M5+2pb/Rm1gkAYyDCHGoptvR/KV/Jnt sZ+hySRgaLsOjMFtDXg65EyqMhCS+J2zK0CX9D8HTPcLa4/9drV1aljrr73oITrCC/nq QMSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=zxaAMw4akhCbciRHPnpZSHUl30YIRQsaz3gXR9kG1Po=; b=W6YNrp8GGm1Q42aVcs/ypthcg+mrZIHMvLEtIbd1ZwRjY5BDJVdkmVKlmQGjwVP6b6 6cW3zlOtAYmZiEzWP50YQ3L6re4vK8Mn9upT+xxcUARL0E6GzOAZIXK7fm67y7twuTc9 Q90QBjgULrGaoKru77ijKYr6R4qfFyDB0PxF84LBre/OacDTWkOwfUSV7rR7QvHk0ph4 KHqXerUAuiRf3L7qxdxtcM7VSdO5EWcTpr0iV5ELHfqQW8YxkWSEbDFieE7z2rtdxOX+ SgqWNs7yUGdD5O0PeV1Jh91UXqc53BLp8FXywYppxbinxTZL32DXvnnXi4AdliSsu0wK v0rg== X-Gm-Message-State: AOAM532vTuS7AKMX4RaEDHsDhFE1PKy1jib74/vX8eX7AChWqxN/F25x 3vA23dGnRf/Q4I05aWRd6A3AigKq0Q== X-Google-Smtp-Source: ABdhPJy/xmZl4EBaLLb/PjEuNHU5XmzVn22MP13ocH+LwGQaeM9nB5FZ38e86gmKR5VieNOLBxZqjEgobw== X-Received: from elver.muc.corp.google.com ([2a00:79e0:15:13:4399:f8b0:aefa:628]) (user=elver job=sendgmr) by 2002:a0c:be11:: with SMTP id k17mr1312693qvg.42.1619723274382; Thu, 29 Apr 2021 12:07:54 -0700 (PDT) Date: Thu, 29 Apr 2021 21:07:33 +0200 In-Reply-To: <20210429190734.624918-1-elver@google.com> Message-Id: <20210429190734.624918-2-elver@google.com> Mime-Version: 1.0 References: <20210429190734.624918-1-elver@google.com> X-Mailer: git-send-email 2.31.1.527.g47e6f16901-goog Subject: [PATCH 2/3] arm: Add compile-time asserts for siginfo_t offsets From: Marco Elver To: elver@google.com, ebiederm@xmission.com Cc: linux@armlinux.org.uk, catalin.marinas@arm.com, will@kernel.org, davem@davemloft.net, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210429_120758_627438_0D0A1429 X-CRM114-Status: UNSURE ( 9.26 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Signed-off-by: Marco Elver --- arch/arm/kernel/signal.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index a3a38d0a4c85..2dac5d2c5cf6 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -725,3 +725,39 @@ 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) == 0x10); +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);