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

sbrk/unexec bug



Greetings!  GCL supports several end user applications, allocating user
data via sbrk() when building and dumping a final executable via
unexec() (aka emacs) at the end.  This process is working on hurd up to
a point, but shows the following bug, blocking a build of acl2.

==================================================================
Each program instance probes brk on startup, allocates some memory in
the .data space, and dumps an executable via unexec() for the next
instance.  Each instance has one more .data section than the previous
one, and a .bss section starting at a higher offset.  When .bss
reaches about 0x12000000, the startup probe fails, even though in the
previous image which brk()ed to this value, the maximum successful
brk() address returned by the probe was in excess of 0x80000000.  Here
are the relevant rpctrace outputs of the last successful image, and
the first failing one.

task50(pid13693)-> 2024 (260464640 12337152 0 7) = 0 
task50(pid13693)-> 2021 (272801792 951046144 0) = 0 272801792
task50(pid13693)-> 2021 (1223847936 536870912 0) = 0 1223847936
task50(pid13693)-> 2021 (1760718848 268435456 0) = 0 1760718848
task50(pid13693)-> 2021 (2029154304 134217728 0) = 0 2029154304
task50(pid13693)-> 2021 (-2131595264 67108864 0) = 0 -2131595264
task50(pid13693)-> 2021 (-2064486400 33554432 0) = 0 -2064486400
task50(pid13693)-> 2021 (-2030931968 16777216 0) = 0 -2030931968
task50(pid13693)-> 2021 (-2014154752 4194304 0) = 0 -2014154752
task50(pid13693)-> 2021 (-2009960448 1048576 0) = 0 -2009960448
task50(pid13693)-> 2021 (-2008911872 8192 0) = 0 -2008911872
task50(pid13693)-> 2023 (260464640 2025598976) = 0 

task50(pid7221)-> 2024 (150110208 162783232 0 7) = 0 
task50(pid7221)-> 2021 (272801792 951046144 0) = 0x3 ((os/kern) no space available) 
task50(pid7221)-> 2021 (272801792 414175232 0) = 0x3 ((os/kern) no space available) 
task50(pid7221)-> 2021 (272801792 145739776 0) = 0x3 ((os/kern) no space available) 
task50(pid7221)-> 2021 (272801792 40091648 0) = 0x3 ((os/kern) no space available) 
  78<--77(pid7221)->io_write ("The assertion !mbrk(cur) on line 313 of
  main.c in function update_real_maxpage f" -1) = 0 109


In the failing final image, sbrk(0) at first correctly returns
~0x12000000, sbrk(1) returns -1, and then sbrk(0) returns ~0x10400000.
=============================================================================

Take care,
-- 
Camm Maguire			     		    camm@maguirefamily.org
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah


Reply to: