[BusyBox] Re: login buggy also in 1.00pre5

Rob Landley rob at landley.net
Tue Jan 6 07:36:22 UTC 2004


On Monday 05 January 2004 20:48, Friedrich Lobenstock wrote:

> >>I have the problem also when running login from a shell or
> >>from getty (here it hangs forever). So I think the telnet daemon
> >>does not make a difference here. BTW I use the utelnetd that is
> >>included in the Axis developer kit, which I see got included now
> >>in busybox, but the sources are a little different.
> >
> > Hmm.  Nothing has changed in the login stuff since -pre3.
> > I'm really at a loss to explain your problems.
>
> I could make it break in pre3 too if I enabled inetd. See my
> posting http://busybox.net/lists/busybox/2003-December/010186.html

Sounds like a symbol collision.  If two files are defining the same function 
name (to do two different things), and the linker is using just the first one 
it finds...

Does it break if inetd and login are the _only_ two things you have enabled in 
the same busybox binary?  (make allnoconfig, make menuconfig and switch those 
two on, then try it...)

If so, I'd guess either a function or a global variable in login and inetd 
have the same name, without saying "static" where they should...

> >>Is there a way to compile one busybox applet standalone so I could
> >>run it with debug symbols under gdbserver? Because I've already
> >>got gdbserver I would not have to mess with getting strace/ltrace
> >>compiled.
>
> I finally create a little wrapper that basically calls login_main.
> An linking it with the correct stuff produces a runable exec in
> pre3. So now one to pre5:
>
> busybox-1.00-pre5> gcc-cris  -isystem
> /home/fl/axis/devboard_82/target/cris-axis-linux-gnu/include -mlinux
> -I./include -Wall -Wstrict-prototypes -Wshadow -Os -fomit-frame-pointer
> -D_GNU_SOURCE -DNDEBUG  -Wall -Wshadow -O2 -g  -c -o my_login.o my_login.c
> busybox-1.00-pre5> gcc-cris  -isystem
> /home/fl/axis/devboard_82/target/cris-axis-linux-gnu/include -mlinux
> -L/home/fl/axis/devboard_82/target/cris-axis-linux-gnu/lib -o my_login
> ./my_login.o ./loginutils/loginutils.a ./libbb/libbb.a  -lm -lcrypt
>
> Now the big suprise when I run this in the system with the rest still
> being pre3 it just works:
> [root at AxisProduct /mnt/flash]309# ./my_login
> AxisProduct login: root
> Password:
> [root at AxisProduct /]375#
>
> Now lets compile pre5 and update the system to use pre5 and then
> we try it again. The same again:
>
> [root at AxisProduct /mnt/flash]257# ./my_login
> AxisProduct login: root
> Password:
> [root at AxisProduct /]279#
>
> Now here comes the big mistery:
> > You can build busybox with the config set to only enable that
> > one busybox applet...
>
> I did this:
> busybox-1.00-pre5> sed -e "/^$/d" -e "/^#/d" .config
> HAVE_DOT_CONFIG=y
> CONFIG_FEATURE_BUFFERS_GO_IN_BSS=y
> CONFIG_FEATURE_VERBOSE_USAGE=y
> CONFIG_FEATURE_DEVPTS=y
> EXTRA_CFLAGS_OPTIONS=""
> PREFIX="./_install"
> CONFIG_USE_BB_PWD_GRP=y
> CONFIG_LOGIN=y
> CONFIG_FEATURE_SECURETTY=y
> CONFIG_FEATURE_SH_IS_NONE=y
> CONFIG_DEBUG=y
>
> Compiled it and copied the resulting file to the target.
>
> [root at AxisProduct /mnt/flash]279# ls -l
> -rwxr-xr-x    1 root     root       518411 Jan  6 02:32 busybox
> lrwxrwxrwx    1 root     root            7 Jan  6 02:32 login -> busybox
>
> And now we have the same thing again - segfault.
>
> [root at AxisProduct /mnt/flash]279# ./login
> AxisProduct login: root
> Password:
> Segmentation fault
> [root at AxisProduct /mnt/flash]279#
>
> So there is something else in the busybox source that when linked in
> breaks the thing.
>
> Here's with what I can come up from the debugger when
> running "busybox login -f root":
>
> busybox-1.00-pre5> /home/fl/axis/temp/gdb/gdb-cris-linux/gdb/gdb
> GNU gdb 5.2.1
> Copyright 2002 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you
> are welcome to change it and/or distribute copies of it under certain
> conditions. Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "--host=i686-pc-linux-gnu --target=cris".
> (gdb) file busybox
> Reading symbols from busybox...done.
> (gdb) target remote 192.168.1.254:1234
> Remote debugging using 192.168.1.254:1234
> 0x35557608 in ?? ()
> warning: Unable to find dynamic linker breakpoint function.
> GDB will be unable to debug shared library initializers
> and track explicitly loaded dynamic code.
> (gdb) c
> Continuing.
> Error while mapping shared library sections:
> /lib/ld.so.1: No such file or directory.
> Error while reading shared library symbols:
> /lib/ld.so.1: No such file or directory.
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x9fffdd40 in ?? ()
> (gdb) bt
> #0  0x9fffdd40 in ?? ()
> #1  0x000829b8 in setgroups (size=81, list=0x85872) at
> libpwdgrp/setgroups.c:37 #2  0x000829b8 in setgroups (size=81,
> list=0x85872) at libpwdgrp/setgroups.c:37 (gdb)

Any way to get a stack trace?  It's dying in a library function, that doesn't 
say where it was called from.  (A grep of loginutils/login.c doesn't show any 
instances of "setgroups"...)

The only thing missing a "static" is in login.c is "utent", but grepping the 
other .c files in the busybox tree don't pick up any other uses of it.  (The 
fragment shows up in some longer identifiers, but that's it...)

> Hope you can make something out of that. I'll go to bed, it's
> really time now. Hear you later.

A stack trace would be really nice.  Also limiting it to just those two 
applets interacting with everything else disabled would be a good step...

Rob




More information about the busybox mailing list