summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/prlimit.c
AgeCommit message (Collapse)Author
2023-11-10prlimit: add name redirection and fix incorrect parameters to syscallPavel Kozlov
The tst-rlimit/tst-rlimit64 tests pointed to several issueses in prlimit() function for 32-bit CPUs. This patch adds name redirection to prlimit64 in prlimit declaration to provide correct support for 64-bit offset (_FILE_OFFSET_BITS=64) on 32-bit CPUs and fixes improper field assignment and incorrect syscall paramerets in the prlimit() function. Fixes: 8c2f6218 ("setrlimit/getrlimit: fix prlimit64 syscall use for 32-bit CPUs") Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
2023-10-27setrlimit/getrlimit: fix prlimit64 syscall use for 32-bit CPUsPavel Kozlov
Commit 95e38b37 ("add support for systems without legacy setrlimit/getrlimit syscalls") has added use of the prlimit64 syscall in getrlimit and setrlimit functions. This change causes memory corruption on getrlimit call for 32-bit CPUs like ARC, as ARC doesn't have ugetrlimit syscall and uses prlimit64. Also, setrlimit has been broken by prlimit64 call on 32-bit CPUs like, i386, ARM, ARC. For the prlimit64 syscall the kernel expects an rlimit struct with 64-bit fields, but on 32-bit CPUs without _FILE_OFFSET_BITS=64 the struct rlimit has 32-bit fields. Add safe implementations of getrlimit, setrlimit, prlimit for 32-bit CPUs with a local struct rlimit64 variable for use in the prlimit64 syscall. For 64-bit CPUs and configurations with _FILE_OFFSET_BITS=64 use getrlimit, setrlimit, prlimit as aliases to getrlimit64, setrlimit64 and prlimit64. Add a new function prlimit64. Tested on aarch64, arm, i386, arc. Fixes: 95e38b37 ("add support for systems without legacy setrlimit/getrlimit syscalls") Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
2022-02-27guard prlimit, reported by Lance FredricksonWaldemar Brodkorb
2022-01-21add prlimit syscall wrapper, now for realWaldemar Brodkorb