Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3571547ybl; Sun, 15 Dec 2019 12:56:47 -0800 (PST) X-Google-Smtp-Source: APXvYqxZJAARFbTuZS3LOOWrnlE4VlrAVVvmZf7E82szW3JSl6LoSxbOYEMWzmsSzllus8lNPuVB X-Received: by 2002:a05:6830:1d6a:: with SMTP id l10mr29073687oti.233.1576443407533; Sun, 15 Dec 2019 12:56:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576443407; cv=none; d=google.com; s=arc-20160816; b=iLHUP9bV4uQgWFCL+kGnyHXbcjbAWyVBiEmSQP7g/KsLsUGoR78lxDfVfRlGTGxcQa H5YDmNpxjooh3QO7ANrBXVH/AlU88kGb+fMOWDT52GyRanLmK1lVlAipxGk1WvBs+AVe B1yg2JfyEZ8qyqJAE9VB+fpfZ+JMUtIYqop/SsiUpyoMhKbv7aH4+qqSLPTe7eOAq/Yj 8H882umWOmWmQBgFQ9ZKqmTomFw0ViuAsjU808hcqXAwSuH8yw9ulUBVfv2rNI4VIPbe APFyfkUv4WAMYRfgXtA/a6X1Go8ATXA5N0umiwommAxYVE4r0uapXxdyNPH/dY5zWYsC 0dsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=icyReb2D1fLDw7QyT7ol55iOaf5308MkDqbOKDIx9a0=; b=L8DqmaJMpyHCBy//Hx/8TWxY1jRllLYgekczpATsKkLLpJaZEfKidj2TrmEE/bEJKO r/qyQ0WZF5+UnnO2bdbibT5i9w6B0zgInTMPKWQzEKXSlbHZDdQAucnqp1jtdYfd2z1R toOUOY+ClaxlBgziBIBXOGMXDezGzCLU9kWLOSEQA02JvY0k6bYi+kA3EdH8ytfK/tOC nJ6fkmW4UZFyHXsZWxc42KeTkCH+3uHCtmBPKEoHnwQ2cncUuaNJ9hEt7yVZCZEz4RxG IUmvQhirQ1/BA4t+cfU+myMS5wFuoWhdBi4Dw2/cB4/2NtlM40TNfnesem/uC0kvVMAY zyEw== 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 p186si9654440oih.172.2019.12.15.12.56.35; Sun, 15 Dec 2019 12:56:47 -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 S1726373AbfLOUz5 (ORCPT + 99 others); Sun, 15 Dec 2019 15:55:57 -0500 Received: from mout-p-201.mailbox.org ([80.241.56.171]:53040 "EHLO mout-p-201.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726146AbfLOUz5 (ORCPT ); Sun, 15 Dec 2019 15:55:57 -0500 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 47bcBM0DybzQlB1; Sun, 15 Dec 2019 21:55:55 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id 4aLf2vSWysit; Sun, 15 Dec 2019 21:55:50 +0100 (CET) Date: Mon, 16 Dec 2019 07:55:39 +1100 From: Aleksa Sarai To: Florian Weimer 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 Message-ID: <20191215205539.ly2ns5wglautu47u@yavin.dot.cyphar.com> References: <20191213222351.14071-1-cyphar@cyphar.com> <87o8w9bcaf.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lhbbxkijknkbhl5m" Content-Disposition: inline In-Reply-To: <87o8w9bcaf.fsf@mid.deneb.enyo.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --lhbbxkijknkbhl5m Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019-12-15, Florian Weimer wrote: > * Aleksa Sarai: >=20 > > 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)); > > =20 > > -#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 >=20 > 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. Right, those are also good points. Okay, I'm going to send a separate patch which changes the return value for invalid __padding to -E2BIG, and moves the padding to the end of the struct (along with open_how.mode). That should fix all of the warts I raised, without running into the numerous problems with __attribute__((packed)) of which I am now aware. --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --lhbbxkijknkbhl5m Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQSxZm6dtfE8gxLLfYqdlLljIbnQEgUCXfadxgAKCRCdlLljIbnQ EnZkAQDEI0SqPaVjZ0DfeCNK/Oej24PSHHnlQslkzD1ijil74QD/aTyeW+1lV5OQ nKYasufz04VrST6LL+l0ZOId14X/AAE= =y9fv -----END PGP SIGNATURE----- --lhbbxkijknkbhl5m--