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, 3 Apr 2011 14:43:29 +0200
User-agent: KMail/1.9.9

Hi Christoph,

On 2011-03-13, you reported that with the Linux/S390 specific modifications
to libsigsegv clisp did not yet work correctly. I proposed a patch that ought
to fix this:
<http://lists.gnu.org/archive/html/bug-libsigsegv/2011-03/msg00007.html>

Did you have time to test this patch? I would not want to commit into clisp
a patch that is not tested, and I don't want to release libsigsegv 2.10
before it has been asserted that it works fine in clisp.

For convenience, here's the proposed patch again.

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 Albert Merz <http://en.wikipedia.org/wiki/Albert_Merz>



reply via email to

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