From: Dietmar Maurer <dietmar@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH fuse 1/2] requests: do not reply again after a failed reply
Date: Mon, 30 Nov 2026 15:34:06 +0100 [thread overview]
Message-ID: <20261130143407.328696-1-dietmar@proxmox.com> (raw)
libfuse frees a request whenever it sends a reply, also when sending
fails. The guard of a request was only disarmed after a successful
reply, so a failed one, for example with EBADF after the file system
was unmounted, had the guard reply to the freed request once more:
a use after free, which crashed with a segmentation fault.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
src/requests.rs | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/requests.rs b/src/requests.rs
index de835ab..5a189f1 100644
--- a/src/requests.rs
+++ b/src/requests.rs
@@ -60,8 +60,10 @@ fn reply_err(request: RequestGuard, errno: libc::c_int) -> io::Result<()> {
macro_rules! reply_result {
($self:ident : $expr:expr) => {{
let rc = unsafe { $expr };
+ // libfuse frees the request also when sending the reply failed, so the guard must not
+ // reply again
+ let _done = $self.request.into_raw();
if rc == 0 {
- let _done = $self.request.into_raw();
Ok(())
} else {
Err(io::Error::from_raw_os_error(-rc))
@@ -185,13 +187,7 @@ impl FuseRequest for Lookup {
impl Lookup {
pub fn reply(self, entry: &sys::EntryParam) -> io::Result<()> {
- let rc = unsafe { sys::fuse_reply_entry(self.request.raw, Some(entry)) };
- if rc == 0 {
- let _done = self.request.into_raw();
- Ok(())
- } else {
- Err(io::Error::from_raw_os_error(-rc))
- }
+ reply_result!(self: sys::fuse_reply_entry(self.request.raw, Some(entry)))
}
}
--
2.47.3
next reply other threads:[~2026-11-30 14:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 14:34 Dietmar Maurer [this message]
2026-11-30 14:34 ` [PATCH fuse 2/2] session: keep the session until its last request is answered Dietmar Maurer
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=20261130143407.328696-1-dietmar@proxmox.com \
--to=dietmar@proxmox.com \
--cc=pve-devel@lists.proxmox.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 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.