[PATCH v2 0/3] coda: check and serialize Venus replies

From: Mar Dominguez

Date: Sat Dec 05 2026 - 18:31:17 EST


Three changes for the Coda upcall path.

Patches 1 and 2 add defensive bounds checks on the symlink target in
venus_readlink() and the pioctl output in venus_pioctl() against the
size of the reply from Venus, instead of using the offset and length
in the reply as given.

Patch 3 fixes a race in coda_psdev_write() by holding vc_mutex until
the reply has been copied, any CODA_OPEN_BY_FD file lookup has
finished, the request is marked done, and the waiter has been woken.
Until now a waiter interrupted by a signal after the request was
unlinked from vc_processing and before CODA_REQ_WRITE was set could
call list_del() a second time (causing an oops, or a use-after-free
when list debugging is enabled with BUG_ON_DATA_CORRUPTION=n).

Tested on x86_64 with KASAN under QEMU using a minimal stand-in Venus
that sends the malformed replies and, for patch 3, interrupts the
waiting process while the reply is copied: KASAN and list-debug reports
before, none after. Not tested with the real Venus userspace, on other
architectures or on a kernel without KASAN. A reproducer is available
privately on request.

Found and written with an LLM coding assistant.

---
Changes in v2:
- Patches 1 and 2: Reframed as defensive hardening against a buggy or
short reply from Venus; dropped security wording, Fixes, and
stable-backport tags (per Jan Harkes).
- Patch 3: Corrected the commit description to reflect the actual
signal-interrupt trigger between unlink and CODA_REQ_WRITE, dropped
the inaccurate timeout/post-CODA_REQ_WRITE wording, and noted the
vc_mutex/mmap_lock lockdep relationship with copy_from_user() (per
Jan Harkes).
- Rebased onto current mainline (0fbf78feb38a); no code changes from v1.

v1: https://lore.kernel.org/linux-fsdevel/4tunabGBgBhPxJPJjae4oObi5JWoQRidatkh@xxxxxxxxxxxx/

Mar Dominguez (3):
coda: bound the symlink target in venus_readlink()
coda: bound the pioctl output in venus_pioctl()
coda: hold vc_mutex while completing a Venus reply

fs/coda/psdev.c | 21 +++++++++++++++------
fs/coda/upcall.c | 23 +++++++++++++++++++----
2 files changed, 34 insertions(+), 10 deletions(-)


base-commit: 0fbf78feb38a18c9eb49f67ad3d3095d11c46295
--
2.53.0