Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1672026pxy; Thu, 29 Apr 2021 11:48:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbuqd041E1C+iv8qLRiVvMhftRtMPHztHQOMbQH/5aCzcahoV6czL9vkSSmPveuZMXeQds X-Received: by 2002:a63:f008:: with SMTP id k8mr1071211pgh.15.1619722133536; Thu, 29 Apr 2021 11:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619722133; cv=none; d=google.com; s=arc-20160816; b=k5mySQibuqTEGer0jFh6ppA+oncp54fEyxsf5LAmwNiQs9OClalFZp2T16I/mQdjjw BoQ3DYs/cUMhJ2tZihREfWLXCNjUmk1qtu/3rcIOKAXOSzO9wgZ6hRiHlhces3lf8FIW tJIk+r807uYxOxFe0tztmF5OW9bR2akcjks/0L7VFaLrN2Z3Y+KnK4+LI7xexZPSM/x6 J2OjwhAmE1gfbjel0nkRLf9f1hpf+WKZNcF9ds/yQQaEYv/rphKNLQ5Uf8yxwwbmbsBa JT/4NpNC+WRGrNxo1DW6+cRaKfMGaZxSiooBlZhWl2Z2kHqF1JY9uj+YVJRJA89/FiY3 4N5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8+UJwrU2MphE2H9pVBe4Va+3pVl8MrgEBW+di5Ar9x8=; b=Jg+5lk1QNYP84O8U6lzHmyfohRXPU8nm3zaYmVEnFuspKCp1BE3IhCn1XTIyNe3sI/ uAVJhhb4eUg4By02n9MOW1+XOQpOceSZd7MQFUW5CmxBwpIaNhcug4VfWMBqpRmnOPIS /2yUHD0cFJxAp2RXmg7mh9IaUyVAtHRzO2dT8nFPrXujkFZc3iFNAvqrOOsPKJMeGGYi wa99zi/0CvMASvUBmSa9cumxCaM75VCqlGfUPupFXJxDzZ7qdU9bczjIOABn/b4Um5mH JEEHW+a8HWLsZrGr0mCqUnhw9BSCJnPBhrITemlH2kF9OvmZ8jGNkGBweVT9srE0y9QF 4qfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YheD8PJ4; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a21si590735pls.99.2021.04.29.11.48.40; Thu, 29 Apr 2021 11:48:53 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=YheD8PJ4; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241091AbhD2Srt (ORCPT + 99 others); Thu, 29 Apr 2021 14:47:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241025AbhD2Srs (ORCPT ); Thu, 29 Apr 2021 14:47:48 -0400 Received: from mail-oo1-xc30.google.com (mail-oo1-xc30.google.com [IPv6:2607:f8b0:4864:20::c30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5073CC06138D for ; Thu, 29 Apr 2021 11:47:01 -0700 (PDT) Received: by mail-oo1-xc30.google.com with SMTP id e9-20020a4ada090000b02901f91091e5acso2833709oou.0 for ; Thu, 29 Apr 2021 11:47:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8+UJwrU2MphE2H9pVBe4Va+3pVl8MrgEBW+di5Ar9x8=; b=YheD8PJ4vjevdlZN9xjnFDpXx4r8xj2WfocSQQ4FGrmpUl25K4XoAHracDIHAGonKN Jv3mQKHDRRNGM9uEqJMtY4Yp9sJ3Z6THXD+9dAm2ae5aXwuyvkAQ/SuhvQyXFZNln9i2 akSju72aiY34YA1tJymgIHYtICD8WkUWRdIjCAjzxQr8A9Poah+p2KGQoWPwUYfMK1g7 aLIoo8lvbq17uIsuedHL2iNKfjB94cT0cHbrYZbZxc/kkTs6hyLzneEYpH3ZydvnAXZ0 jvxrcdJ+BRzf2j1qvZOSHDGDCPF+loGh+oihiIW+0yzNjgqWWgkE7+/VoNUsYlxK75OI yKow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8+UJwrU2MphE2H9pVBe4Va+3pVl8MrgEBW+di5Ar9x8=; b=LI3wNwL0airEZb0K1LPFAOUxhD/8r8mgpINVMuTfh5Bju42uIJrey8YaJgGZBGii9M 9T+YY/QVfTMq6PeZmkayp/JzBsqS2hEJ98TTZXrCgPXB0gcqaiMeBOis2Tr6qYQG9Cfd uQGuaKls1OpSMa4XV9DyaJg5McLg5alxc4bJcUv0lyAgIRFETY+3x2j89V+3Sv7FjMI3 8cBAuo0a9V1GYaz/nfwtImfcFSAfdI82Do5jDKcAs1kQa7FzNazM66Zyud2A6amfkNeu 0xH1OE83cgiHavxmrPG6M+NfaOYfwh6ZfiOwnVbKgtAKzVywjiLtnn2N/q7M2ufg66hO 6YPw== X-Gm-Message-State: AOAM530TrLzY6K0138S+fi/FqqhNEpHR5SD+LPVp3cADz10K5MV18yms qLU191bzRMe1T2rCeH6Aj6EBc/Hhc/0S1ZpmRxnxRw== X-Received: by 2002:a4a:96e3:: with SMTP id t32mr1153302ooi.14.1619722020332; Thu, 29 Apr 2021 11:47:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Marco Elver Date: Thu, 29 Apr 2021 20:46:48 +0200 Message-ID: Subject: Re: siginfo_t ABI break on sparc64 from si_addr_lsb move 3y ago To: "Eric W. Biederman" Cc: Florian Weimer , "David S. Miller" , Arnd Bergmann , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Peter Collingbourne , Dmitry Vyukov , Alexander Potapenko , sparclinux@vger.kernel.org, linux-arch , LKML , linux-api@vger.kernel.org, kasan-dev Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Apr 2021 at 19:24, Eric W. Biederman wrote: [...] > > Granted, nobody seems to have noticed because I don't even know if these > > fields have use on sparc64. But I don't yet see this as justification to > > leave things as-is... > > > > The collateral damage of this, and the acute problem that I'm having is > > defining si_perf in a sort-of readable and portable way in siginfo_t > > definitions that live outside the kernel, where sparc64 does not yet > > have broken si_addr_lsb. And the same difficulty applies to the kernel > > if we want to unbreak sparc64, while not wanting to move si_perf for > > other architectures. > > > > There are 2 options I see to solve this: > > > > 1. Make things simple again. We could just revert the change moving > > si_addr_lsb into the union, and sadly accept we'll have to live with > > that legacy "design" mistake. (si_perf stays in the union, but will > > unfortunately change its offset for all architectures... this one-off > > move might be ok because it's new.) > > > > 2. Add special cases to retain si_addr_lsb in the union on architectures > > that do not have __ARCH_SI_TRAPNO (the majority). I have added a > > draft patch that would do this below (with some refactoring so that > > it remains sort-of readable), as an experiment to see how complicated > > this gets. > > > > Which option do you prefer? Are there better options? > > Personally the most important thing to have is a single definition > shared by all architectures so that we consolidate testing. > > A little piece of me cries a little whenever I see how badly we > implemented the POSIX design. As specified by POSIX the fields can be > place in siginfo such that 32bit and 64bit share a common definition. > Unfortunately we did not addpadding after si_addr on 32bit to > accommodate a 64bit si_addr. I think it's even worse than that, see the fun I had with siginfo last week: https://lkml.kernel.org/r/20210422191823.79012-1-elver@google.com ... because of the 3 initial ints and no padding after them, we can't portably add __u64 fields to siginfo, and are forever forced to have subtly different behaviour between 32-bit and 64-bit architectures. :-/ > I find it unfortunate that we are adding yet another definition that > requires translation between 32bit and 64bit, but I am glad > that at least the translation is not architecture specific. That common > definition is what has allowed this potential issue to be caught > and that makes me very happy to see. > > Let's go with Option 3. > > Confirm BUS_MCEERR_AR, BUS_MCEERR_AO, SEGV_BNDERR, SEGV_PKUERR are not > in use on any architecture that defines __ARCH_SI_TRAPNO, and then fixup > the userspace definitions of these fields. > > To the kernel I would add some BUILD_BUG_ON's to whatever the best > maintained architecture (sparc64?) that implements __ARCH_SI_TRAPNO just > to confirm we don't create future regressions by accident. > > I did a quick search and the architectures that define __ARCH_SI_TRAPNO > are sparc, mips, and alpha. All have 64bit implementations. A further > quick search shows that none of those architectures have faults that > use BUS_MCEERR_AR, BUS_MCEERR_AO, SEGV_BNDERR, SEGV_PKUERR, nor do > they appear to use mm/memory-failure.c > > So it doesn't look like we have an ABI regression to fix. That sounds fine to me -- my guess was that they're not used on these architectures, but I just couldn't make that call. I have patches adding compile-time asserts for sparc64, arm, arm64 ready to go. I'll send them after some more testing. Thanks, -- Marco