Linux EFI development
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: James Bottomley <James.Bottomley@hansenpartnership.com>
Cc: "Christian Brauner" <brauner@kernel.org>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Ryan Lee" <ryan.lee@canonical.com>,
	"Malte Schröder" <malte.schroeder@tnxip.de>,
	linux-security-module@vger.kernel.org,
	apparmor <apparmor@lists.ubuntu.com>,
	linux-efi@vger.kernel.org,
	"John Johansen" <john.johansen@canonical.com>,
	"jk@ozlabs.org" <jk@ozlabs.org>,
	linux-fsdevel@vger.kernel.org
Subject: Re: apparmor NULL pointer dereference on resume [efivarfs]
Date: Tue, 11 Mar 2025 17:15:34 +0000	[thread overview]
Message-ID: <20250311171534.GQ2023217@ZenIV> (raw)
In-Reply-To: <78a59e2a5012bfb2d6a653782ab346b44b211102.camel@HansenPartnership.com>

On Tue, Mar 11, 2025 at 12:20:05PM -0400, James Bottomley wrote:

> That's the way it's supposed to work, yes.  However, if we move to an
> always persistent superblock and mnt, I was thinking there'd have to be
> an indicator in the sfi about whether the variables were reflected or
> not.

Just have a pointer to superblock set at ->get_tree() and cleared at
the very beginning of ->kill_sb(), then have notifier bugger off if
that thing's NULL or if atomic_inc_not_zero(sb->s_active) fails
(rcu_read_lock() is sufficient for memory safety of that).  And
do deactivate_super() when you are done.

That'll give you exclusion with umount.  As for the rest of that...
fuck it, just have kern_mount()/kern_unmount() inside that.
How hot do you expect that notifier chain to be?

Or screw playing with open/iterate_dir, but that'll need some thinking -
theoretically everything you need is already accessible, but direct
access to ->d_lock/->d_sib in there is almost certainly not the right
level of abstraction.  We already have similar bits and pieces
in autofs and ceph, and it's just a matter of figuring out a good
set of primitives.

  reply	other threads:[~2025-03-11 17:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <e54e6a2f-1178-4980-b771-4d9bafc2aa47@tnxip.de>
     [not found] ` <CAKCV-6s3_7RzDfo_yGQj9ndf4ZKw_Awf8oNc6pYKXgDTxiDfjw@mail.gmail.com>
     [not found]   ` <465d1d23-3b36-490e-b0dd-74889d17fa4c@tnxip.de>
2025-03-10 19:57     ` apparmor NULL pointer dereference on resume Ryan Lee
2025-03-10 21:49       ` apparmor NULL pointer dereference on resume [efivarfs] James Bottomley
2025-03-11  7:16         ` Ard Biesheuvel
2025-03-11  8:45           ` Christian Brauner
2025-03-11 13:01             ` James Bottomley
2025-03-11 15:55               ` Christian Brauner
2025-03-11 16:19                 ` Christian Brauner
2025-03-11 16:20                 ` James Bottomley
2025-03-11 17:15                   ` Al Viro [this message]
2025-03-11 17:46                     ` James Bottomley
2025-03-14 14:59               ` [RFC 1/1] fix NULL mnt [was Re: apparmor NULL pointer dereference on resume [efivarfs]] James Bottomley
2025-03-15 10:04                 ` Christian Brauner
2025-03-15 18:41                   ` James Bottomley
2025-03-16  6:46                     ` Christian Brauner
2025-03-16 14:26                       ` James Bottomley
2025-03-16 19:19                         ` Ard Biesheuvel
2025-03-17  8:56                         ` Christian Brauner

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=20250311171534.GQ2023217@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=apparmor@lists.ubuntu.com \
    --cc=ardb@kernel.org \
    --cc=brauner@kernel.org \
    --cc=jk@ozlabs.org \
    --cc=john.johansen@canonical.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=malte.schroeder@tnxip.de \
    --cc=ryan.lee@canonical.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