bug-libsigsegv
[Top][All Lists]
Advanced

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

[bug-libsigsegv] Re: sigsegv on s390 only giving start address of page i


From: Bruno Haible
Subject: [bug-libsigsegv] Re: sigsegv on s390 only giving start address of page in segv handler
Date: Sun, 13 Mar 2011 19:00:00 +0100
User-agent: KMail/1.9.9

[Adding clisp-devel in CC. I'm adding S390 support to libsigsegv, but it
apparently needs a minor tweak so that clisp can really exploit it for
generational GC on S390.]

Christoph Egger wrote:
> > Find in
> >   http://www.haible.de/bruno/gnu/libsigsegv-2.10-pre1.tar.gz
> > a new prerelease. Can you please test how it works on a Linux/S390 system,
> > and whether clisp then builds and runs fine?
> 
> libsigsegv completes flawlessly:
> 
> ==================
> All 5 tests passed
> ==================
> ...
> libsigsegv: s390x-ibm-linux2.6.26-gnu-glibc2.11 | yes | yes | 2.10-pre1

Cool! I'm adding this to libsigsegv/PORTING.

> However clisp is unhappy
> 
> ./lisp.run -B . -N locale -E UTF-8 -Epathname 1:1 -Emisc 1:1 -norc -m 2MW -lp 
>  -x '(and (load "init.lisp") (sys::%saveinitmem) (ext::exit)) (ext::exit t)'
>   i i i i i i i       ooooo    o        ooooooo   ooooo   ooooo
>   I I I I I I I      8     8   8           8     8     o  8    8
>   I  \ `+' /  I      8         8           8     8        8    8
>    \  `-+-'  /       8         8           8      ooooo   8oooo
>     `-__|__-'        8         8           8           8  8
>         |            8     o   8           8     o     8  8
>   ------+------       ooooo    8oooooo  ooo8ooo   ooooo   8
> 
> Welcome to GNU CLISP 2.49 (2010-07-07) <http://clisp.cons.org/>
> 
> Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
> Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
> Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
> Copyright (c) Bruno Haible, Sam Steingold 1999-2000
> Copyright (c) Sam Steingold, Bruno Haible 2001-2010
> 
> Type :h and hit Enter for context help.
> 
> ;; Loading file defseq.lisp ...
> ;; Loaded file defseq.lisp
> ;; Loading file backquote.lisp ...
> ;; Loaded file backquote.lisp
> ;; Loading file defmacro.lisp ...
> ;; Loaded file defmacro.lisp
> ;; Loading file macros1.lisp ...
> ;; Loaded file macros1.lisp
> ;; Loading file macros2.lisp ...
> ;; Loaded file macros2.lisp
> ;; Loading file defs1.lisp ...
> *** - handle_fault error2 ! address = 0x66791000 not in 
> [0x667914e8,0x667ce000) !
> SIGSEGV cannot be cured. Fault address = 0x66791000.
> GC count: 3
> Space collected by GC: 0 616176
> Run time: 0 315538
> Real time: 1 427288
> GC time: 0 5295
> Permanently allocated: 90464 bytes.
> Currently in use: 438404 bytes.
> Free space: 518252 bytes.
> make: *** [interpreted.mem] Segmentation fault

Can you please try this patch?

Bruno


diff -r 69cbad2fb9bd src/lispbibl.d
--- a/src/lispbibl.d    Tue Mar 08 19:07:07 2011 -0500
+++ b/src/lispbibl.d    Sun Mar 13 18:55:35 2011 +0100
@@ -3003,7 +3003,7 @@
 
 
 /* Flavor of the garbage collection: normal or generational. */
-#if defined(VIRTUAL_MEMORY) && (defined(SINGLEMAP_MEMORY) || 
defined(TRIVIALMAP_MEMORY)) && defined(HAVE_WORKING_MPROTECT) && 
defined(HAVE_SIGSEGV_RECOVERY) && !defined(UNIX_IRIX) && 
!defined(WIDE_SOFT_LARGEFIXNUM) && (SAFETY < 3) && !defined(NO_GENERATIONAL_GC)
+#if defined(VIRTUAL_MEMORY) && (defined(SINGLEMAP_MEMORY) || 
defined(TRIVIALMAP_MEMORY)) && defined(HAVE_WORKING_MPROTECT) && 
defined(HAVE_SIGSEGV_RECOVERY) && (defined(SINGLEMAP_MEMORY) || 
SIGSEGV_FAULT_ADDRESS_ALIGNMENT <= 1UL) && !defined(UNIX_IRIX) && 
!defined(WIDE_SOFT_LARGEFIXNUM) && (SAFETY < 3) && !defined(NO_GENERATIONAL_GC)
   /* "generational garbage collection" has some requirements.
    With Linux, it will only work with 1.1.52, and higher, which will be 
checked in makemake.
    On IRIX 6, it worked in the past, but leads to core dumps now. Reason 
unknown. FIXME! */
diff -r 69cbad2fb9bd src/spvw_fault.d
--- a/src/spvw_fault.d  Tue Mar 08 19:07:07 2011 -0500
+++ b/src/spvw_fault.d  Sun Mar 13 18:55:35 2011 +0100
@@ -125,17 +125,27 @@
   var aint pa_address = address & -physpagesize; /* page aligned address */
   #ifdef SPVW_PURE_BLOCKS
   heapnr = typecode(obj);
-  #elif defined(SPVW_MIXED_BLOCKS_STAGGERED)
-  heapnr = (address >= mem.heaps[1].heap_mgen_start ? 1 : 0);
-  #else  /* SPVW_MIXED_BLOCKS_OPPOSITE */
-  heapnr = (address >= mem.heaps[1].heap_start ? 1 : 0);
+  #else
+   #if defined(GENERATIONAL_GC) && defined(SIGSEGV_FAULT_ADDRESS_ALIGNMENT)
+   /* Compile-time check: SIGSEGV_FAULT_ADDRESS_ALIGNMENT is 1.
+      Otherwise the address argument is not the exact fault address, but the
+      address rounded down to page alignment, and the comparisons below may
+      yield a wrong heapnr. */
+   typedef int sigsegv_fault_address_alignment_check[2 * 
(SIGSEGV_FAULT_ADDRESS_ALIGNMENT == 1UL) - 1];
+   #endif
+   #if defined(SPVW_MIXED_BLOCKS_STAGGERED)
+   heapnr = (address >= mem.heaps[1].heap_mgen_start ? 1 : 0);
+   #else  /* SPVW_MIXED_BLOCKS_OPPOSITE */
+   heapnr = (address >= mem.heaps[1].heap_start ? 1 : 0);
+   #endif
   #endif
   {
     #ifdef GENERATIONAL_GC
     var Heap* heap = &mem.heaps[heapnr];
     if (!is_heap_containing_objects(heapnr))
       goto error1;
-    if (!((heap->heap_gen0_start <= address) && (address < 
heap->heap_gen0_end)))
+    if (!((heap->heap_gen0_start & ~(SIGSEGV_FAULT_ADDRESS_ALIGNMENT-1) <= 
address)
+          && (address < heap->heap_gen0_end)))
       goto error2;
     if (heap->physpages == NULL)
       goto error5;

-- 
In memoriam Odette Sansom <http://en.wikipedia.org/wiki/Odette_Hallowes>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]