From 07fe59717786f28058815ad8b42bc4eef597b27d8e89b4d72b451f93554f2147 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 8 Sep 2020 09:28:40 +0000 Subject: [PATCH] Accepting request 832940 from home:Andreas_Schwab:Factory - Keep nsswitch.conf in /etc for SLES15 - syslog-locking.patch: Correct locking and cancellation cleanup in syslog functions (bsc#1172085, BZ #26100) - ifunc-fma4.patch: x86-64: Fix FMA4 detection in ifunc (BZ #26534) OBS-URL: https://build.opensuse.org/request/show/832940 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=568 --- glibc.changes | 8 +++ glibc.spec | 15 ++++++ ifunc-fma4.patch | 28 +++++++++++ syslog-locking.patch | 117 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 168 insertions(+) create mode 100644 ifunc-fma4.patch create mode 100644 syslog-locking.patch diff --git a/glibc.changes b/glibc.changes index 04be542..8047811 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Sep 8 08:00:33 UTC 2020 - Andreas Schwab + +- Keep nsswitch.conf in /etc for SLES15 +- syslog-locking.patch: Correct locking and cancellation cleanup in syslog + functions (bsc#1172085, BZ #26100) +- ifunc-fma4.patch: x86-64: Fix FMA4 detection in ifunc (BZ #26534) + ------------------------------------------------------------------- Thu Aug 6 08:08:04 UTC 2020 - Andreas Schwab diff --git a/glibc.spec b/glibc.spec index 2d9a375..73a179d 100644 --- a/glibc.spec +++ b/glibc.spec @@ -259,6 +259,10 @@ Patch306: glibc-fix-double-loopback.diff ### # Patches from upstream ### +# PATCH-FIX-UPSTREAM Correct locking and cancellation cleanup in syslog functions (BZ #26100) +Patch1000: syslog-locking.patch +# PATCH-FIX-UPSTREAM x86-64: Fix FMA4 detection in ifunc (BZ #26534) +Patch1001: ifunc-fma4.patch ### # Patches awaiting upstream approval @@ -471,6 +475,9 @@ makedb: A program to create a database for nss %patch304 -p1 %patch306 -p1 +%patch1000 -p1 +%patch1001 -p1 + %patch2000 -p1 %patch2001 -p1 %patch2002 -p1 @@ -832,7 +839,11 @@ rm -rf %{buildroot}%{_datadir}/locale/*/ # Miscelanna: install -m 644 %{SOURCE7} %{buildroot}/etc +%if %suse_version > 1500 install -D -m 644 %{SOURCE5} %{buildroot}%{_prefix}/etc/nsswitch.conf +%else +install -m 644 %{SOURCE5} %{buildroot}/etc +%endif mkdir -p %{buildroot}/etc/default install -m 644 nis/nss %{buildroot}/etc/default/ @@ -1080,8 +1091,12 @@ exit 0 %config /etc/ld.so.conf %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache %config(noreplace) /etc/rpc +%if %suse_version > 1500 %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/nsswitch.conf %{_prefix}/etc/nsswitch.conf +%else +%verify(not md5 size mtime) %config(noreplace) /etc/nsswitch.conf +%endif %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/gai.conf %doc posix/gai.conf %config(noreplace) /etc/default/nss diff --git a/ifunc-fma4.patch b/ifunc-fma4.patch new file mode 100644 index 0000000..1590cfe --- /dev/null +++ b/ifunc-fma4.patch @@ -0,0 +1,28 @@ +From 23af890b3f04e80da783ba64e6b6d94822e01d54 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20Ho=C5=A1ek?= +Date: Wed, 26 Aug 2020 04:26:50 +0200 +Subject: [PATCH] x86-64: Fix FMA4 detection in ifunc [BZ #26534] + +A typo in commit 107e6a3c2212ba7a3a4ec7cae8d82d73f7c95d0b causes the +FMA4 code path to be taken on systems that support FMA, even if they do +not support FMA4. Fix this to detect FMA4. +--- + sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h b/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h +index 7659758972..e5fd5ac9cb 100644 +--- a/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h ++++ b/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h +@@ -32,7 +32,7 @@ IFUNC_SELECTOR (void) + && CPU_FEATURE_USABLE_P (cpu_features, AVX2)) + return OPTIMIZE (fma); + +- if (CPU_FEATURE_USABLE_P (cpu_features, FMA)) ++ if (CPU_FEATURE_USABLE_P (cpu_features, FMA4)) + return OPTIMIZE (fma4); + + return OPTIMIZE (sse2); +-- +2.28.0 + diff --git a/syslog-locking.patch b/syslog-locking.patch new file mode 100644 index 0000000..3db81c9 --- /dev/null +++ b/syslog-locking.patch @@ -0,0 +1,117 @@ +From 518db378cedc755f0ae311a1bc0487a4264f4bf0 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Tue, 23 Jun 2020 12:55:49 +0200 +Subject: [PATCH] Correct locking and cancellation cleanup in syslog functions + (bug 26100) + +Properly serialize the access to the global state shared between the +syslog functions, to avoid races in multithreaded processes. Protect a +local allocation in the __vsyslog_internal function from leaking during +cancellation. +--- + misc/syslog.c | 44 ++++++++++++++++++++++++++++---------------- + 1 file changed, 28 insertions(+), 16 deletions(-) + +Index: glibc-2.32/misc/syslog.c +=================================================================== +--- glibc-2.32.orig/misc/syslog.c ++++ glibc-2.32/misc/syslog.c +@@ -91,14 +91,20 @@ struct cleanup_arg + static void + cancel_handler (void *ptr) + { +-#ifndef NO_SIGPIPE + /* Restore the old signal handler. */ + struct cleanup_arg *clarg = (struct cleanup_arg *) ptr; + +- if (clarg != NULL && clarg->oldaction != NULL) +- __sigaction (SIGPIPE, clarg->oldaction, NULL); ++ if (clarg != NULL) ++ { ++#ifndef NO_SIGPIPE ++ if (clarg->oldaction != NULL) ++ __sigaction (SIGPIPE, clarg->oldaction, NULL); + #endif + ++ /* Free the memstream buffer, */ ++ free (clarg->buf); ++ } ++ + /* Free the lock. */ + __libc_lock_unlock (syslog_lock); + } +@@ -169,9 +175,17 @@ __vsyslog_internal(int pri, const char * + pri &= LOG_PRIMASK|LOG_FACMASK; + } + ++ /* Prepare for multiple users. We have to take care: most ++ syscalls we are using are cancellation points. */ ++ struct cleanup_arg clarg; ++ clarg.buf = NULL; ++ clarg.oldaction = NULL; ++ __libc_cleanup_push (cancel_handler, &clarg); ++ __libc_lock_lock (syslog_lock); ++ + /* Check priority against setlogmask values. */ + if ((LOG_MASK (LOG_PRI (pri)) & LogMask) == 0) +- return; ++ goto out; + + /* Set default facility if none specified. */ + if ((pri & LOG_FACMASK) == 0) +@@ -235,6 +249,9 @@ __vsyslog_internal(int pri, const char * + /* Close the memory stream; this will finalize the data + into a malloc'd buffer in BUF. */ + fclose (f); ++ ++ /* Tell the cancellation handler to free this buffer. */ ++ clarg.buf = buf; + } + + /* Output to stderr if requested. */ +@@ -252,22 +269,10 @@ __vsyslog_internal(int pri, const char * + v->iov_len = 1; + } + +- __libc_cleanup_push (free, buf == failbuf ? NULL : buf); +- + /* writev is a cancellation point. */ + (void)__writev(STDERR_FILENO, iov, v - iov + 1); +- +- __libc_cleanup_pop (0); + } + +- /* Prepare for multiple users. We have to take care: open and +- write are cancellation points. */ +- struct cleanup_arg clarg; +- clarg.buf = buf; +- clarg.oldaction = NULL; +- __libc_cleanup_push (cancel_handler, &clarg); +- __libc_lock_lock (syslog_lock); +- + #ifndef NO_SIGPIPE + /* Prepare for a broken connection. */ + memset (&action, 0, sizeof (action)); +@@ -320,6 +325,7 @@ __vsyslog_internal(int pri, const char * + __sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL); + #endif + ++ out: + /* End of critical section. */ + __libc_cleanup_pop (0); + __libc_lock_unlock (syslog_lock); +@@ -430,8 +436,14 @@ setlogmask (int pmask) + { + int omask; + ++ /* Protect against multiple users. */ ++ __libc_lock_lock (syslog_lock); ++ + omask = LogMask; + if (pmask != 0) + LogMask = pmask; ++ ++ __libc_lock_unlock (syslog_lock); ++ + return (omask); + }