diff options
| author | Stian Halseth <stian@itx.no> | 2026-09-17 17:16:13 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-10-22 18:48:37 +0200 |
| commit | 829f27a9805bd28028dc73df836e966629700adc (patch) | |
| tree | 9079ce7841e811b9f891a0b2922f6573e6d5427a /tools/lib/python | |
| parent | 60e23b13980bbc950655ba3f0e819180aa82a8aa (diff) | |
fs: fix llseek() result for files with unsigned offsets
sys_llseek() treats a negative result from vfs_llseek() as an error and
returns it truncated to int instead of storing it in *result. For a
file with FOP_UNSIGNED_OFFSET a valid offset can have the top bit set,
so the seek succeeds but userspace gets a bogus return value and an
untouched result buffer. ksys_lseek() has no such check and returns
the offset as is.
Store the offset when the file has unsigned offsets too, still treating
a value in the errno range as an error so a real failure from
->llseek() is reported.
On sparc64, where userspace is mapped above 2^63 and glibc's lseek()
uses _llseek, this makes lseek() on /proc/PID/mem return the offset it
seeked to instead of its low 32 bits.
Signed-off-by: Stian Halseth <stian@itx.no>
Link: https://patch.msgid.link/20260917151614.376867-2-stian@itx.no
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
