[PATCH 00/11] Build getdomainname, gethostname, syslog with fortification
Florian Weimer
fweimer@redhat.com
Fri Feb 9 15:24:35 GMT 2024
Fortification was disabled to address build failures. With
fortification enabled, the installed header contains an inline function
with a body, and we cannot define the function again, with its real
implementation.
The internal __snprintf function did not have an fortify wrapper, so we
lost a couple of fortification opportunities.
After these changes, use of %n in syslog becomes a potential performance
bottleneck. The later commits extract useful functionality from
asprintf and use that to construct the syslog packet contents.
Thanks,
Florian
Florian Weimer (11):
misc: Build getdomainname with fortification
misc: Build gethostname with fortification
libio: Add fortify wrapper for internal __snprintf
syslog: Update misc/tst-syslog to check reported %n value
syslog: Build with fortification
stdio: Rename __printf_buffer to __vfprintf_buffer
libio: Extract __printf_buffer_asprintf_init from asprintf
implementation
stdio-common: Introduce the __printf_buffer function
stdio-common: Allow skipping initial bytes in __printf_buffer for %n
stdio-common: Support large offsets with %lln
syslog: Use a printf buffer directly to construct the entire packet
debug/snprintf_chk.c | 1 +
include/bits/stdio2.h | 9 +
include/printf.h | 9 +-
include/printf_buffer.h | 52 +++++-
include/stdio.h | 1 +
libio/iovdprintf.c | 2 +-
libio/iovsprintf.c | 2 +-
libio/obprintf.c | 2 +-
libio/vasprintf.c | 42 ++---
libio/vsnprintf.c | 2 +-
libio/vswprintf.c | 2 +-
misc/Makefile | 7 -
misc/bits/syslog.h | 4 +
misc/getdomain.c | 2 +
misc/gethostname.c | 2 +
misc/syslog.c | 187 +++++++-------------
misc/tst-syslog.c | 12 +-
posix/bits/unistd.h | 6 +-
stdio-common/Makefile | 6 +
stdio-common/printf_buffer.c | 30 ++++
stdio-common/tst-printf-large-n.c | 81 +++++++++
stdio-common/tst-printf_buffer.c | 156 ++++++++++++++++
stdio-common/vfprintf-internal.c | 10 +-
stdio-common/vfprintf-process-arg.c | 2 +-
sysdeps/mach/hurd/getdomain.c | 2 +
sysdeps/mach/hurd/gethostname.c | 2 +
sysdeps/posix/gethostname.c | 2 +
sysdeps/unix/sysv/linux/alpha/gethostname.c | 2 +
28 files changed, 448 insertions(+), 189 deletions(-)
create mode 100644 stdio-common/printf_buffer.c
create mode 100644 stdio-common/tst-printf-large-n.c
create mode 100644 stdio-common/tst-printf_buffer.c
base-commit: 15de3d17e1d9da5d38efb0a87a82efbc5bda732d
--
2.43.0
More information about the Libc-alpha
mailing list