Re: [PATCH v4] efivarfs: add nostatfs mount option to skip QueryVariableInfo()

From: sashiko-bot

Date: Mon Sep 28 2026 - 16:47:27 EST


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] vfs: missing READ_ONCE() for opts->nostatfs in efivarfs_show_options()
--

commit 8539129e21537b2431de520ca79339783ffada2d
Author: Prashant Singh <singhpra@xxxxxxxxxxx>
Subject: efivarfs: add nostatfs mount option to skip QueryVariableInfo()

This commit adds a negatable "nostatfs" mount option to efivarfs. It skips
the EFI QueryVariableInfo() call during statfs(2), which can take tens of
milliseconds and run with preemption disabled. The option can also be toggled
on a live mount via remount.

> diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
> index 8d33f11db2a1b..efeada6e314f4 100644
> --- a/fs/efivarfs/super.c
> +++ b/fs/efivarfs/super.c
> @@ -74,6 +74,9 @@ static int efivarfs_show_options(struct seq_file *m, struct dentry *root)
> if (!gid_eq(opts->gid, GLOBAL_ROOT_GID))
> seq_printf(m, ",gid=%u",
> from_kgid_munged(&init_user_ns, opts->gid));
> + /* Absence of nostatfs means statfs() reports real capacity. */
> + if (opts->nostatfs)
^^^^

[Severity: Low]
Is a READ_ONCE() needed here?

This plain C read of opts->nostatfs in efivarfs_show_options() can race with
the concurrent WRITE_ONCE() in efivarfs_reconfigure() during a remount.

A userspace process reading /proc/mounts calls efivarfs_show_options() holding
only namespace_sem for read, while a concurrent mount -o remount calls
efivarfs_reconfigure() holding only sb->s_umount for write. Because no common
lock serializes these two paths, missing the READ_ONCE() here could lead to a
KCSAN data race splat.

> + seq_puts(m, ",nostatfs");
> return 0;
> }

--
Sashiko AI review · https://sashiko.dev/#/patchset/20260928203445.72318-1-singhpra@xxxxxxxxxxx?part=1