NetBSD Problem Report #54594
From martin@duskware.de Wed Oct 2 15:08:58 2019
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id C11097A1E1
for <gnats-bugs@gnats.NetBSD.org>; Wed, 2 Oct 2019 15:08:58 +0000 (UTC)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: bind may crash at startup
X-Send-Pr-Version: 3.95
>Number: 54594
>Category: bin
>Synopsis: bind may crash at startup
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Oct 02 15:10:00 +0000 2019
>Closed-Date: Wed Nov 13 18:05:11 +0000 2019
>Last-Modified: Wed Nov 13 18:05:11 +0000 2019
>Originator: Martin Husemann
>Release: NetBSD 9.99.15
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD unpluged.duskware.de 9.99.15 NetBSD 9.99.15 (UNPLUGED) #266: Wed Oct 2 12:14:19 CEST 2019 martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/evbarm/compile/UNPLUGED evbarm
Architecture: earm
Machine: evbarm
>Description:
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
value:
void
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.
>How-To-Repeat:
n/a
>Fix:
Add alignment attributes to the isc_hash_key? Make it a union with uint64_t?
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54594 CVS commit: src/external/mpl/bind/dist/lib/isc
Date: Wed, 2 Oct 2019 11:43:15 -0400
Module Name: src
Committed By: christos
Date: Wed Oct 2 15:43:15 UTC 2019
Modified Files:
src/external/mpl/bind/dist/lib/isc: siphash.c
Log Message:
PR/54594: Martin Husemann: bind may crash at startup
Use memcpy(3) instead of assuming casting "uint8_t *" to "uint64_t *" and
de-referencing works.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/mpl/bind/dist/lib/isc/siphash.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54594 CVS commit: [netbsd-9] src/external/mpl/bind/dist/lib/isc
Date: Thu, 3 Oct 2019 17:31:02 +0000
Module Name: src
Committed By: martin
Date: Thu Oct 3 17:31:02 UTC 2019
Modified Files:
src/external/mpl/bind/dist/lib/isc [netbsd-9]: siphash.c
Log Message:
Pull up following revision(s) (requested by christos in ticket #279):
external/mpl/bind/dist/lib/isc/siphash.c: revision 1.3
PR/54594: Martin Husemann: bind may crash at startup
Use memcpy(3) instead of assuming casting "uint8_t *" to "uint64_t *" and
de-referencing works.
To generate a diff of this commit:
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/external/mpl/bind/dist/lib/isc/siphash.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Wed, 13 Nov 2019 18:05:11 +0000
State-Changed-Why:
Christos fixed it
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.