Skip to content

fs: two mount API fixes

fujo linux-fsdevel lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2fs: statmount: don't copy strings past the caller's bufferfs/namespace.c+12 -20 replies
2/2fs: reject U64_MAX cursors in listmount() and listns()fs/namespace.c kernel/nstree.c+10 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] fs: two mount API fixes

Two mount API edge cases reported by shaos, both reproduced on 7.3.0-rc7 (58161ead2) with a small syscall probe run as /init under QEMU with KASAN:

- statmount(2) with STATMOUNT_MNT_UIDMAP on a mount that is not idmapped and a short buffer copied the reserved empty string at offset 512, one byte past the declared bufsize, and returned success.

- listmount(2) and listns(2) with a U64_MAX cursor wrapped around to zero and restarted the enumeration at the first entry.

Probe output before:

  uidmap buf=100  ret=0   size=101 byte512=0
  lm cursor=MAX   ret=1   id0=2147483651
  ln cursor=MAX   ret=8   id0=1 id1=2

after:

  uidmap buf=100  ret=-75 (EOVERFLOW) byte512=170
  lm cursor=MAX   ret=-22 (EINVAL)
  ln cursor=MAX   ret=-22 (EINVAL)

The in-tree statmount_test (17/17), statmount_test_ns (2/2) and listmount_test (2/2) pass with both patches applied.

Thanks,
fujo