Linux CXL
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "John Groves" <john@jagalactic.com>
Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org
Subject: Re: [PATCH V14 03/12] famfs: Add daxdev table and dax notify_failure support
Date: Sat, 29 Aug 2026 17:32:23 +0000	[thread overview]
Message-ID: <20260829173223.7799A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <010001a04e8100cf-a8efea37-2f0c-4862-b4a9-9dc70cf04b34-000000@email.amazonses.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Incorrect memory ordering primitive for publishing lockless state (wmb() vs smp_store_release())
--

commit df7a50134ff93b3213d9bbccb1aca11a71421bee
Author: John Groves <John@Groves.net>

famfs: Add daxdev table and dax notify_failure support

This commit introduces the daxdev table for famfs, which manages multiple dax
devices using a basic structure, primitives, and serialization. It also adds
dax_holder_operations and a notify_failure handler required to properly open
a famfs-mode daxdev.

> diff --git a/fs/famfs/famfs_inode.c b/fs/famfs/famfs_inode.c
> index 5a13903da61b7..5735d8d1900bd 100644
> --- a/fs/famfs/famfs_inode.c
> +++ b/fs/famfs/famfs_inode.c

[ ... ]

> @@ -76,6 +76,231 @@ famfs_get_inode(
> +int
> +famfs_install_daxdev(
> +	struct famfs_fs_info *fsi,
> +	struct super_block *sb,
> +	u64 index,
> +	dev_t devno,
> +	const char *name)
> +{

[ ... ]

> +		daxdev->devno = devno;
> +		if (name) {
> +			daxdev->name = kstrdup(name, GFP_KERNEL);
> +			if (!daxdev->name) {
> +				fs_put_dax(daxdev->devp, sb);
> +				put_dax(daxdev->devp);
> +				daxdev->devp = NULL;
> +				return -ENOMEM;
> +			}
> +		}
> +
> +		wmb(); /* All other fields must be visible before valid */
> +		daxdev->valid = 1;

[Severity: High]
Does this code safely publish the daxdev structure to concurrent lockless
readers?

In famfs_install_daxdev(), the structure is populated and then its valid flag
is set to 1 after a naked wmb(). While wmb() provides a write barrier for the
writer, it does not enforce pairing on the reader side. If a concurrent
lockless reader (such as famfs_daxdev_from_index() added later in this patch
series) checks valid using a simple read like if (!dd->valid) without a
corresponding read barrier, the CPU could reorder the reads.

If the reads are reordered, the reader could observe valid == 1 but see
uninitialized data or a NULL devp, which might lead to a NULL pointer
dereference.

Could this be converted to use smp_store_release(&daxdev->valid, 1) on the
writer side, and paired with smp_load_acquire() on the lockless reader side?

> +	}
> +
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/010001a04e801a4e-8eb212cd-b263-4043-ab65-33e480d2d7d4-000000@email.amazonses.com?part=3

  reply	other threads:[~2026-08-29 17:32 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 [this message]
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
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=20260829173223.7799A1F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox