diff options
| author | Kyle Zeng <kylebot@openai.com> | 2026-10-02 06:17:05 +0000 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-10-14 22:08:02 +0200 |
| commit | 40bb03d3ea6f6a915218508819ecc4d7a7fa260d (patch) | |
| tree | c3ce04814e2074693d7dbc0c9efba3fe0527cc6b /scripts/Makefile.thinlto | |
| parent | 28d2905d77bc2e7c20260a6bc6b4179bdf95cb06 (diff) | |
| download | linux-40bb03d3ea6f6a915218508819ecc4d7a7fa260d.tar.gz linux-40bb03d3ea6f6a915218508819ecc4d7a7fa260d.zip | |
pipe: preserve existing fasync readers on writer setup failure
F_SETFL and FIOASYNC decide whether to invoke ->fasync() before
pipe_fasync() takes pipe->mutex. Two enables of one O_RDWR FIFO can
therefore both enter the callback.
fasync_helper() allocates before checking for an existing entry. If the
first enable installs both entries, a second enable can update the
reader entry and then fail the allocation for the writer entry. The
error path removes the pre-existing reader entry, clearing FASYNC while
the writer entry remains registered. __fput() then skips ->fasync(), so a
later pipe notification can dereference the freed file or its f_owner.
An unprivileged memory-pressure reproducer triggers a KASAN
slab-use-after-free in send_sigio() through this path.
Keep the reader helper's result and undo the registration only if this
call added it. The pipe mutex serializes changes to both lists, so a
failed new registration still removes its reader, while a failed
duplicate preserves the existing registrations and FASYNC. Successful
duplicate enables continue to update fa_fd as before.
Fixes: 76398425bb06 ("Move FASYNC bit handling to f_op->fasync()")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
