public inbox for linux-security-module@vger.kernel.org
 help / color / mirror / Atom feed
From: "Günther Noack" <gnoack3000@gmail.com>
To: "Mickaël Salaün" <mic@digikod.net>
Cc: John Johansen <john.johansen@canonical.com>,
	kernel test robot <lkp@intel.com>,
	linux-security-module@vger.kernel.org,
	Tingmao Wang <m@maowtm.org>,
	Justin Suess <utilityemal77@gmail.com>,
	Samasth Norway Ananda <samasth.norway.ananda@oracle.com>,
	Matthieu Buffet <matthieu@buffet.re>,
	Mikhail Ivanov <ivanov.mikhail1@huawei-partners.com>,
	konstantin.meskhidze@huawei.com,
	Demi Marie Obenour <demiobenour@gmail.com>,
	Alyssa Ross <hi@alyssa.is>, Jann Horn <jannh@google.com>,
	Tahera Fahimi <fahimitahera@gmail.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	Georgia Garcia <georgia.garcia@canonical.com>
Subject: Re: [PATCH v8 03/12] landlock: Replace union access_masks_all with helper functions
Date: Mon, 30 Mar 2026 21:00:31 +0200	[thread overview]
Message-ID: <20260330.6229e57c9563@gnoack.org> (raw)
In-Reply-To: <20260330.laew6AthooD6@digikod.net>

On Mon, Mar 30, 2026 at 12:53:21PM +0200, Mickaël Salaün wrote:
> On Mon, Mar 30, 2026 at 11:56:40AM +0200, Mickaël Salaün wrote:
> > On Fri, Mar 27, 2026 at 05:48:28PM +0100, Günther Noack wrote:
> > > * Stop using a union for access_masks_all.
> > > * Expose helper functions for intersection checks and union operations.
> > > 
> > > The memory layout of bitfields is only loosely defined by the C
> > > standard, so our static assertion that expects a fixed size was
> > > brittle, and it broke on some compilers when we attempted to add a
> > > 17th file system access right.
> > > 
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Closes: https://lore.kernel.org/oe-kbuild-all/202603261438.jBx2DGNe-lkp@intel.com/
> > > Signed-off-by: Günther Noack <gnoack3000@gmail.com>
> > > ---
> > >  security/landlock/access.h  | 21 ++++++++++++++-------
> > >  security/landlock/cred.h    | 10 ++--------
> > >  security/landlock/ruleset.h | 13 ++++---------
> > >  3 files changed, 20 insertions(+), 24 deletions(-)
> > 
> > I'd prefer this approach:
> > 
> > diff --git a/security/landlock/access.h b/security/landlock/access.h
> > index 89dc8e7b93da..bc9efbb5c900 100644
> > --- a/security/landlock/access.h
> > +++ b/security/landlock/access.h
> > @@ -50,7 +50,7 @@ struct access_masks {
> >         access_mask_t fs : LANDLOCK_NUM_ACCESS_FS;
> >         access_mask_t net : LANDLOCK_NUM_ACCESS_NET;
> >         access_mask_t scope : LANDLOCK_NUM_SCOPE;
> > -};
> > +} __packed;
> 
> Actually, we can just use '__packed __aligned(sizeof(u32))' and avoid
> the static_assert change.  That would have no impact on x86, but pack it
> on m68k.

Thanks, good catch (and thanks for pushing it to mic-next).
Fingers crossed that this works on m68k.

–Günther

  reply	other threads:[~2026-03-30 19:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27 16:48 [PATCH v8 00/12] landlock: UNIX connect() control by pathname and scope Günther Noack
2026-03-27 16:48 ` [PATCH v8 01/12] lsm: Add LSM hook security_unix_find Günther Noack
2026-03-27 17:55   ` Paul Moore
2026-03-30 16:02     ` Mickaël Salaün
2026-03-30 19:02       ` Günther Noack
2026-03-27 16:48 ` [PATCH v8 02/12] landlock: Use mem_is_zero() in is_layer_masks_allowed() Günther Noack
2026-03-27 16:48 ` [PATCH v8 03/12] landlock: Replace union access_masks_all with helper functions Günther Noack
2026-03-30  9:56   ` Mickaël Salaün
2026-03-30 10:53     ` Mickaël Salaün
2026-03-30 19:00       ` Günther Noack [this message]
2026-04-01 17:57         ` Mickaël Salaün
2026-03-27 16:48 ` [PATCH v8 04/12] landlock: Control pathname UNIX domain socket resolution by path Günther Noack
2026-04-02  9:51   ` Sebastian Andrzej Siewior
2026-04-02 18:09   ` Kuniyuki Iwashima
2026-03-27 16:48 ` [PATCH v8 05/12] landlock: Clarify BUILD_BUG_ON check in scoping logic Günther Noack
2026-03-27 16:48 ` [PATCH v8 06/12] samples/landlock: Add support for named UNIX domain socket restrictions Günther Noack
2026-03-27 16:48 ` [PATCH v8 07/12] selftests/landlock: Replace access_fs_16 with ACCESS_ALL in fs_test Günther Noack
2026-03-27 16:48 ` [PATCH v8 08/12] selftests/landlock: Test LANDLOCK_ACCESS_FS_RESOLVE_UNIX Günther Noack
2026-03-27 16:48 ` [PATCH v8 09/12] selftests/landlock: Audit test for LANDLOCK_ACCESS_FS_RESOLVE_UNIX Günther Noack
2026-03-27 16:48 ` [PATCH v8 10/12] selftests/landlock: Check that coredump sockets stay unrestricted Günther Noack
2026-03-27 16:48 ` [PATCH v8 11/12] selftests/landlock: fs_test: Simplify ruleset creation and enforcement Günther Noack
2026-03-27 16:48 ` [PATCH v8 12/12] landlock: Document FS access right for pathname UNIX sockets Günther Noack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260330.6229e57c9563@gnoack.org \
    --to=gnoack3000@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=demiobenour@gmail.com \
    --cc=fahimitahera@gmail.com \
    --cc=georgia.garcia@canonical.com \
    --cc=hi@alyssa.is \
    --cc=ivanov.mikhail1@huawei-partners.com \
    --cc=jannh@google.com \
    --cc=john.johansen@canonical.com \
    --cc=konstantin.meskhidze@huawei.com \
    --cc=kuniyu@google.com \
    --cc=linux-security-module@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=m@maowtm.org \
    --cc=matthieu@buffet.re \
    --cc=mic@digikod.net \
    --cc=samasth.norway.ananda@oracle.com \
    --cc=utilityemal77@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox