Pass the actual number of bytes returned by the kernel. Fixes: 33099d72e41c ("linux: Simplify get_nprocs")

(cherry picked from commit fbc7ff5e1a4c70a4cbcbbafdc055e114c0414931)
This commit is contained in:
liqingqing_1229 2022-02-07 15:36:59 +08:00 committed by openeuler-sync-bot
parent a6c650bbf5
commit c0d8fe0932
2 changed files with 37 additions and 2 deletions

View File

@ -66,7 +66,7 @@
##############################################################################
Name: glibc
Version: 2.34
Release: 50
Release: 51
Summary: The GNU libc libraries
License: %{all_license}
URL: http://www.gnu.org/software/glibc/
@ -176,7 +176,7 @@ Patch88: i386-Remove-broken-CAN_USE_REGISTER_ASM_EBP-bug-2877.patch
Patch89: x86-use-default-cache-size-if-it-cannot-be-determine.patch
Patch90: x86-Fix-__wcsncmp_avx2-in-strcmp-avx2.S-BZ-28755.patch
Patch91: x86-Fix-__wcsncmp_evex-in-strcmp-evex.S-BZ-28755.patch
Patch92: fix-CVE-2019-1010023.patch
Patch92: linux-__get_nprocs_sched-do-not-feed-CPU_COUNT_S-wit.patch
Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch
Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch
@ -190,6 +190,7 @@ Patch9008: 0007-add-lowlevellock_2_17_c.patch
Patch9009: 0008-add-pause_nocancel_2_17.patch
Patch9010: 0009-add-unwind-with-longjmp.patch
Patch9011: delete-check-installed-headers-c-and-check-installed.patch
Patch9012: fix-CVE-2019-1010023.patch
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
@ -1278,6 +1279,10 @@ fi
%endif
%changelog
* Mon Feb 7 2022 Qingqing Li <liqingqing3@huawei.com> - 2.34-51
- Pass the actual number of bytes returned by the kernel.
Fixes: 33099d72e41c ("linux: Simplify get_nprocs")
* Fri Jan 28 2022 Yang Yanchao <yangyanchao6@huawei.com> - 2.34-50
- The default debuginfo management mechanism is deleted.
Instead, Use the default macro of RPM.

View File

@ -0,0 +1,30 @@
From 97ba273b505763325efd802dc3a9562dbba79579 Mon Sep 17 00:00:00 2001
From: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Date: Tue, 1 Feb 2022 22:39:02 +0000
Subject: [PATCH] linux: __get_nprocs_sched: do not feed CPU_COUNT_S with
garbage [BZ #28850]
Pass the actual number of bytes returned by the kernel.
Fixes: 33099d72e41c ("linux: Simplify get_nprocs")
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
---
sysdeps/unix/sysv/linux/getsysstats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index 4798cc3..c98c8ce 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -44,7 +44,7 @@ __get_nprocs_sched (void)
int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0, cpu_bits_size,
cpu_bits);
if (r > 0)
- return CPU_COUNT_S (cpu_bits_size, (cpu_set_t*) cpu_bits);
+ return CPU_COUNT_S (r, (cpu_set_t*) cpu_bits);
else if (r == -EINVAL)
/* The input buffer is still not enough to store the number of cpus. This
is an arbitrary values assuming such systems should be rare and there
--
1.8.3.1