mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
sigaltstack: enforce dynamic MINSIGSTKSZ limit
commit 996b6154b2
added support for
querying the dynamic limit but did not enforce it in sigaltstack. the
kernel also does not seem to reliably enforce it, or at least does not
necessarily enforce the same limit exposed to userspace, so it needs
to be enforced here.
This commit is contained in:
parent
572a2e2eb9
commit
300a1f5390
1 changed files with 3 additions and 1 deletions
|
@ -1,11 +1,13 @@
|
|||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include "syscall.h"
|
||||
|
||||
int sigaltstack(const stack_t *restrict ss, stack_t *restrict old)
|
||||
{
|
||||
if (ss) {
|
||||
if (!(ss->ss_flags & SS_DISABLE) && ss->ss_size < MINSIGSTKSZ) {
|
||||
size_t min = sysconf(_SC_MINSIGSTKSZ);
|
||||
if (!(ss->ss_flags & SS_DISABLE) && ss->ss_size < min) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue