View Issue Details

IDProjectCategoryView StatusLast Update
0000547LDMud 3.3Portabilitypublic2008-07-02 15:35
Reporterzesstra Assigned To 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionno change required 
Platformx86_64OSMacOS XOS Version10.5.x
Product Version3.3.716 
Summary0000547: possible crash upon (first) memory allocation (x86_64)
DescriptionA binary compiled for x86_64 on MacOS 10.5.3 crashes while allocating the first chunk of memory with
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000001008c6104

Stacktrace:
(gdb) bt full
#0 0x0000000100115150 in add_large_free (ptr=0x100846004, block_size=65568) at slaballoc.c:3031
No locals.
0000001 0x00000001001155a3 in large_malloc (size=2960, force_more=0) at slaballoc.c:3289
    chunk_size = 262272
    block_size = 65568
    extra = 0
    real_size = 8
    ptr = (word_t *) 0x100846004
    orig_size = 11828
0000002 0x0000000100112ca1 in mem_alloc (size=64) at slaballoc.c:1717
    numObjects = 184
    slabSize = 11828
    slab = (mslab_t *) 0x0
    block = (word_t *) 0x0
    ix = 7
0000003 0x00000001001172ce in xalloc_traced (size=56, malloc_trace_file=0x1001281eb "main.c", malloc_trace_line=404) at xalloc.c:540
    p = (word_t *) 0x10012a7aa
0000004 0x00000001000905f0 in main (argc=2, argv=0x7fff5fbff858) at main.c:404
    buf = "__DEBUG_LOG__=\"/phoenix.debug.log\"", '\0' <repeats 261 times>
    name = 0x7fff5fbff3f0 "phoenix.debug.log\""
    tmp = (struct lpc_predef_s *) 0x0
    i = 246
    p = 0x7fff5fbff7f4 "\366"
    set = 8192
    rc = 0

add_large_free() tries to join neighbouring free blocks and the first thing is:
    /* If the next block is free, coagulate */
    if (!(*(ptr+block_size) & THIS_BLOCK))
    {
        remove_from_free_list(ptr+block_size);
        block_size += (ptr+block_size)[M_LSIZE];
    }

(gdb) print ptr+block_size
$2 = (word_t *) 0x1008c6104
(gdb) print *(ptr+block_size)
Cannot access memory at address 0x1008c6104

There is no memory mapped at 0x1008c6104 (see below the relevant part of the process address space) as the allocated block is the first allocated block.
MALLOC_LARGE 0000000100846000-0000000100847000 [ 4K] rw-/rwx SM=COW
MALLOC_LARGE 0000000100847000-0000000100887000 [ 256K] rw-/rwx SM=ZER
MALLOC_TINY 0000000100900000-0000000100901000 [ 4K] rw-/rwx SM=COW
TagsNo tags attached.

Activities

zesstra

2008-07-02 15:35

administrator   ~0000664

Ok, after some discussion with Gnomi and searching through stuff, the problem is caused by wrong values for SIZEOF_CHAR_P and SIZEOF_LONG in machine.h and therefore some configure problem. Was then solved by the right target and host options for configure... (Why did that work a few weeks ago with the old configure script...?)

Issue History

Date Modified Username Field Change
2008-07-02 13:42 zesstra New Issue
2008-07-02 15:35 zesstra Note Added: 0000664
2008-07-02 15:35 zesstra Status new => resolved
2008-07-02 15:35 zesstra Resolution open => no change required
2008-07-02 15:35 zesstra Category Implementation => Portability