mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/3] coda: check and serialize Venus replies
@ 2026-12-05 23:31 Mar Dominguez
  2026-12-05 23:33 ` [PATCH v2 1/3] coda: bound the symlink target in venus_readlink() Mar Dominguez
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mar Dominguez @ 2026-12-05 23:31 UTC (permalink / raw)
  To: Jan Harkes, coda, codalist, Christian Brauner, Alexander Viro,
	linux-fsdevel, linux-kernel

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@talkjune.com/

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



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

end of thread, other threads:[~2026-12-05 23:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-05 23:31 [PATCH v2 0/3] coda: check and serialize Venus replies Mar Dominguez
2026-12-05 23:33 ` [PATCH v2 1/3] coda: bound the symlink target in venus_readlink() Mar Dominguez
2026-12-05 23:36 ` [PATCH v2 2/3] coda: bound the pioctl output in venus_pioctl() Mar Dominguez
2026-12-05 23:39 ` [PATCH v2 3/3] coda: hold vc_mutex while completing a Venus reply Mar Dominguez

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®