From: Al Viro <viro@zeniv.linux.org.uk>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: "James Bottomley" <James.Bottomley@hansenpartnership.com>,
linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org,
"Ryan Lee" <ryan.lee@canonical.com>,
"Malte Schröder" <malte.schroeder@tnxip.de>,
"Christian Brauner" <brauner@kernel.org>
Subject: Re: [PATCH] efivarfs: fix NULL dereference on resume
Date: Tue, 18 Mar 2025 07:49:22 +0000 [thread overview]
Message-ID: <20250318074922.GX2023217@ZenIV> (raw)
In-Reply-To: <CAMj1kXHOqzvpUOMTpfQfny10B7M3WnwPYdm1jVX7saP4cy2F=A@mail.gmail.com>
On Tue, Mar 18, 2025 at 08:04:59AM +0100, Ard Biesheuvel wrote:
> the latter is only needed when it is mounted to begin with, and as a
> VFS non-expert, I struggle to understand why it is a) ok and b)
> preferred to create a new mount to pass to kernel_file_open(). Could
> we add a paragraph to the commit log that explains this?
I'm not at all convinced that iterate_dir() is the right thing to use
there, but *IF* we go that way, yes, we need a reference to struct
mount. We are not going to introduce a very special kind of struct
file, along with the arseloads of checking for that crap all over the
place - not for the sake of one weird case in one weird filesystem.
file->f_path is a valid struct path, which means that ->mnt->mnt_sb == ->dentry->d_sb
and refcount of ->mnt is positive as long as struct file exists.
Keeping a persistent internal struct mount is, of course, possible,
but it will make the damn thing impossible to rmmod, etc. - it will
remain in place until the reboot.
It might be possible to put together something like "grab a reference
to superblock and allocate a temporary struct mount refering to it"
(which is what that vfs_kern_mount() boils down to). But I would
very much prefer to have it go over the list of children of ->s_root
manually, instead of playing silly buggers with iterate_dir().
And yes, it would require exclusion with dissolving dentry tree on
umount, for obvious reasons. Which might be done with ->s_active
or simply by unregistering that notifier chain as the very first step
in ->kill_sb() there.
next prev parent reply other threads:[~2025-03-18 7:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 3:06 [PATCH] efivarfs: fix NULL dereference on resume James Bottomley
2025-03-18 3:37 ` Al Viro
2025-03-18 7:04 ` Ard Biesheuvel
2025-03-18 7:49 ` Al Viro [this message]
2025-03-18 12:15 ` James Bottomley
2025-03-18 14:13 ` Christian Brauner
2025-03-18 14:52 ` James Bottomley
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=20250318074922.GX2023217@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=James.Bottomley@hansenpartnership.com \
--cc=ardb@kernel.org \
--cc=brauner@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-fsdevel@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