public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/16850] New: [aarch64] MINSIGSTKSZ is (much) too small
@ 2014-04-17  8:56 michael.hudson at linaro dot org
  2014-04-23 20:06 ` [Bug libc/16850] " michael.hudson at linaro dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: michael.hudson at linaro dot org @ 2014-04-17  8:56 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-04-02 10:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17  8:56 [Bug libc/16850] New: [aarch64] MINSIGSTKSZ is (much) too small michael.hudson at linaro dot org
2014-04-23 20:06 ` [Bug libc/16850] " michael.hudson at linaro dot org
2014-06-12 19:41 ` fweimer at redhat dot com
2014-06-26 13:50 ` fweimer at redhat dot com
2014-09-27 12:53 ` schwab@linux-m68k.org
2014-09-27 14:41 ` schwab@linux-m68k.org
2014-09-28 11:47 ` schwab@linux-m68k.org
2014-11-05 10:54 ` schwab@linux-m68k.org
2014-11-05 10:57 ` marcus.shawcroft at gmail dot com
2014-11-10 11:25 ` renlin.li at arm dot com
2014-11-10 11:49 ` fweimer at redhat dot com
2015-04-02 10:19 ` cvs-commit at gcc dot gnu.org
2015-04-02 10:23 ` schwab@linux-m68k.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).