[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#221969: libc6.1 2.3.2.ds1-10 & 2.3.2-9 causes Segmentation fault in Java JDK1.3.1 programs on Alpha



GOTO Masanori writes:

> Hmm, could you make a sample program to regenerate this problem if you
> can?  Java's signal handling is sometimes complicated to track the
> problem...

> Regards,
> -- gotom

Here is a program:

=============================================================================
#include <string.h>
#include <stdio.h>
#include <signal.h>
#include <sys/mman.h>

#define PAGESIZE 8192

char b1[PAGESIZE*4],*b;

void
sigh(int s,siginfo_t *i,void *v) {

  printf("Caught signal\n");
  if (i->si_addr!=b) 
    fprintf(stderr,"Address mismatch\n");
  mprotect(i->si_addr,PAGESIZE,PROT_READ|PROT_WRITE);


}

int
main() {

  struct sigaction sa;

  memset(&sa,0,sizeof(sa));
  sa.sa_sigaction=sigh;
  sa.sa_flags=SA_RESTART|SA_SIGINFO;

  if (sigaction(SIGSEGV,&sa,NULL)) {
    fprintf(stderr,"Cannot setup signal handler\n");
    return -1;
  }
    
  b=(char *)((unsigned long)(b1+PAGESIZE-1) & ~(PAGESIZE-1));
  if (mprotect(b,PAGESIZE,PROT_READ)) {
    fprintf(stderr,"Cannot mprotect\n");
    return -1;
  }

  *b=0;
  
  printf("Returning from handler\n");

  return 0;

}
=============================================================================
Execution on i386 and other Debian:

$~/ss
Caught signal
Returning from handler
$ echo $?
0
$ strace -f ~/ss
execve("/home/camm/ss", ["/home/camm/ss"], [/* 34 vars */]) = 0
uname({sys="Linux", node="intech66", ...}) = 0
brk(0)                                  = 0x8051860
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=22431, ...}) = 0
old_mmap(NULL, 22431, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40018000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200^\1"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=1244004, ...}) = 0
old_mmap(NULL, 1254244, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4001e000
old_mmap(0x40146000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x127000) = 0x40146000
old_mmap(0x4014e000, 9060, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4014e000
close(3)                                = 0
munmap(0x40018000, 22431)               = 0
rt_sigaction(SIGSEGV, {0x80484f0, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x400474a0}, NULL, 8) = 0
mprotect(0x804a000, 8192, PROT_READ)    = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(3, 7), ...}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon -echo ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40018000
write(1, "Caught signal\n", 14Caught signal
)         = 14
mprotect(0x804a000, 8192, PROT_READ|PROT_WRITE) = 0
rt_sigreturn(0x4014d630)                = 134520832
write(1, "Returning from handler\n", 23Returning from handler
) = 23
munmap(0x40018000, 4096)                = 0
exit_group(0)                           = ?

=============================================================================
Execution on alpha (escher unstable dchroot):

camm@escher:~$ ./ss
Caught signal
camm@escher:~$ echo $?
224
camm@escher:~$ strace -f ./ss
execve("./ss", ["./ss"], [/* 14 vars */]) = 0
uname({sys="Linux", node="escher", ...}) = 0
brk(0)                                  = 0x120018ec0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20000018000
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=49219, ...}) = 0
mmap(NULL, 49219, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2000002a000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6.1", O_RDONLY)      = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0&\220\1\0\0\0p\216\2"..., 640) = 640
fstat(3, {st_mode=S_IFREG|0644, st_size=1585216, ...}) = 0
mmap(NULL, 1658736, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x20000038000
mprotect(0x2000019e000, 192368, PROT_NONE) = 0
mmap(0x200001a8000, 139264, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0x160000) = 0x200001a8000
mmap(0x200001ca000, 12144, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x200001ca000
close(3)                                = 0
munmap(0x2000002a000, 49219)            = 0
rt_sigaction(SIGSEGV, {0x1200006a0, [], SA_RESTART|SA_SIGINFO}, NULL, 8, 0xffffffffffffffff) = 0
mprotect(0x120012000, 8192, PROT_READ)  = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2000001a000
write(1, "Caught signal\n", 14Caught signal
)         = 14
mprotect(0x120012000, 8192, PROT_READ|PROT_WRITE) = 0
osf_syscall(0x12001cc20, 0x2000, 0x3, 0, 0xffffffffffffffff, 0) = -78
munmap(0x2000001a000, 8192)             = 0
exit_group(2199025127240)               = ?
camm@escher:~$ 

=============================================================================

Problem appears to be in osf_syscall on return from the handler.

PLEASE let me know when you think a fix might be at hand, as this is
keeping several of my packages out of testing.

Take care,

-- 
Camm Maguire			     			camm@enhanced.com
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah



Reply to: