All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mickaël Salaün" <mic@digikod.net>
To: Tingmao Wang <m@maowtm.org>
Cc: "Günther Noack" <gnoack@google.com>,
	"Al Viro" <viro@zeniv.linux.org.uk>,
	"Ben Scarlato" <akhna@google.com>,
	"Christian Brauner" <brauner@kernel.org>,
	"Daniel Burgener" <dburgener@linux.microsoft.com>,
	"Jann Horn" <jannh@google.com>, "Jeff Xu" <jeffxu@google.com>,
	NeilBrown <neil@brown.name>, "Paul Moore" <paul@paul-moore.com>,
	"Song Liu" <song@kernel.org>,
	linux-fsdevel@vger.kernel.org,
	linux-security-module@vger.kernel.org
Subject: Re: [PATCH v2 1/3] landlock: Fix handling of disconnected directories
Date: Thu, 17 Jul 2025 19:32:45 +0200	[thread overview]
Message-ID: <20250717.aeCheichee0i@digikod.net> (raw)
In-Reply-To: <4d23784f-03de-4053-a326-96a0fa833456@maowtm.org>

On Mon, Jul 14, 2025 at 01:39:12PM +0100, Tingmao Wang wrote:
> On 7/11/25 20:19, Mickaël Salaün wrote:
> > [...]
> > @@ -800,6 +802,8 @@ static bool is_access_to_paths_allowed(
> >  		access_masked_parent1 = access_masked_parent2 =
> >  			landlock_union_access_masks(domain).fs;
> >  		is_dom_check = true;
> > +		memcpy(&_layer_masks_parent2_bkp, layer_masks_parent2,
> > +		       sizeof(_layer_masks_parent2_bkp));
> >  	} else {
> >  		if (WARN_ON_ONCE(dentry_child1 || dentry_child2))
> >  			return false;
> > @@ -807,6 +811,8 @@ static bool is_access_to_paths_allowed(
> >  		access_masked_parent1 = access_request_parent1;
> >  		access_masked_parent2 = access_request_parent2;
> >  		is_dom_check = false;
> > +		memcpy(&_layer_masks_parent1_bkp, layer_masks_parent1,
> > +		       sizeof(_layer_masks_parent1_bkp));
> 
> Is this memcpy meant to be in this else branch?  If parent2 is set, we
> will leave _layer_masks_parent1_bkp uninitialized right?

Good catch!  We should always initialize _layer_masks_parent1_bkp.
I'll move both _layer_masks_parent*_bkp initializations just before the
related allowed_parent* initialization.

> 
> >  	}
> >  
> >  	if (unlikely(dentry_child1)) {

  parent reply	other threads:[~2025-07-17 17:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-11 19:19 [PATCH v2 0/3] Landlock: Disconnected directory handling Mickaël Salaün
2025-07-11 19:19 ` [PATCH v2 1/3] landlock: Fix handling of disconnected directories Mickaël Salaün
2025-07-14 12:39   ` Tingmao Wang
2025-07-15 18:52     ` Mickaël Salaün
2025-07-19 10:19       ` Mickaël Salaün
2025-07-17 17:32     ` Mickaël Salaün [this message]
2025-07-11 19:19 ` [PATCH v2 2/3] selftests/landlock: Add tests for access through disconnected paths Mickaël Salaün
2025-07-11 19:19 ` [PATCH v2 3/3] selftests/landlock: Add disconnected leafs and branch test suites Mickaël Salaün

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=20250717.aeCheichee0i@digikod.net \
    --to=mic@digikod.net \
    --cc=akhna@google.com \
    --cc=brauner@kernel.org \
    --cc=dburgener@linux.microsoft.com \
    --cc=gnoack@google.com \
    --cc=jannh@google.com \
    --cc=jeffxu@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=m@maowtm.org \
    --cc=neil@brown.name \
    --cc=paul@paul-moore.com \
    --cc=song@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.