BusyBox http daemon seems to overlay memory on cgi requests

Denys Vlasenko vda.linux at googlemail.com
Tue Nov 22 16:21:39 UTC 2011


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"?

> 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/..)

> 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,


-- 
vda


More information about the busybox mailing list