BusyBox http daemon seems to overlay memory on cgi requests

Peter Kuennemann -ITB itb.pkue at googlemail.com
Sun Nov 27 22:29:05 UTC 2011


Am 22.11.2011 17:21, schrieb Denys Vlasenko:
> On Tue, Nov 15, 2011 at 11:04 AM, Peter Kuennemann at itb
> <itb.pkue at googlemail.com>  wrote:
>> Hi all,
>> I got completely stuck with a coreoverlay problem using busybox httpd
>> on a uClinux coldfire system (LANTRONIX XportPro). This a NOMMU box
> What is "coreoverlay problem"?
 From the obvious appearences of the modified first byte of the high 
order byte of
the executeable name I supposed a storage overlay (coreoverly) problem.
>> I am running busybox v1.19.3 but the very same problem appeared as with
>> 1.13.3
>>
>> The problem manifests in a overlay of the command name in the task list (ps)
>> after having executed a cgi-script the first time. The first char of the command
>> line get overlayed by 0xE8.
> This is the result of re_exec status passed in a high-order bit of
> executable name.
> Here's the code in main() which checks for it:
>
> #if !BB_MMU
>          /* NOMMU re-exec trick sets high-order bit in first byte of name */
>          if (argv[0][0]&  0x80) {
>                  re_execed = 1;
>                  argv[0][0]&= 0x7f;
>          }
> #endif
>
> I am surprised the last line, "argv[0][0]&= 0x7f", does not fix the ps output.
>
> Hmm. Found it.
> Fixed in commit d2277e262ff7dd2dd946ea16b93462f3dcdf0447.
>
>
>> I also get 'memory allocation failed' after executing a CGI program a number
>> of times.
> Where allocation fails? in httpd? How much memory there is in general?
> How fragmented is it? (You can find some answers in /proc/..)
I am sorry but I was unable to diagnose the memory alloaction any 
further. The Lantronix
device has 8 Meg of RAM. A free command shows about 1.2 to .1.8 Meg free 
but sometimes
during or after several times executing the CGI I got 0 bytes free. I 
cannot preclude that the
CGI program might have caused the memory problems.
>> The test script beeing executed is:
>> --------------------------- CGI Script -----------------------------
>> #!/bin/sh
>> echo "Content-type: text/html"
>> echo ""
>>
>> cat /usr/local/nero/www/cgi-bin/f1
>> cat<<EOM
>> Some extra Text to test cat here
>>
>> ----------- End of extra text --------------
>> EOM
>> env
>> cat /usr/local/nero/www/cgi-bin/f2
>> ---------------------END CGI Script -----------------------------
>>
>> Any help woud be very much appreciated,
Regards, Peter


More information about the busybox mailing list