mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fuse: wait for sync init request after abort
@ 2026-07-31 12:03 David Lee
  2026-08-02  8:36 ` Sven Eckelmann
  2026-08-18 13:04 ` Miklos Szeredi
  0 siblings, 2 replies; 3+ messages in thread
From: David Lee @ 2026-07-31 12:03 UTC (permalink / raw)
  To: miklos
  Cc: David Lee, Kyle Zeng, Dominik 'Disconnect3d' Czarnota,
	fuse-devel, linux-kernel, stable

After a fatal signal interrupts synchronous FUSE_INIT,
request_wait_answer() aborts the channel and returns immediately.  If the
request is in an FR_LOCKED reply-copy interval, fuse_chan_abort() leaves
it for the writer to finish.  The synchronous caller can then free the
fuse_init_args that owns the reply destination while the writer is still
copying into it.

Wait for fuse_request_end() after aborting the channel.  This keeps the
synchronous caller's reply storage alive until any locked copy has
finished, while preserving the fatal-signal abort behavior.

Fixes: 204aa22a686b ("fuse: abort on fatal signal during sync init")
Cc: stable@vger.kernel.org
Bug found and triaged by OpenAI Security Research and 
validated by Trail of Bits.

Assisted-by: Codex:gpt-5.6-sol gpt-5.5-cyber
Signed-off-by: Kyle Zeng <kylebot@openai.com>
---
Trail of Bits has a reproducer for this bug that triggers a
KASAN use-after-free and can share if needed.

 fs/fuse/dev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 5763a7cd3..deee1585d 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -725,6 +725,8 @@ static void request_wait_answer(struct fuse_req *req)
 
 		if (req->args->abort_on_kill) {
 			fuse_chan_abort(fch, false);
+			wait_event(req->waitq,
+				   test_bit(FR_FINISHED, &req->flags));
 			return;
 		}
 
-- 
2.53.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fuse: wait for sync init request after abort
  2026-07-31 12:03 [PATCH] fuse: wait for sync init request after abort David Lee
@ 2026-08-02  8:36 ` Sven Eckelmann
  2026-08-18 13:04 ` Miklos Szeredi
  1 sibling, 0 replies; 3+ messages in thread
From: Sven Eckelmann @ 2026-08-02  8:36 UTC (permalink / raw)
  To: miklos, David Lee
  Cc: Kyle Zeng, Dominik 'Disconnect3d' Czarnota, fuse-devel,
	linux-kernel, stable

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

On Friday, 31 July 2026 14:03:52 CEST David Lee wrote:
> Fixes: 204aa22a686b ("fuse: abort on fatal signal during sync init")
> Cc: stable@vger.kernel.org
> Bug found and triaged by OpenAI Security Research and 
> validated by Trail of Bits.
> 
> Assisted-by: Codex:gpt-5.6-sol gpt-5.5-cyber
> Signed-off-by: Kyle Zeng <kylebot@openai.com>

1. weird text (advertisement) + newlines in the tags section which shouldn't be there
   https://docs.kernel.org/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin
   (and all these tag/format related sections below)

2. author didn't sign off the patch (see below)

3. odd unrelated Signed-off-by without any obvious connection to 
   the patch

   - I actually would guess that Kyle Zeng <kylebot@openai.com> is the author 
     and David Lee removed its authorship (From: ) before sending the patch.
     But in its current form, David is claiming to be the author. And even
     when it is the case, David must still add the the non-Author SoB at the
     end.

Regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fuse: wait for sync init request after abort
  2026-07-31 12:03 [PATCH] fuse: wait for sync init request after abort David Lee
  2026-08-02  8:36 ` Sven Eckelmann
@ 2026-08-18 13:04 ` Miklos Szeredi
  1 sibling, 0 replies; 3+ messages in thread
From: Miklos Szeredi @ 2026-08-18 13:04 UTC (permalink / raw)
  To: David Lee
  Cc: Kyle Zeng, Dominik 'Disconnect3d' Czarnota, fuse-devel,
	linux-kernel, stable

On Fri, 31 Jul 2026 at 14:03, David Lee <david.lee@trailofbits.com> wrote:
>
> After a fatal signal interrupts synchronous FUSE_INIT,
> request_wait_answer() aborts the channel and returns immediately.  If the
> request is in an FR_LOCKED reply-copy interval, fuse_chan_abort() leaves
> it for the writer to finish.  The synchronous caller can then free the
> fuse_init_args that owns the reply destination while the writer is still
> copying into it.
>
> Wait for fuse_request_end() after aborting the channel.  This keeps the
> synchronous caller's reply storage alive until any locked copy has
> finished, while preserving the fatal-signal abort behavior.
>
> Fixes: 204aa22a686b ("fuse: abort on fatal signal during sync init")
> Cc: stable@vger.kernel.org
> Bug found and triaged by OpenAI Security Research and
> validated by Trail of Bits.
>
> Assisted-by: Codex:gpt-5.6-sol gpt-5.5-cyber
> Signed-off-by: Kyle Zeng <kylebot@openai.com>

Thanks for the report and patch.

I've committed an equivalent fix to fuse.git #for-next:

64b0b5cacbd2 ("fuse: wait for FR_FINISHED on abort_on_kill to prevent
use-after-free")

Thanks,
Miklos

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-18 13:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-31 12:03 [PATCH] fuse: wait for sync init request after abort David Lee
2026-08-02  8:36 ` Sven Eckelmann
2026-08-18 13:04 ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®