md5sum makes unaligned word accesses...

Andre armcc2000 at yahoo.com
Thu May 11 06:05:27 UTC 2006


Mike Frysinger <vapier at gentoo.org> wrote:
>
> you can try the attached patch since i'm still unable to make
> it fail

I still see the fault, even with your patch...

Looking at my previous strace, the following should be enough to
trigger an alignment fault - regardless of kernel version ?!?

# echo 5 > /proc/cpu/alignment
# for size in 519 327; do
>   dd if=/dev/zero bs=$size count=1
>   sleep 1
> done | busybox md5sum


Anyway, comparing the faulting PC with a disassembly of busybox, it
looks like the fault happens in md5_hash_block()

void md5_hash_block(const void *buffer, size_t len, md5_ctx_t *ctx)
{
    uint32_t correct_words[16];
    const uint32_t *words = buffer;
    ....

Casting a void * to an unsigned int * is highly suspect unless all
callers of md5_has_block() somehow know that 'buffer' has implicit
alignment constraints...

Andre
--



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the busybox mailing list