gcl-devel
[Top][All Lists]
Advanced

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

Re: [Gcl-devel] mac os x port questions


From: Camm Maguire
Subject: Re: [Gcl-devel] mac os x port questions
Date: 15 Feb 2004 02:40:08 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!

Aurelien Chanudet <address@hidden> writes:

> Hi all,
> 
> Below is what I get with 2.7.0 on Mac OS X v10.3 (a.k.a. Panther).
> 
> What's happening is that `page(core_end)' refers to some place beyond
> the end of `sgc_type_map', which causes a segmentation fault. On top
> of that, we have that MAXPAGE- page(core_end) < 0, although this
> should be >= 0.
> 
> I would be most grateful if someone could tell me more about
> `MAXPAGE', `core_end' and `sgc_type_map'. My understanding is that
> `core_end' holds the value of the so-called memory breakpoint.
> 
> In the example below, the memory layout is as follow :
> - the text segment ranges from 0x00001000 to 0x0010e000
> - the data segment ranges from 0x0010e000 to 0x0054c000
> - the link edit segment ranges from 0x0054c000 to 0x0077e000
> 
> All memory allocation happens in a hand-crafted heap ranging from
> 0x209f6000 to 0x409f6000. I don't know what we have between the end of
> the link edit segment and the start of the hand-crafted heap.
> 

Wow, this looks really strange -- can't see how these numbers could
have ever worked.  Could something major have changed, e.g. an
execstack kernel or a propolice gcc?  These items have to be turned
off at present.

Your heap should range from DBEGIN to DBEGIN + MAXPAGE*PAGESIZE.
Usually the first sbrk returns an address somewhat above DBEGIN,
wasting the first few pages of this range, but this is not critical.
But the 'hand crafted heap' of your report begins beyond the end of
this range (!)  --- 0x2010e000 should be the end.

I'd break at the first sbrk, in gcl_init_alloc, macro INIT_ALLOC, and
see what addresses are being returned (heap_end, core_end, 'p
sbrk(0)', etc.)  Compare this with the DBEGIN found in configure.  You
have all the symptoms of a 'randomized sbrk', i.e. a breakage of the
brk/sbrk specification in the name of securuty where some address at a
random gap above the data segment end is returned by the first sbrk in
a program, instead of an address precisely contiguous with the end of
the data segment as its always been.  Fedora has just put in a kernel
doing this by default which has broken all the lisps.  To my
knowledge, we still work there, albeit by disabling this feature by
adding the compile flags -Wa,--execstack.

Don't know what a link edit segment is.  I take it this is a new
revision of the OS.  Would be nice to compare with the old working one
if so.

In principle, if you could just get the configure determined DBEGIN to
return 0x209f6000, you should be fine.  See if the 'hand crafted heap'
range varies from run to run.  If not, you can just define DBEGIN in
config.h at first.

Take care,

> Thanks,
> Aurelien
> 
> ---
> 
> Starting program: /src/src/gcl-2.7.0/unixport/raw_pre_gcl
> /src/src/gcl-2.7.0/unixport/ -libdir /src/src/gcl-2.7.0/ < foo
> 
> Breakpoint 1, set_maxpage () at alloc.c:707
> 707       page_multiple=getpagesize()/PAGESIZE;
> (gdb) c
> Continuing.
> 
> Breakpoint 1, set_maxpage () at alloc.c:707
> 707       page_multiple=getpagesize()/PAGESIZE;
> (gdb) c
> Continuing.
> 
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> 0xffff8660 in __bzero ()
> (gdb) up
> #1  0x0001b6d8 in set_maxpage () at alloc.c:719
> 719         bzero(&sgc_type_map[ page(core_end)],MAXPAGE-
> page(core_end));
> (gdb) p c
> $7 = 131072 [ this is the value of MAXPAGE ]
> (gdb) p d
> $8 = 154322 [ this is the value of page(core_end) ]
> (gdb) p core_end
> $9 = 0x25be0000 ""
> (gdb) p &sgc_type_map
> $10 = (char (*)[131072]) 0x481250
> (gdb) p sgc_type_map+131072
> $11 = 0x4a1250 ""
> 
> 
> 
> 
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel
> 
> 
> 

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




reply via email to

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