This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/16850] New: [aarch64] MINSIGSTKSZ is (much) too small


https://sourceware.org/bugzilla/show_bug.cgi?id=16850

            Bug ID: 16850
           Summary: [aarch64] MINSIGSTKSZ is (much) too small
           Product: glibc
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: michael.hudson at linaro dot org
                CC: drepper.fsp at gmail dot com

MINSIGSTKSZ is only 2048 but when you as SA_SIGINFO, the kernel pushes (IIRC)
4704 bytes onto the stack.  Which is more than 2048:

ubuntu@ms01a:~/mwhudson$ cat u.c 
#include <string.h>
#include <stdlib.h>
#include <signal.h>
#include <stdio.h>

char* buf;

void handler(int signo, siginfo_t *info, void *context)
{
//    char i;
//    printf("hi %p %ld\n", &i, &i - buf);
    return;
}

int main (int argc, char** argv)
{
    stack_t ss;
    int i;
    struct sigaction sa;

    buf = malloc(5*MINSIGSTKSZ);
    if (!buf) abort();

    memset(buf, 0, 5*MINSIGSTKSZ);

    ss.ss_sp = buf + 2*MINSIGSTKSZ;
    ss.ss_size = MINSIGSTKSZ;
    ss.ss_flags = 0;
    if (sigaltstack(&ss, NULL) == -1)
        abort();

    sa.sa_sigaction = handler;
    sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
    sigemptyset(&sa.sa_mask);
    sigaction(SIGHUP, &sa, NULL);

    kill(getpid(), SIGHUP);

    for (i = 0; i < 2*MINSIGSTKSZ; i++) {
        if (buf[i]) printf("%d\n", i);    
    }

    for (i = 3*MINSIGSTKSZ; i < 5*MINSIGSTKSZ; i++) {
        if (buf[i]) printf("%d\n", i);    
    }

}
ubuntu@ms01a:~/mwhudson$ gcc u.c -o u && ./u
1416
1417
1418
1419
1424
1425
1426
....

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]