mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] fs, zonefs: ignore RLIMIT_FSIZE values above LLONG_MAX
@ 2026-11-17 17:31 Ding Feng
  2026-11-17 17:31 ` [PATCH 1/2] fs: ignore RLIMIT_FSIZE above LLONG_MAX in generic_write_check_limits() Ding Feng
  2026-11-17 17:31 ` [PATCH 2/2] zonefs: ignore RLIMIT_FSIZE above LLONG_MAX in zonefs_write_check_limits() Ding Feng
  0 siblings, 2 replies; 3+ messages in thread
From: Ding Feng @ 2026-11-17 17:31 UTC (permalink / raw)
  To: viro, brauner
  Cc: jack, linux-fsdevel, linux-kernel, dlemoal, naohiro.aota, jth, Ding Feng

generic_write_check_limits() and its zonefs copy store
rlimit(RLIMIT_FSIZE), an unsigned long, in a loff_t. A soft limit
between 2^63 and RLIM_INFINITY turns negative, and every write then
fails with -EFBIG and SIGXFSZ:

  $ bash -c 'ulimit -f 9007199254740992; echo hi > /tmp/f'
  File size limit exceeded

Patch 1 fixes the VFS helper (write, pwrite, writev and copy_file_range
paths). Patch 2 applies the same fix to zonefs.

Jun-ichi Takimoto reported this in 2020 [1]; no fix followed. It came up
again while proving pwrite(2) against POSIX with Frama-C/WP.

Tested on v6.12 (arm64 tinyconfig, QEMU virt, initramfs on ramfs) with
a static test program that sets the soft RLIMIT_FSIZE, writes 2 bytes
and copies 10 bytes with copy_file_range():

  soft limit            unpatched           patched
  1024, 2^63-1          ok                  ok
  2^63, 2^63+4096,
  2^64-2                EFBIG (both)        ok (both)
  1                     short write, then EFBIG (both kernels)

Also reproduced on 6.10.14 (arm64) with write(), pwrite() and
copy_file_range() on tmpfs and overlayfs. Compile-tested for x86_64
defconfig with clang; not run on x86_64.

[1] https://lore.kernel.org/linux-fsdevel/8F9EB913-3AC3-4D89-9DA3-427029F6D211@kba.biglobe.ne.jp/

Ding Feng (2):
  fs: ignore RLIMIT_FSIZE above LLONG_MAX in
    generic_write_check_limits()
  zonefs: ignore RLIMIT_FSIZE above LLONG_MAX in
    zonefs_write_check_limits()

 fs/read_write.c  | 9 +++++----
 fs/zonefs/file.c | 9 +++++----
 2 files changed, 10 insertions(+), 8 deletions(-)

-- 
2.55.0


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

end of thread, other threads:[~2026-11-17 17:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 17:31 [PATCH 0/2] fs, zonefs: ignore RLIMIT_FSIZE values above LLONG_MAX Ding Feng
2026-11-17 17:31 ` [PATCH 1/2] fs: ignore RLIMIT_FSIZE above LLONG_MAX in generic_write_check_limits() Ding Feng
2026-11-17 17:31 ` [PATCH 2/2] zonefs: ignore RLIMIT_FSIZE above LLONG_MAX in zonefs_write_check_limits() Ding Feng

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®