[PATCH] alpha: Use the generic nscd_ssize_t
Florian Weimer
fweimer@redhat.com
Mon Aug 10 13:12:36 GMT 2026
* Magnus Lindholm:
> alpha is the only target that overrides sysdeps/generic/nscd-types.h,
> defining nscd_ssize_t as int64_t rather than int32_t. The file dates back
> to the initial import and has only ever received licence and copyright
> updates.
>
> nscd's response headers are a wire format, shared between the daemon and
> its clients through a socket and through the persistent cache. A 64-bit
> nscd_ssize_t gives four of them 8-byte alignment while their last member is
> 32 bits, so they acquire four bytes of tail padding: hst_response_header,
> ai_response_header, serv_response_header and innetgroup_response_header.
>
> For the hosts cache that is fatal. cache_addhst() asserts that the string
> data follows the header with no gap, and on alpha it does not:
>
> nscd: hstcache.c:269: cache_addhst: Assertion
> `(char *) (&dataset->resp.error + 1) == dataset->strdata' failed.
>
> The daemon aborts, and nscd/tst-nscd-basic fails with 58 errors. With the
> override removed it passes.
>
> The padding is also never initialised. cache_addhst() assigns the header
> fields individually and nothing clears the record, yet the response is sent
> with writeall (fd, &dataset->resp, ...) covering the full
> sizeof (hst_response_header), so four uninitialised bytes reach every
> client.
>
> Delete the override so that alpha uses the generic 32-bit type like every
> other target, which removes the padding from all four headers. This changes
> nscd's protocol and persistent cache layout on alpha; the daemon and its
> clients always come from the same build, so the exposure is a daemon left
> running or a cache file left behind across the upgrade.
Technically, it's possible to have a separate daemon implementation of
the code, but switching is probably fine for Alpha. It's doubtful
whether the separate daemons worked on Alpha due to the difference.
I think this was a performance optimization for the original Alpha,
which only had 64-bit atomics.
Would you be able to send a v2 that deletes sysdeps/generic/nscd-types.h
and merges into nscd/nscd-client.h?
Thanks,
Florian
More information about the Libc-alpha
mailing list