need help with dropbearkey and debugging the toolchain

Stefan Sperling stsp at
Sat Sep 9 11:18:41 CEST 2006


I have investigated sshd. I got it running and complaining
about missing host keys.

We cannot create host keys on the DS because dropbearkey
crashes with a data abort at a nonsense pc and an almost-null pointer.

Try this to see for yourself:

	dropbearkey -t rsa -f /home/key -s 512

Adding printf()s all over the place, I've traced
it down to the mp_prime_next_prime() function defined
in user/dropbear/libtommath/bn_mp_prime_next_prime.c.

Interestingly enough, the function calls __divdi3() from libgcc.

Does that ring a bell?



Well, I had to replace a function from dbclient that ended
up using __divdi3() with an equivalent one that came with
dropbear that did not use __divdi3() to "fix" the data abort
dbclient was getting.

There doesn't seem to be a way to avoid it for dropbearkey,
so we need to fix the toolchain this time.

__dvidi3() seems to be a software implementation (in C), for
a division operation not supported in hardware.

The code seems to be in gcc-4.0.2/gcc/libgcc2.c.

I have no idea how to debug this, since printfs don't seem
to work (compile time errors). Probably because the code is
cross-compiled during the build of gcc and is not linked with
uClibc :(

The only option I see is examining the code, and maybe assembler
code generated from it, to find a possible cause of the error.

Unfortunately, I am too incompetent to do this on my own.
Can someone help?
stefan                                 PGP Key: 0xF59D25F0

More information about the dslinux-devel mailing list