[glibc] nscd: Define nscd_ssize_t as int32_t unconditionally
Adhemerval Zanella via Glibc-cvs <[email protected]>
| Newsgroups | gmane.comp.lib.glibc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b9ff43bdfee1f687e15d887cc45392ee54d59d74 commit b9ff43bdfee1f687e15d887cc45392ee54d59d74 Author: Magnus Lindholm <[email protected]> Date: Mon Aug 10 17:49:22 2026 +0200 nscd: Define nscd_ssize_t as int32_t unconditionally alpha was the only target that overrode sysdeps/generic/nscd-types.h, defining nscd_ssize_t as int64_t rather than int32_t. The file dated back to the initial import and had 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. With alpha gone there is no target left overriding the type, so the sysdeps indirection has no purpose. Delete both headers and define nscd_ssize_t directly in nscd/nscd-client.h alongside the wire format it describes. 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. Signed-off-by: Magnus Lindholm <[email protected]> Reviewed-by: Adhemerval Zanella <[email protected]> Diff: --- nscd/nscd-client.h | 4 +++- sysdeps/alpha/nscd-types.h | 21 --------------------- sysdeps/generic/nscd-types.h | 21 --------------------- 3 files changed, 3 insertions(+), 43 deletions(-) diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h index 0906de2929..33d275f898 100644 --- a/nscd/nscd-client.h +++ b/nscd/nscd-client.h @@ -27,10 +27,12 @@ #include <time.h> #include <sys/types.h> #include <atomic.h> -#include <nscd-types.h> #include <sys/uio.h> +/* Type for the size of a record in the data part of a database. */ +typedef int32_t nscd_ssize_t; + /* Version number of the daemon interface */ #define NSCD_VERSION 2 diff --git a/sysdeps/alpha/nscd-types.h b/sysdeps/alpha/nscd-types.h deleted file mode 100644 index 1b7ab74a41..0000000000 --- a/sysdeps/alpha/nscd-types.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Types for the NSCD implementation. Alpha version. - Copyright (c) 2000-2026 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <https://www.gnu.org/licenses/>. */ - -#include <stdint.h> - -typedef int64_t nscd_ssize_t; diff --git a/sysdeps/generic/nscd-types.h b/sysdeps/generic/nscd-types.h deleted file mode 100644 index f196175ec3..0000000000 --- a/sysdeps/generic/nscd-types.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Types for the NSCD implementation. Generic version. - Copyright (c) 2000-2026 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <https://www.gnu.org/licenses/>. */ - -#include <stdint.h> - -typedef int32_t nscd_ssize_t;