[PATCH] Tests for minimal signal handler functionality in MINSIGSTKSZ space.
Richard Henderson
rth@twiddle.net
Wed Jan 16 22:41:00 GMT 2019
On 1/16/19 7:05 AM, Zack Weinberg wrote:
> +xalloc_sigstack (size_t size)
> +{
> + size_t pagesize = sysconf (_SC_PAGESIZE);
> + if (pagesize == -1)
> + FAIL_EXIT1 ("sysconf (_SC_PAGESIZE): %m\n");
> +
> + size_t stacksize = roundup (size + MINSIGSTKSZ, pagesize);
...
> + desc->alt_stack.ss_sp = desc->alloc_base + guardsize;
> + desc->alt_stack.ss_flags = 0;
> + desc->alt_stack.ss_size = stacksize;
While I understand that the actual allocation from the system must round up to
pages, why do you want to round up the amount as seen by ss_{sp,size}?
It seems to me that if you really want to test MINSIGSTKSZ, then you should do
exactly that. E.g.
desc->alt_stack.ss_size = size;
if (_STACK_GROWS_DOWN)
desc->alt_stack.ss_sp = desc->alloc_base + guardsize;
else
desc->alt_stack.ss_sp = desc->alloc_base + guardsize + stacksize - size;
r~
More information about the Libc-alpha
mailing list