Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3525495ybl; Sun, 15 Dec 2019 11:50:15 -0800 (PST) X-Google-Smtp-Source: APXvYqxJZI3Km+3QF5TzlLIbJDIGXrzd3to7uGsKndfi5jGnjr8XG/MsnKFqRYAV0Biemf1jtUXv X-Received: by 2002:a05:6830:4d9:: with SMTP id s25mr7093574otd.171.1576439415736; Sun, 15 Dec 2019 11:50:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576439415; cv=none; d=google.com; s=arc-20160816; b=m134jlSRJTzPgafTN+bF+1qZfEPHLlgnW8QxcXxQAsIc7bgaSFRbhUcqi2hX+qMLjG HRztTtbJN2r4Ypt+J/cW8l8KwXq6TQiSuGR6cb38Mn0JR/+cjelYOMd0/0+/BGg7eg7I fYXxUSzJ0epWSiMhmDq5jGDsWGL2zJ1BliruQQpmxgvmz2e7QOiGQeZgIyrECCkPPitq 2H2XBBzQ56qnSFJ79NyoWjMaxkB53VKaj67JVA1enYAvT7VoIAr0AuVdpVujtbqyddtL SE8rpibl++eijl0XjzU9KFKfrVGu5rF+hHg+vS/vVUeFvcY4mjzZYFr7ueiXRS7jvSrT j+1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to:date :references:subject:cc:to:from; bh=hTL0p4pdsWC0LZu/5ZxMwsAAA1y4s2vN8OWHJCw6yBU=; b=iJ4nd3Gw4Vh1wY3lZ16RSUhG3oi7S0sC+T6BZxm5q3S7AOoUk11F7sZnd9tucLhDV8 D674LSlnh87sf7OfG8d3K1UWDYBquQEpMEEOoE7y6UnvXds4lNwWmUTFKBorVeYNevrf 2mU109Nk/bQ/jZh5C3BqcDnqBbLgAL0zGW28hvkfD8phqHbefbppd3bPhzjB/OTHTFww uqJVWJTmqvyN8iHpdn5sH5uZZcpnoVRmLU1xYuEG4+QWMExh4XevV6NmAPRZ+0vm7HJW iZHZ6shPYvDLybju2+yNg28MD+VlkST89u1Dy+VJ5touEWbLgtc8nP1k0AmLwof9QYFs Uo0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w1si9324543otp.57.2019.12.15.11.50.03; Sun, 15 Dec 2019 11:50:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726437AbfLOTt0 (ORCPT + 99 others); Sun, 15 Dec 2019 14:49:26 -0500 Received: from albireo.enyo.de ([37.24.231.21]:38274 "EHLO albireo.enyo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726219AbfLOTtZ (ORCPT ); Sun, 15 Dec 2019 14:49:25 -0500 Received: from [172.17.203.2] (helo=deneb.enyo.de) by albireo.enyo.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) id 1igZtC-0008Hm-Si; Sun, 15 Dec 2019 19:49:14 +0000 Received: from fw by deneb.enyo.de with local (Exim 4.92) (envelope-from ) id 1igZsO-0002ti-DI; Sun, 15 Dec 2019 20:48:24 +0100 From: Florian Weimer To: Aleksa Sarai Cc: Alexander Viro , Jeff Layton , "J. Bruce Fields" , Shuah Khan , dev@opencontainers.org, containers@lists.linux-foundation.org, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH] openat2: switch to __attribute__((packed)) for open_how References: <20191213222351.14071-1-cyphar@cyphar.com> Date: Sun, 15 Dec 2019 20:48:24 +0100 In-Reply-To: <20191213222351.14071-1-cyphar@cyphar.com> (Aleksa Sarai's message of "Sat, 14 Dec 2019 09:23:50 +1100") Message-ID: <87o8w9bcaf.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Aleksa Sarai: > diff --git a/tools/testing/selftests/openat2/helpers.h b/tools/testing/selftests/openat2/helpers.h > index 43ca5ceab6e3..eb1535c8fa2e 100644 > --- a/tools/testing/selftests/openat2/helpers.h > +++ b/tools/testing/selftests/openat2/helpers.h > @@ -32,17 +32,16 @@ > * O_TMPFILE} are set. > * > * @flags: O_* flags. > - * @mode: O_CREAT/O_TMPFILE file mode. > * @resolve: RESOLVE_* flags. > + * @mode: O_CREAT/O_TMPFILE file mode. > */ > struct open_how { > - __aligned_u64 flags; > + __u64 flags; > + __u64 resolve; > __u16 mode; > - __u16 __padding[3]; /* must be zeroed */ > - __aligned_u64 resolve; > -}; > +} __attribute__((packed)); > > -#define OPEN_HOW_SIZE_VER0 24 /* sizeof first published struct */ > +#define OPEN_HOW_SIZE_VER0 18 /* sizeof first published struct */ > #define OPEN_HOW_SIZE_LATEST OPEN_HOW_SIZE_VER0 A userspace ABI that depends on GCC extensions probably isn't a good idea. Even with GCC, it will not work well with some future extensions because it pretty much rules out having arrays or other members that are access through pointers. Current GCC does not carry over the packed-ness of the struct to addresses of its members.