On Mon, Mar 28, 2011 at 7:06 PM, Seb <[email protected]> wrote:
>> > > Hmm. Can you run "strace -s99 -oLOG su - unibug" and post
>> > > resulting LOG file?
>> >
>> > Sure I can, attached.
>>
>> Your version of su passes wrong argv[0] to the shell:
>>
>>
>> execve("/bin/su", ["su", "-", "unibug"], [/* 37 vars */]) = 0
>> ...
>> setgroups32(1, [1000])                  = 0
>> setuid32(1000)                          = 0
>> chdir("/tmp")                           = 0
>> open("/etc/environment", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or 
>> directory)
>> close(3)                                = 0
>> execve("/bin/ash", ["-su"], [/* 10 vars */]) = 0
>>                    ^^^^^^^
>>                    ???!
>> ...
>
> No way, it can't come from my su: I've previoulsy shown su was passing
> the right thing as argv[0],

I don't understand. The strace log you sent me clearly shows that
su performs:

execve("/bin/ash", ["-su"], [/* 10 vars */]) = 0

that is, it execs /bin/ash, but passes "-su" as program name.
Of course /bin/ash (which is just a busybox binary)
looks at program name, "-su". It knows to strip "-",
so it looks "su" in the internal applet name.
Your config has "# CONFIG_SU is not set".
Therefore, /bin/ash (when executed this way) says
"su: applet not found".

So, it does come from su. (Unless it's a strace bug).

Why your su executes /bin/ash with argv[0]="-su"?
That does not look right. It should pass argv[0]="-/bin/ash".

> I encountered problem neither with bbx
> 1.18.4 (where visibly neither pstree nor pwd are implemented) nor
> with the rest of the software creation, and I in every way can't
> figure how a change in the code of busybox could affect my su...

Yes, looks weird.

> Sure it's tricky to understand, and "Seb is a dumb bunny running a
> crappy box" is a very rational and straightforward explanation

By now this "theory" is ruled out. strace clearly shows that su does
something wrong.


> You'll see the same in the attached strace of a working /bin/ash,
> where I have just wiped out the pwdx applet.

Looking at LOG-noerr.gz, I see the same:

execve("/bin/ash", ["-su"], [/* 10 vars */]) = 0

AHA. I know why it works in this case. Config you sent me has only two
applets enabled:
CONFIG_PWDX=y
CONFIG_ASH=y

If you disable pwdx, you end up with "single-applet busybox", and in this case
it doesn't check program name. Therefore it works in this case.


So, please try updating su. And updating strace too:
strace which was adding unnecessary "..." after each string,
like here:
read(3, "/bin/bash\n/bin/dash\n/bin/ash\n"..., 4096) = 29
is known to be buggy.

What are the versions of those tools on the affected machine?

-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to