public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Dmitry Levin <ldv@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/release/2.35/master] linux: __get_nprocs_sched: do not feed CPU_COUNT_S with garbage [BZ #28850] Date: Thu, 3 Feb 2022 12:26:19 +0000 (GMT) [thread overview] Message-ID: <20220203122619.5081F385AC19@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a2f1675634b3513c09c38e55e6766e8c05768b1f commit a2f1675634b3513c09c38e55e6766e8c05768b1f Author: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org> Date: Tue Feb 1 22:39:02 2022 +0000 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> (cherry picked from commit 97ba273b505763325efd802dc3a9562dbba79579) Diff: --- NEWS | 1 + sysdeps/unix/sysv/linux/getsysstats.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index b1aae94cfb..d1602051d1 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ Version 2.35.1 The following bugs are resolved with this release: + [28850] linux: __get_nprocs_sched reads uninitialized memory from the stack [28853] libc: tst-spawn6 changes current foreground process group (breaks test isolation) diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c index 4798cc337e..c98c8ce3d4 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
reply other threads:[~2022-02-03 12:26 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220203122619.5081F385AC19@sourceware.org \ --to=ldv@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).