NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/54594: bind may crash at startup

>Number:         54594
>Category:       bin
>Synopsis:       bind may crash at startup
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 02 15:10:00 +0000 2019
>Originator:     Martin Husemann
>Release:        NetBSD 9.99.15
The NetBSD Foundation, Inc.
System: NetBSD 9.99.15 NetBSD 9.99.15 (UNPLUGED) #266: Wed Oct 2 12:14:19 CEST 2019 evbarm
Architecture: earm
Machine: evbarm

On alignement critical architectures, bind may crash at startup when it 
initializes its internal keys.

In dist/lib/isc/hash.c:39 there is a global storage for a key:

static uint8_t isc_hash_key[16];

which is initialized in line 141:

                isc_siphash24(isc_hash_key, input, length, (uint8_t *)&hval);

but isc_siphash24 expects the key to be properly aligned for a 64bit

isc_siphash24(const uint8_t *k, const uint8_t *in, size_t inlen, uint8_t *out)
        const uint64_t *key = (const uint64_t *)k;

And depending on how linking ends up for that byte array, we loose or win.
Example crash:

Core was generated by `named'.
Program terminated with signal SIGBUS, Bus error.
#0  isc_siphash24 (
    k=0xbbbc71f4 "\365q\036\362\255\214tLC\226XxO\230\346\251\001", 
    in=in@entry=0xbfffd6e0 "", inlen=inlen@entry=1, 
    out=out@entry=0xbfffd6d8 "")
(gdb) up
#1  0xbbba0ad4 in isc_hash_function (data=0xbb2579f8, length=1, 
    case_sensitive=<optimized out>)
    at /work/src/external/mpl/bind/lib/libisc/../../dist/lib/isc/hash.c:141
141     /work/src/external/mpl/bind/lib/libisc/../../dist/lib/isc/hash.c: No such file or directory.


Add alignment attributes to the isc_hash_key? Make it a union with uint64_t?

Home | Main Index | Thread Index | Old Index