From: sashiko-bot@kernel.org
To: "John Groves" <john@jagalactic.com>
Cc: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev
Subject: Re: [PATCH V14 09/12] famfs: Register secondary daxdevs by path (FAMFSIOC_DAXDEV_OPEN)
Date: Sat, 29 Aug 2026 17:25:02 +0000 [thread overview]
Message-ID: <20260829172502.EE7001F000E9@smtp.kernel.org> (raw)
In-Reply-To: <010001a04e828e72-7dd35d21-e02a-4233-b208-bb38a68e0356-000000@email.amazonses.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Lockless read of daxdev->valid lacks a read memory barrier, leading to a TOCTOU race that can yield a NULL pointer and a zero error code.
--
commit 592a1b20aa272f01a78424966dd5d63af6c63cf8
Author: John Groves <John@Groves.net>
famfs: Register secondary daxdevs by path (FAMFSIOC_DAXDEV_OPEN)
Famfs file maps (fmaps) may reference multiple daxdevs. Before passing
an fmap that references a new daxdev, the daxdev is pushed into the
kernel via FAMFSIOC_DAXDEV_OPEN). This adds daxdevs to daxdev_table for
index-based resolution from famfs extents to daxdevs.
> kernel via FAMFSIOC_DAXDEV_OPEN). This adds daxdevs to daxdev_table for
This isn't a bug, but there is an unmatched closing parenthesis after
FAMFSIOC_DAXDEV_OPEN.
> diff --git a/fs/famfs/famfs_file.c b/fs/famfs/famfs_file.c
> index 2200f168aa79d..eba80dab0562d 100644
> --- a/fs/famfs/famfs_file.c
> +++ b/fs/famfs/famfs_file.c
[ ... ]
> +static int
> +famfs_daxdev_open(struct file *file, void __user *arg)
> +{
[ ... ]
> + /*
> + * The daxdev table is allocated at mount time (for the slot-0 primary),
> + * so it is always present here; no need to allocate it.
> + */
> + rc = famfs_install_daxdev(fsi, sb, dd.daxdev_index, devno, path);
[Severity: High]
Does exposing famfs_install_daxdev() to concurrent execution via this ioctl
trigger a race condition in the lockless readers?
famfs_install_daxdev() uses wmb() to ensure daxdev->devp is visible before
setting daxdev->valid = 1:
fs/famfs/famfs_inode.c:famfs_install_daxdev() {
...
wmb(); /* All other fields must be visible before valid */
daxdev->valid = 1;
...
}
However, the readers famfs_dax_err() and famfs_daxdev_from_index() lack a
pairing smp_rmb():
fs/famfs/famfs_file.c:famfs_dax_err() {
if (!dd->valid) {
pr_debug("%s: daxdev=%s invalid\n", __func__, dd->name);
return -EIO;
}
...
}
fs/famfs/famfs_file.c:famfs_daxdev_from_index() {
...
rc = famfs_dax_err(dd);
if (rc) {
*errp = rc;
return NULL;
}
*errp = 0;
return dd->devp;
}
Could the CPU or compiler reorder the loads, reading a stale NULL for devp
before reading valid == 1, resulting in famfs_daxdev_from_index() returning
NULL with a success error code (0)?
--
Sashiko AI review · https://sashiko.dev/#/patchset/010001a04e801a4e-8eb212cd-b263-4043-ab65-33e480d2d7d4-000000@email.amazonses.com?part=9
next prev parent reply other threads:[~2026-08-29 17:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260829171004.7336-1-john@jagalactic.com>
2026-08-29 17:10 ` [PATCH V14 00/12] Subject: [PATCH v14 00/12] famfs: the Fabric-Attached Memory File System (standalone) John Groves
2026-08-29 17:10 ` [PATCH V14 01/12] dax: replace exported dax_dev_get() with non-allocating dax_dev_find() John Groves
2026-08-29 17:11 ` [PATCH V14 02/12] famfs: Module operations, fs_context, and mount John Groves
2026-08-29 17:28 ` sashiko-bot
2026-08-29 17:11 ` [PATCH V14 03/12] famfs: Add daxdev table and dax notify_failure support John Groves
2026-08-29 17:32 ` sashiko-bot
2026-08-29 17:11 ` [PATCH V14 04/12] famfs: Introduce inode_operations and super_operations John Groves
2026-08-29 17:11 ` [PATCH V14 05/12] famfs: Introduce file_operations read/write John Groves
2026-08-29 17:25 ` sashiko-bot
2026-08-29 17:11 ` [PATCH V14 06/12] famfs: Introduce mmap and VM fault handling John Groves
2026-08-29 17:26 ` sashiko-bot
2026-08-29 17:11 ` [PATCH V14 07/12] famfs: MAP_CREATE ioctl and fmap ingest (ABI 44) John Groves
2026-08-29 17:30 ` sashiko-bot
2026-08-29 17:12 ` [PATCH V14 08/12] famfs: iomap_begin and file-to-dax offset resolution John Groves
2026-08-29 17:25 ` sashiko-bot
2026-08-29 17:12 ` [PATCH V14 09/12] famfs: Register secondary daxdevs by path (FAMFSIOC_DAXDEV_OPEN) John Groves
2026-08-29 17:25 ` sashiko-bot [this message]
2026-08-29 17:13 ` [PATCH V14 10/12] famfs: Add runtime operation-permission (opts) framework John Groves
2026-08-29 17:13 ` [PATCH V14 11/12] famfs: Report device capacity via statfs so df works John Groves
2026-08-29 17:30 ` sashiko-bot
2026-08-29 17:13 ` [PATCH V14 12/12] famfs: Add documentation John Groves
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=20260829172502.EE7001F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=john@jagalactic.com \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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.