Bug#1078371: nslint: Aborts on s390x while checking for doubly booked addresses
Package: nslint
Version: 3.2-1
Severity: important
With the introduction of a autopkgtest check of nslint, it became clear
that it aborts on s390x. This is what it look like under valgrind:
% NSLINT="valgrind `pwd`/nslint" ./debian/tests/validate-bind-zones
==2996950== Memcheck, a memory error detector
==2996950== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==2996950== Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyright info
==2996950== Command: /home/pere/nslint/nslint -c named.conf
==2996950==
cmpaddr: unknown address family 0.
==2996950==
==2996950== Process terminating with default action of signal 6 (SIGABRT)
==2996950== at 0x48F4FFE: __pthread_kill_implementation (pthread_kill.c:44)
==2996950== by 0x48A1117: raise (raise.c:26)
==2996950== by 0x488225F: abort (abort.c:79)
==2996950== by 0x109AFF: cmpaddr (nslint.c:624)
==2996950== by 0x48A5A75: msort_with_tmp.part.0 (qsort.c:239)
==2996950== by 0x48A5E43: msort_with_tmp (qsort.c:201)
==2996950== by 0x48A5E43: qsort_r (qsort.c:393)
==2996950== by 0x48A614D: qsort (qsort.c:405)
==2996950== by 0x10C011: nslint (nslint.c:1744)
==2996950== by 0x109789: main (nslint.c:356)
==2996950==
==2996950== HEAP SUMMARY:
==2996950== in use at exit: 1,176 bytes in 2 blocks
==2996950== total heap usage: 8 allocs, 6 frees, 10,614 bytes allocated
==2996950==
==2996950== LEAK SUMMARY:
==2996950== definitely lost: 0 bytes in 0 blocks
==2996950== indirectly lost: 0 bytes in 0 blocks
==2996950== possibly lost: 0 bytes in 0 blocks
==2996950== still reachable: 1,176 bytes in 2 blocks
==2996950== suppressed: 0 bytes in 0 blocks
==2996950== Rerun with --leak-check=full to see details of leaked memory
==2996950==
==2996950== For lists of detected and suppressed errors, rerun with: -s
==2996950== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Aborted
failure: error in supposed correct zone detected
==2996951== Memcheck, a memory error detector
==2996951== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==2996951== Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyright info
==2996951== Command: /home/pere/nslint/nslint -c named.conf
==2996951==
nslint: Missing "a": tjener.intern. -> 10.0.0.2
nslint: Missing "ptr": tjener.intern. -> 10.0.2.2
cmpaddr: unknown address family 0.
==2996951==
==2996951== Process terminating with default action of signal 6 (SIGABRT)
==2996951== at 0x48F4FFE: __pthread_kill_implementation (pthread_kill.c:44)
==2996951== by 0x48A1117: raise (raise.c:26)
==2996951== by 0x488225F: abort (abort.c:79)
==2996951== by 0x109AFF: cmpaddr (nslint.c:624)
==2996951== by 0x48A5A75: msort_with_tmp.part.0 (qsort.c:239)
==2996951== by 0x48A5809: msort_with_tmp (qsort.c:201)
==2996951== by 0x48A5809: msort_with_tmp.part.0 (qsort.c:210)
==2996951== by 0x48A5E43: msort_with_tmp (qsort.c:201)
==2996951== by 0x48A5E43: qsort_r (qsort.c:393)
==2996951== by 0x48A614D: qsort (qsort.c:405)
==2996951== by 0x10C011: nslint (nslint.c:1744)
==2996951== by 0x109789: main (nslint.c:356)
==2996951==
==2996951== HEAP SUMMARY:
==2996951== in use at exit: 1,184 bytes in 2 blocks
==2996951== total heap usage: 8 allocs, 6 frees, 10,622 bytes allocated
==2996951==
==2996951== LEAK SUMMARY:
==2996951== definitely lost: 0 bytes in 0 blocks
==2996951== indirectly lost: 0 bytes in 0 blocks
==2996951== possibly lost: 0 bytes in 0 blocks
==2996951== still reachable: 1,184 bytes in 2 blocks
==2996951== suppressed: 0 bytes in 0 blocks
==2996951== Rerun with --leak-check=full to see details of leaked memory
==2996951==
==2996951== For lists of detected and suppressed errors, rerun with: -s
==2996951== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Aborted
success: error in zone detected.
This is the failing code:
/* Check for doubly booked addresses */
n = ipp - itemlist;
qsort(itemlist, n, sizeof(itemlist[0]), cmpaddr);
I have tried to debug it, without any success. I suspect it has always
failed, and just never been tested on s390x before. I tested ensuring
the items array was zeroed out and to use the correct type for the
network family value, but this did not affect the result.
Index: nslint/nslint.c
===================================================================
--- nslint.orig/nslint.c
+++ nslint/nslint.c
@@ -68,7 +68,7 @@ static const char rcsid[] =
/* Address (network order) */
struct addr {
- u_int family;
+ sa_family_t family;
union {
struct in_addr _a_addr4;
struct in6_addr _a_addr6;
@@ -79,7 +79,7 @@ struct addr {
/* Network */
struct network {
- u_int family;
+ sa_family_t family;
union {
struct in_addr _n_addr4;
struct in6_addr _n_addr6;
@@ -276,6 +276,7 @@ main(int argc, char **argv)
{
char *cp;
int op, donamedboot, donamedconf;
+ memset(items, 0, ITEMSIZE * sizeof(items[0]));
if ((cp = strrchr(argv[0], '/')) != NULL)
prog = cp + 1;
I have commited a change in the code to run the self test during build,
which will break the build on s390x. I believe the best short term
solution is to drop the binary packages om this architecture until a fix
can be found.
--
Happy hacking
Petter Reinholdtsen
Reply to: