Your message dated Thu, 2 Jan 2020 21:42:26 +0100
with message-id <[email protected]>
and subject line Re: Bug#868076: libc6: gethostbyname assertion failure on m68k
has caused the Debian Bug report #868076,
regarding Assertion failure in gethostbyname
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
868076: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=868076
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: libc6
Version: 2.21-9
User: [email protected]
Usertags: m68k
Hi,
Backstory: I maintain polyml, and was porting it to m68k; when running the test
suite, I received an assertion failure in glibc in a call to gethostbyname.
It seems gethostbyname is broken, failing for me with
“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:
#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;
}
Delving inside glibc, _nss_files_gethostbyname3_r expects result->h_aliases to
be aligned to sizeof(char *), as can be seen in the assert (bufferend points to
an element in result->h_aliases, and each element is a char *). Provided this
is true when the function is called, it seems to correctly maintain the
invariant by rounding up bufferend when necessary.
However, the initial value of result->h_aliases is not aligned to sizeof(char
*). Instead, it is assigned in parse_list (nss_files/files-parse.c:245) and
aligned to __alignof__(char *). On many architectures, these are the same, but
on m68k, __alignof__(char *) == 2, but sizeof(char *) == 4. There may be
environments where result->h_aliases happens to be aligned to sizeof(char *) by
chance, but that is most certainly not the case on mine (latest unstable
running in ARAnyM).
I don’t know why bufferend is required to be aligned to sizeof(char *), and
believe that imposing __alignof__(char *) in _nss_files_gethostbyname3_r
instead would suffice. Alternatively, parse_list could choose MAX(sizeof(char
*), __alignof__(char *)) as the alignment. Either way, the implementation as a
whole is currently broken.
Regards,
James
signature.asc
Description: Message signed with OpenPGP using GPGMail
--- End Message ---
--- Begin Message ---
Version: 2.27-1
On 2017-07-11 21:21, James Clarke wrote:
> Package: libc6
> Version: 2.24-12
> Tags: upstream patch
> Forwarded: https://sourceware.org/ml/libc-alpha/2017-07/msg00466.html
> User: [email protected]
> Usertags: m68k
> X-Debbugs-Cc: [email protected]
>
> 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."
>
According to upstream this problem has been fixed in version 2.27-1. I
am therefore closing the bug with that version.
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
[email protected] http://www.aurel32.net
--- End Message ---