• Bug#868076: libc6: gethostbyname assertion failure on m68k

    From James Clarke@21:1/5 to All on Tue Jul 11 23:30:01 2017
    XPost: linux.debian.bugs.dist, linux.debian.ports.68k

    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

    Hi,
    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 *).

    Regards,
    James

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)