summaryrefslogtreecommitdiff
path: root/include/langinfo.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-12-09 23:28:47 -0500
committerRich Felker <dalias@aerifal.cx>2018-12-09 23:28:47 -0500
commit1a6d6f131bd60ec2a858b34100049f0c042089f2 (patch)
tree8679fe1f7b739abe7309911bc467be620e66c15f /include/langinfo.h
parent26c66c485c04fa782b8c6f7450bf008f4457b5a8 (diff)
downloadmusl-1a6d6f131bd60ec2a858b34100049f0c042089f2.tar.gz
musl-1a6d6f131bd60ec2a858b34100049f0c042089f2.tar.bz2
musl-1a6d6f131bd60ec2a858b34100049f0c042089f2.tar.xz
musl-1a6d6f131bd60ec2a858b34100049f0c042089f2.zip
fix and future-proof against stack overflow in aio io threads
aio threads not using SIGEV_THREAD notification are created with small stacks and no guard page, which is possible since they only run the code for the requested io operation, not any application code. the motivation is not creating a lot of VMAs. however, the io thread needs to be able to receive a cancellation signal in case aio_cancel (implemented via pthread_cancel) is called. this requires sufficient stack space for a signal frame, which PTHREAD_STACK_MIN does not necessarily include. in principle MINSIGSTKSZ from signal.h should give us sufficient space for a signal frame, but the value is incorrect on some existing archs due to kernel addition of new vector register support without consideration for impact on ABI. some powerpc models exceed MINSIGSTKSZ by about 0.5k, and x86[_64] with AVX-512 can exceed it by up to about 1.5k. so use MINSIGSTKSZ+2048 to allow for the discrepancy plus some working space. unfortunately, it's possible that signal frame sizes could continue to grow, and some archs (aarch64) explicitly specify that they may. passing of a runtime value for MINSIGSTKSZ via AT_MINSIGSTKSZ in the aux vector was added to aarch64 linux, and presumably other archs will use this mechanism to report if they further increase the signal frame size. when AT_MINSIGSTKSZ is present, assume it's correct, so that we only need a small amount of working space in addition to it; in this case just add 512.
Diffstat (limited to 'include/langinfo.h')
0 files changed, 0 insertions, 0 deletions