diff options
| author | Christian Brauner <brauner@kernel.org> | 2026-07-10 11:33:03 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-07-28 15:50:26 +0200 |
| commit | fa5990ca8fd917003e526036bcc50413edb9722c (patch) | |
| tree | 4431adff9edc7324314ba6345b677785bdda08a3 /drivers/pci/host/git@git.tavy.me:linux-stable.git | |
| parent | db1856ea9196cf6e015d12199a34c0b9313c7bfa (diff) | |
binfmt_misc: use exe_file_deny_write_access() for the interpreter clone
For MISC_FMT_OPEN_FILE entries load_misc_binary() clones the
registered interpreter file and denies write access to the clone via
plain deny_write_access(). The clone is installed as
bprm->interpreter and later released by the exec machinery through
exe_file_allow_write_access() which skips the i_writecount increment
for files with FMODE_FSNOTIFY_HSM set.
The deny and allow side can therefore come to different conclusions
when pre-content watches are in play: if a pre-content watch is added
to the interpreter after registration every subsequent exec through
that entry takes a write denial on the clone that is never paired
with a write allowance, driving the interpreter inode's i_writecount
further down with each exec and leaving the interpreter unwritable
even after the entry and all its users are gone.
Take the write denial via exe_file_deny_write_access() so both sides
of the pairing base their decision on the same file mode, and
propagate failure instead of silently ignoring it: an interpreter
that is concurrently open for writing now fails the exec with
ETXTBSY, exactly like an interpreter freshly opened via open_exec()
would.
Link: https://patch.msgid.link/20260710-work-binfmt_misc-locking-v3-2-a162f7cb58d6@kernel.org
Fixes: 0357ef03c94e ("fs: don't block write during exec on pre-content watched files")
Cc: stable@vger.kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'drivers/pci/host/git@git.tavy.me:linux-stable.git')
0 files changed, 0 insertions, 0 deletions
