330b961e66
Upstream commit: 4ed990e5b97a61f29f929bdeb36c5b2abb547a64 - Add MADV_POPULATE_READ and MADV_POPULATE_WRITE from Linux 5.14 to bits/mman-linux.h - Update kernel version to 5.14 in tst-mman-consts.py - Update syscall lists for Linux 5.14 - Use Linux 5.14 in build-many-glibcs.py - Fix failing nss/tst-nss-files-hosts-long with local resolver - iconvconfig: Fix behaviour with --prefix [BZ #28199] - nptl: Fix race between pthread_kill and thread exit (swbz#12889, #1994068) - nptl: pthread_kill, pthread_cancel should not fail after exit (swbz#19193, #1994068) - support: Add support_wait_for_thread_exit - MIPS: Setup errno for {f,l,}xstat - x86-64: Use testl to check __x86_string_control - elf: Fix missing colon in LD_SHOW_AUXV output (swbz#28253, #1995648) - librt: add test (swbz#28213, #1994264) - CVE-2021-38604: fix NULL pointer dereference in mq_notify (swbz#28213, #1994264) - Linux: Fix fcntl, ioctl, prctl redirects for _TIME_BITS=64 (bug 28182) - iconv_charmap: Close output file when done - copy_and_spawn_sgid: Avoid double calls to close() - gaiconf_init: Avoid double-free in label and precedence lists - gconv_parseconfdir: Fix memory leak - ldconfig: avoid leak on empty paths in config file
36 lines
1.6 KiB
Diff
36 lines
1.6 KiB
Diff
commit 79474303223c5665bec75ffbdb2a86ee04a2514b
|
|
Author: Nikita Popov <npv1310@gmail.com>
|
|
Date: Mon Aug 9 20:17:34 2021 +0530
|
|
|
|
librt: fix NULL pointer dereference (bug 28213)
|
|
|
|
Helper thread frees copied attribute on NOTIFY_REMOVED message
|
|
received from the OS kernel. Unfortunately, it fails to check whether
|
|
copied attribute actually exists (data.attr != NULL). This worked
|
|
earlier because free() checks passed pointer before actually
|
|
attempting to release corresponding memory. But
|
|
__pthread_attr_destroy assumes pointer is not NULL.
|
|
|
|
So passing NULL pointer to __pthread_attr_destroy will result in
|
|
segmentation fault. This scenario is possible if
|
|
notification->sigev_notify_attributes == NULL (which means default
|
|
thread attributes should be used).
|
|
|
|
Signed-off-by: Nikita Popov <npv1310@gmail.com>
|
|
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
(cherry picked from commit b805aebd42364fe696e417808a700fdb9800c9e8)
|
|
|
|
diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
|
|
index 9799dcdaa479a1d5..eccae2e4c6cdfefa 100644
|
|
--- a/sysdeps/unix/sysv/linux/mq_notify.c
|
|
+++ b/sysdeps/unix/sysv/linux/mq_notify.c
|
|
@@ -131,7 +131,7 @@ helper_thread (void *arg)
|
|
to wait until it is done with it. */
|
|
(void) __pthread_barrier_wait (¬ify_barrier);
|
|
}
|
|
- else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED)
|
|
+ else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED && data.attr != NULL)
|
|
{
|
|
/* The only state we keep is the copy of the thread attributes. */
|
|
__pthread_attr_destroy (data.attr);
|