faultive address reported on SIGSEGV was simply junk
Stefan van der Eijk <[email protected]> Sat, 05 Jun 2004 15:04:15 +0200
| Newsgroups | gmane.linux.aurora.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
A while back I had the 2.6 kernel running on my Mandrake sparc box, see:
http://archives.mandrakelinux.com/cooker/2004-02/msg00092.php
Mandrake's glibc maintainer (Gwenole Beauchesne) took a look at it and
had the following to say:
http://archives.mandrakelinux.com/cooker/2004-02/msg00298.php
====
On Sun, 1 Feb 2004, Thomas Backlund wrote:
> Now for the next step...
> I'll log into the buildhost to get the latest changes to the kernels,
> and will add them to my 2.4 series as well....
Does it work correctly now wrt. signal handlers? Last time I checked on
Stefan's machine, the faultive address reported on SIGSEGV was simply
junk.
> Gwenole,
> as you seems to be the maintainer of dietlibc-devel,
> would it be possible to update it to 0.24 ?
It is, but I don't think I will update stage1 dietlibc as it works, unless
gcc wants it to be updated too.
> It has many fixes for the sparc/sparc64 branch...,
> and many other interesting fixes...
All interesting AMD64 fixes are already in our dietlibc. ;-)
Bye,
Gwenole.
====
I'm wondering if this also takes place on aurora with the 2.6 kernel. And how it's been fixed.
The following peice of code can be used to test it:
====
#include <stdio.h>
#include <signal.h>
#include <errno.h>
#include <unistd.h>
#include <sys/mman.h>
#include <stdlib.h>
static volatile char *page;
static void sigsegv_handler(int sig, siginfo_t *sip, void *scp)
{
printf("Caught SIGSEGV to %08x\n", sip->si_addr);
if (sip->si_addr != page)
abort();
exit(0);
}
int main(void)
{
struct sigaction sigsegv_sa;
sigemptyset(&sigsegv_sa.sa_mask);
sigsegv_sa.sa_sigaction = sigsegv_handler;
sigsegv_sa.sa_flags = SA_SIGINFO;
if (sigaction(SIGSEGV, &sigsegv_sa, 0) < 0) {
perror("sigaction");
return 1;
}
{
int page_size = getpagesize();
volatile unsigned char *p = (volatile unsigned char *)mmap(0,
page_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
if (p == MAP_FAILED) {
perror("mmap");
return 2;
}
if (mprotect(p, page_size, PROT_READ) < 0) {
perror("mprotect");
return 3;
}
printf("p = %p\n", p);
page = p;
*p = 0;
munmap(p, page_size);
}
return 0;
}
====
On i586 I saw this behaviour:
./test.i586
p = 0x40018000
Caught SIGSEGV to 40018000
While on sparc this:
./test.sparc32
p = 0x70018000
Caught SIGSEGV to 70018377
Aborted
regards,
Stefan
_______________________________________________
Aurora-sparc-devel mailing list
[email protected]
http://lists.auroralinux.org/mailman/listinfo/aurora-sparc-devel
Aurora FAQ: http://www.ecs.soton.ac.uk/~mas01r/aurorafaq.html
smime.p7s
(application/x-pkcs7-signature, 3.3 KB) - not displayed