NVDIMM Device and Persistent Memory development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Miklos Szeredi" <mszeredi@redhat.com>
Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org
Subject: Re: [PATCH v2 6/8] fuse: add extent map data structure
Date: Thu, 01 Oct 2026 15:24:45 +0000	[thread overview]
Message-ID: <20261001152446.22F521F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261001150935.655979-7-mszeredi@redhat.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] fuse: sleep in RCU read-side critical section during backing files cleanup
- [Medium] fuse: missing overflow validation on ext->addr and ext->length
--

commit 791e33c26af3a517c133a125042b17d8f5ff57ec
Author: Miklos Szeredi <mszeredi@redhat.com>

fuse: add extent map data structure

Add support for creating and managing extent maps that map file regions to
dax device regions. Introduce FUSE_NOTIFY_BACKING_MAP for populating extent
maps from userspace.

> diff --git a/fs/fuse/backing.c b/fs/fuse/backing.c
> index c852f04989619..e954391d696d0 100644
> --- a/fs/fuse/backing.c
> +++ b/fs/fuse/backing.c
[ ... ]
> @@ -306,12 +310,36 @@ static void fuse_backing_rht_free(void *p, void *data)
>  
>  void fuse_backing_files_free(struct fuse_conn *fc)
>  {
[ ... ]
> +	/*
> +	 * extents are referencing other backings, put these refs before
> +	 * destroying the backings themselves
> +	 */
> +	rhashtable_walk_enter(&fc->backing_64_ht, &iter);
> +	rhashtable_walk_start(&iter);
> +	while ((fb = rhashtable_walk_next(&iter))) {
> +		if (IS_ERR(fb)) {
> +			if (PTR_ERR(fb) == -EAGAIN)
> +				continue;
> +			break;
> +		}
> +		if (fb->type == FUSE_BACKING_EXTMAP) {
> +			fuse_ext_map_destroy(&fb->extents);

[Severity: High]
Does this code sleep in an RCU read-side critical section?

rhashtable_walk_start() explicitly acquires the RCU read lock.
When this code drops the final reference to the underlying DAXDEV backing,
the call chain is:

fuse_ext_map_destroy()
  fuse_backing_put()
    fuse_backing_free()
      fs_put_dax()
        iput()

Since iput() can sleep, it appears this could trigger 'scheduling while
atomic' panics or lockdep warnings when unmounting a FUSE passthrough
connection.

> +			fb->extents.rb_node = NULL;
> +		}
> +	}
> +	rhashtable_walk_stop(&iter);
> +	rhashtable_walk_exit(&iter);
> +
> +	rhashtable_free_and_destroy(&fc->backing_64_ht, fuse_backing_rht_free, NULL);
>  }

> diff --git a/fs/fuse/ext_map.c b/fs/fuse/ext_map.c
> new file mode 100644
> index 0000000000000..ab01d678d08e5
> --- /dev/null
> +++ b/fs/fuse/ext_map.c
[ ... ]
> +static int fuse_add_extent(struct fuse_conn *fc, struct rb_root *extents,
> +			   struct fuse_extent *ext)
> +{
> +	struct fuse_iext *new_fie __free(kfree) = kzalloc_obj(*new_fie);
> +	struct rb_node *parent = NULL, **link = &extents->rb_node;
> +	loff_t end;
[ ... ]
> +	if (overflows_type(ext->offset, loff_t) ||
> +	    check_add_overflow(ext->offset, ext->length, &end))
> +		return fuse_EIO("offset overflow");
> +
> +	new_fie->start = ext->offset;
> +	new_fie->end = end;
> +	new_fie->backing_offset = ext->addr;

[Severity: Medium]
Is it possible for the physical address calculation to wrap around?

The bounds check above validates ext->offset, but appears to omit checking
ext->addr + ext->length for overflow.

Could a user-space process supplying an ext->addr near U64_MAX cause an
integer overflow on the physical address range calculation, resulting in a
non-contiguous backing mapping?

> +
> +	while (*link) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261001150935.655979-1-mszeredi@redhat.com?part=6

  reply	other threads:[~2026-10-01 15:24 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 15:07 [PATCH v2 0/8] fuse: DAX device based extent maps (famfs) Miklos Szeredi
2026-10-01 15:07 ` [PATCH v2 1/8] dax: replace exported dax_dev_get() with non-allocating dax_dev_find() Miklos Szeredi
2026-10-01 15:07 ` [PATCH v2 2/8] fuse: add helpers for EIO return value with kernel message Miklos Szeredi
2026-10-01 15:18   ` sashiko-bot
2026-10-01 16:32   ` Amir Goldstein
2026-10-05  9:46     ` Miklos Szeredi
2026-10-01 15:07 ` [PATCH v2 3/8] fuse: support 64 bit, server allocated backing ID Miklos Szeredi
2026-10-01 15:26   ` sashiko-bot
2026-10-01 17:07   ` Amir Goldstein
2026-10-01 18:58     ` Amir Goldstein
2026-10-05 13:33       ` Miklos Szeredi
2026-10-06 21:24         ` Amir Goldstein
2026-10-07 12:46           ` Miklos Szeredi
2026-10-01 15:07 ` [PATCH v2 4/8] fuse: support opening 64 bit " Miklos Szeredi
2026-10-01 15:22   ` sashiko-bot
2026-10-01 17:09   ` Amir Goldstein
2026-10-01 15:07 ` [PATCH v2 5/8] fuse: add support for opening dax device as backing Miklos Szeredi
2026-10-01 15:30   ` sashiko-bot
2026-10-01 16:07   ` Amir Goldstein
2026-10-01 15:07 ` [PATCH v2 6/8] fuse: add extent map data structure Miklos Szeredi
2026-10-01 15:24   ` sashiko-bot [this message]
2026-10-01 15:07 ` [PATCH v2 7/8] fuse: add extent map I/O support Miklos Szeredi
2026-10-01 15:27   ` sashiko-bot
2026-10-01 16:11   ` Amir Goldstein
2026-10-01 15:07 ` [PATCH v2 8/8] fuse: add support for striped backing Miklos Szeredi
2026-10-05 23:27 ` [PATCH v2 0/8] fuse: DAX device based extent maps (famfs) John Groves
2026-10-06  9:48   ` Miklos Szeredi
2026-10-08 23:00     ` John Groves
2026-10-09 10:39       ` Miklos Szeredi

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=20261001152446.22F521F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    --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