Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp747666pxy; Thu, 22 Apr 2021 12:25:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHQ6a5od2PqYcl5HzarVZE8WVMi/s9/ox3zKZbI6lQqYV0Qo7KqoNarrHRe6OUbTZ3ez34 X-Received: by 2002:a17:906:fcc4:: with SMTP id qx4mr267279ejb.42.1619119524986; Thu, 22 Apr 2021 12:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619119524; cv=none; d=google.com; s=arc-20160816; b=istq2aosrBtDcKqq7DBhYzTAlYlgZsJWzcUedtl53i82rqXGD2XsFCpIAc6e4YWNjM 2V84LnpGAqOkkpMyKO+EjlJvt6EMHFOfZC/yuUpRmqHpnqkcKtyMJ/Ih1zIIc8iweDTO 9GchxLMqmaUQoHQrWvlTGVVi9xiMVRAvWND1/GnvY90LbernDjbtP1hmorbFj5gVR1Lo PF0hhsbfs0jozkjw+9NtVJ5i5aep94ucM9DC1ZVJ5zYGjK2OhKIw43HrWiQ5XGx2X3Sf wOy+eR+JpsyKDsi34Ecpqe15jYgryN8qQIBqXEnYlh+Cu9ie2+Tior2VvXBZ1Nj+kHVp wssw== 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=66cEbil9eINHpcRrkzmgQxcSDhUEl5mJfXPxp3tOEXI=; b=BiHBVwdxNzVUlboIF70DZD1qzi5GiECps4wCKmEov2DmVjoq6CWUDRL3wd+U0cFrZj nKDozzN4Evqc8GpNW2HhlkwSxw3FSzhWuJmG3K2HBQg8lhVJDQaPYU9aHLnV8BrUcNwJ y367WOPYARNGfOzwAC2J4yTKXQsIBSR11PHGziqBgITEZB1UithQIICwLviuZF1WGh5h 4HcWTp++OjMwZav9aFjV7P606gV6VpxPC0lAEmrHp+3f1CaEO8JF9/KgfNSCgkHpc1S9 0JAcmKjAcqK/cxAS+90FwCbvqW/AQC6Vx8j7OOF6aLJbLP5wNNffMvHzAQxYSo+8GeYG oBjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=IuMg6mQe; 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 v13si3168875ejh.540.2021.04.22.12.25.01; Thu, 22 Apr 2021 12:25:24 -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=IuMg6mQe; 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 S236668AbhDVTXV (ORCPT + 99 others); Thu, 22 Apr 2021 15:23:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238142AbhDVTXU (ORCPT ); Thu, 22 Apr 2021 15:23:20 -0400 Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF020C06174A for ; Thu, 22 Apr 2021 12:22:44 -0700 (PDT) Received: by mail-ot1-x331.google.com with SMTP id 92-20020a9d02e50000b029028fcc3d2c9eso20729372otl.0 for ; Thu, 22 Apr 2021 12:22:44 -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=66cEbil9eINHpcRrkzmgQxcSDhUEl5mJfXPxp3tOEXI=; b=IuMg6mQeBwJh4wTwLnveFoFpVCocNbp/3EC4dwCMijoPhLgQM2OBh4NUIZQwRzsLzW yYUK/yBVD+pjy3xQqUyrjYIWcB65J/+htg7XP2EYaEZ6LluevaV3OfGb5DqbxPWkexz9 e9Hr4nzsad9879fuUtXEkkmYIvolaJX/qO07bJ9/pH2oCxyYlNvUU180O1hr+XS7qAcP HOJ0PnJLi5S79sK+mXpRHBp5AzAf3NweX5pKLSbi3BCQUEnEGKeNSulp4rqrWsDneIsn DjK05zqJ25SPj0NRq+FOEEn5/fGxMyOzXla900ECNgIHH6ZPofKnTKl0LWDF6GSoFUf9 WWWw== 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=66cEbil9eINHpcRrkzmgQxcSDhUEl5mJfXPxp3tOEXI=; b=kQA1UXf2OxKZBjeh95L0wJAV/BXXRSmkoyqzGHdxz3iFmp49i1Ts8dBPFbsbt0IksO iWBhmC18/xLvEVHYn/LfWP+inZjXo5nCSVP2Ct6pwfVrNc7HgJKE1hD5KX1fU+uMR3by quWASjaqqiqsbHYJxDiKMnK5GGKWuN0feT82YS19jaE/YcacGVT4MiwkkPU1doNL/Fj0 vjlXXu9QvngL1HZHjBz/Dz6smMOAcJAROdBXLbI5wlwbtd1Q2IRoLCmYMNUP/BlozP8L EUc0HNzAca69fAjjAk6qEWfqCVQF1iqJ+Z/4WPtdUqveX89uhSAiUQZ0CxBc8Exr4/ja Vczg== X-Gm-Message-State: AOAM532sBrpiGK+2dGB7q4nSGnI40OTjTmni98fLf0PISIdJ2Az2V2oR YwWS3R7szm0DXH0unMf+r4uDeSDI2dUmX6CqB/iAmw== X-Received: by 2002:a9d:1ea9:: with SMTP id n38mr83098otn.233.1619119364007; Thu, 22 Apr 2021 12:22:44 -0700 (PDT) MIME-Version: 1.0 References: <20210422064437.3577327-1-elver@google.com> In-Reply-To: From: Marco Elver Date: Thu, 22 Apr 2021 21:22:31 +0200 Message-ID: Subject: Re: [PATCH tip 1/2] signal, perf: Fix siginfo_t by avoiding u64 on 32-bit architectures To: David Laight Cc: "peterz@infradead.org" , "mingo@redhat.com" , "tglx@linutronix.de" , "m.szyprowski@samsung.com" , "jonathanh@nvidia.com" , "dvyukov@google.com" , "glider@google.com" , "arnd@arndb.de" , "christian@brauner.io" , "axboe@kernel.dk" , "pcc@google.com" , "oleg@redhat.com" , "kasan-dev@googlegroups.com" , "linux-arch@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 22 Apr 2021 at 12:17, Marco Elver wrote: > On Thu, 22 Apr 2021 at 11:48, David Laight wrote: > > > > From: Marco Elver > > > Sent: 22 April 2021 07:45 > > > > > > On some architectures, like Arm, the alignment of a structure is that of > > > its largest member. > > > > That is true everywhere. > > (Apart from obscure ABI where structure have at least 4 byte alignment!) > > For instance, x86 didn't complain, nor did m68k. Both of them have > compile-time checks for the layout (I'm adding those for Arm > elsewhere). [...] > > Much as I hate __packed, you could add __packed to the > > definition of the structure member _perf. > > The compiler will remove the padding before it and will > > assume it has the alignment of the previous item. > > > > So it will never use byte accesses. > > Sure __packed works for Arm. But I think there's no precedent using > this on siginfo_t, possibly for good reasons? I simply can't find > evidence that this is portable on *all* architectures and for *all* > possible definitions of siginfo_t, including those that live in things > like glibc. > > Can we confirm that __packed is fine to add to siginfo_t on *all* > architectures for *all* possible definitions of siginfo_t? I currently > can't. And given it's outside the scope of the C standard (as of C11 > we got _Alignas, but that doesn't help I think), I'd vote to not > venture too far for code that should be portable especially things as > important as siginfo_t, and has definitions *outside* the kernel (I > know we do lots of non-standard things, but others might not). After thinking about this all afternoon, you convinced me that the commit message wasn't great, and this should be in the commit message, too: https://lkml.kernel.org/r/20210422191823.79012-1-elver@google.com Thanks, -- Marco