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

Bug#868076: libc6: gethostbyname assertion failure on m68k

Package: libc6
Version: 2.24-12
Tags: upstream patch
Forwarded: https://sourceware.org/ml/libc-alpha/2017-07/msg00466.html
User: debian-68k@lists.debian.org
Usertags: m68k
X-Debbugs-Cc: debian-68k@lists.debian.org

On m68k, gethostbyname can sometimes cause an assertion failure:

> "nss_files/files-hosts.c:218: _nss_files_gethostbyname3_r: Assertion `(bufferend - (char *) 0) % sizeof (char *) == 0' failed."

This can be reproduced with the following simple program (though it may
depend on the exact system or chroot setup):

> #include <stdio.h>
> #include <netdb.h>
> int main(int argc, char **argv) {
>     struct hostent *h = gethostbyname("localhost");
>     printf("name: %s\n", h->h_name);
>     return 0;
> }

This is because _nss_files_gethostbyname3_r asserts that bufferend is
sizeof-aligned (4 bytes for a char *), but parse_list only rounds to
__alignof__(char *), which is (unusually) just 2 bytes on m68k. The
above patch forwarded upstream weakens the assertion (and subsequent
rounding on future loop iterations) to only be __alignof__(char *).


Reply to: