about summary refs log tree commit diff
path: root/src/stdio/sprintf.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-01-12 18:16:32 -0500
committerRich Felker <dalias@aerifal.cx>2015-01-12 18:16:32 -0500
commit84b5c5479e8eae48c81295b55f4fa8dd342c97a9 (patch)
tree49832516b23511fd95f0aa034f3f5b693620ed0e /src/stdio/sprintf.c
parent9772eadba8f8b32a1744c4df5048d70c567f6082 (diff)
downloadmusl-84b5c5479e8eae48c81295b55f4fa8dd342c97a9.tar.gz
musl-84b5c5479e8eae48c81295b55f4fa8dd342c97a9.tar.xz
musl-84b5c5479e8eae48c81295b55f4fa8dd342c97a9.zip
remove rlimit hacks from multi-threaded set*id() code
the code being removed was introduced to work around "partial failure"
of multi-threaded set*id() operations, where some threads would
succeed in changing their ids but an RLIMIT_NPROC setting would
prevent the rest from succeeding, leaving the process in an
inconsistent and dangerous state. however, the workaround code did not
handle important usage cases like swapping real and effective uids
then restoring their original values, and the wrongful kernel
enforcement of RLIMIT_NPROC at setuid time was removed in Linux 3.1,
making the workaround obsolete.

since the partial failure still is dangerous on old kernels, and could
in principle happen on post-fix kernels as well if set*id() syscalls
fail for another spurious reason such as resource-related failures,
new code is added to detect and forcibly kill the process if/when such
a situation arises. future documentation releases should be updated to
reflect that setting RLIMIT_NPROC to RLIM_INFINITY is necessary to
avoid this forced-kill on old kernels. ideally, at some point the
kernel will get proper multi-threaded set*id() syscalls capable of
performing their actions atomically, and all of the userspace code to
emulate them can be treated as a fallback for outdated kernels.
Diffstat (limited to 'src/stdio/sprintf.c')
0 files changed, 0 insertions, 0 deletions