From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1827) id D8C463858D37; Wed, 30 Nov 2022 16:37:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D8C463858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669826279; bh=HAXyU1qJZV602EpMPnmDzN8uH6OSpYzhEq6a9to9qbc=; h=From:To:Subject:Date:From; b=IqPhEPljfbpLrA7TBhsW2eBFCwIG/66n4uQxiZ9iPoeZy1x2XBtmK8aLKG9T5+hMz e1vxLvf1MhKcpSbyTtuWihxVucWWgA5uCvVmm5hW9YoofBGZQMUv54JJVkUYZ286yp oc2pxhfvP4HgItfWPWdHe0zctA75jDIjY+xbnyq0= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Tulio Magno Quites Machado Filho To: glibc-cvs@sourceware.org Subject: [glibc/release/2.34/master] Apply asm redirections in syslog.h before first use [BZ #27087] X-Act-Checkin: glibc X-Git-Author: Tulio Magno Quites Machado Filho X-Git-Refname: refs/heads/release/2.34/master X-Git-Oldrev: a1c12fdf3f9b8665719835ce8330b3b2e2574b37 X-Git-Newrev: a4217408a3d6050a7f42ac23adb6ac7218dca85f Message-Id: <20221130163759.D8C463858D37@sourceware.org> Date: Wed, 30 Nov 2022 16:37:59 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a4217408a3d6050a7f42ac23adb6ac7218dca85f commit a4217408a3d6050a7f42ac23adb6ac7218dca85f Author: Tulio Magno Quites Machado Filho Date: Fri Nov 11 17:00:15 2022 -0300 Apply asm redirections in syslog.h before first use [BZ #27087] Similar to d0fa09a770, but for syslog.h when _FORTIFY_SOURCE > 0. Fixes [BZ #27087] by applying long double-related asm redirections before using functions in bits/syslog.h. Tested with build-many-glibcs.py. Reviewed-by: Adhemerval Zanella (cherry picked from commit 227df6243a2b5b4d70d11772d12c02eb9cb666ca) Diff: --- misc/bits/syslog.h | 18 ++++++++++++++---- misc/sys/syslog.h | 10 +++++----- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h index 6f3137a98e..10c9c11513 100644 --- a/misc/bits/syslog.h +++ b/misc/bits/syslog.h @@ -24,6 +24,20 @@ extern void __syslog_chk (int __pri, int __flag, const char *__fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); +#ifdef __USE_MISC +extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt, + __gnuc_va_list __ap) + __attribute__ ((__format__ (__printf__, 3, 0))); +#endif + +#include +#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 +# include +#endif + +/* The following functions must be used only after applying all asm + redirections, e.g. long double asm redirections. */ + #ifdef __va_arg_pack __fortify_function void syslog (int __pri, const char *__fmt, ...) @@ -37,10 +51,6 @@ syslog (int __pri, const char *__fmt, ...) #ifdef __USE_MISC -extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt, - __gnuc_va_list __ap) - __attribute__ ((__format__ (__printf__, 3, 0))); - __fortify_function void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) { diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h index dc3b0e7ef8..e7a98fb9b1 100644 --- a/misc/sys/syslog.h +++ b/misc/sys/syslog.h @@ -205,11 +205,11 @@ extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) /* Define some macros helping to catch buffer overflows. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include -#endif - -#include -#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 -# include +#else +# include +# if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 +# include +# endif #endif __END_DECLS