Comment 0 for bug 452175

Revision history for this message
Visi (visegradi) wrote :

It seems that memory allocation fails occasionally, when an optional (non-standard, but legal) startup method is used to execute a binary. Our application requires that method (scratchbox2) so that's why we found it.

Environment:
-----------------
Ubuntu 9.10 Karmic Koala 32bit
uname -a:
Linux testub910-32 2.6.31-14-generic #46-Ubuntu SMP Tue Oct 13 16:47:59 UTC 2009 i686 GNU/Linux

How to reproduce:
-----------------------
Use the following loop to do the test: Execute ld.so/ld-linux.so
explicitly:

#!/bin/sh
while true
do
   /lib/ld-linux.so.2 /bin/bash /usr/bin/which apt-get
done

(note that "which" is really a shell script, that is why bash is involved)

This produces occasionally memory allocation errors and coredumps.
like:
...
/usr/bin/apt-get
Segmentation fault (core dumped)
/usr/bin/apt-get
..
/usr/bin/apt-get
/usr/bin/apt-get
/bin/bash: xrealloc: ../../../bash/lib/sh/stringvec.c:48: cannot reallocate 276 bytes (0 bytes allocated)
/usr/bin/apt-get
..
/usr/bin/apt-get
/usr/bin/apt-get
/usr/bin/apt-get
/usr/bin/which: xrealloc: ../bash/input.c:170: cannot reallocate 1100 bytes (0 bytes allocated)
/usr/bin/apt-get
..
/usr/bin/apt-get
Segmentation fault (core dumped)
...

Necessary background information:
--------------------------------
Using ld.so (=ld-linux.so) explicitly to start a program is a not-so-common
way to start a binary, but it is still a valid and legal way to do it.
Scratchbox 2 uses it because it needs to use Maemo's ld.so (the default is
to use host's ld.so) and Maemo's libraries (default is to use host's
libraries),
and additionally we want to set some extra parameters that can only be
specified when ld.so is executed "from the command line".

We have tested the similar script in some different environment:
--------------------------------------------------------------------------------
In Ubuntu 9.04 Jaunty 32 bit everything works fine without any problem.
uname -a:
Linux testmachine 2.6.28-15-generic #52-Ubuntu SMP Wed Sep 9 10:49:34 UTC 2009 i686 GNU/Linux

In OpenSUSE 11.2 Beta 32bit does not produce the above described problem
uname -a:
Linux testmachine 2.6.31.3-1-default #1 SMP 2009-10-08 00:27:25 +0200 i686 i686 i386 GNU/Linux

I have also compiled the latest stable kernel from kernel.org (2.6.31.4) under karmic koala. If I booting from this new kernel (under the same problematic Ubuntu 9.10 Karmic Koala 32bit machine) then it will NOT produce the above described problem. So I think (I am not an expert so please correct me if I am wrong) it means that the problem is likely to be in an ubuntu specific kernel change.
uname -a:
Linux testmachine 2.6.31.4 #1 SMP Thu Oct 15 15:55:55 EEST 2009 i686 GNU/Linux

Please locate the problem and fix it, if it is possible, before Karmic Koala release.
Thank you in advance.