diff options
author | Timo Teräs <timo.teras@iki.fi> | 2014-12-04 10:43:32 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2014-12-04 10:44:14 +0200 |
commit | 8f2469e413757e12582b651b24f49b0fb0072a34 (patch) | |
tree | fa5a536a6d34dbce3b62881ec6041d5c48a5ef7a /main/musl/0012-fix-uninitialized-output-from-sched_getaffinity.patch | |
parent | 7086cc9b981d724f4b530ba21a844b602d947d7c (diff) | |
download | aports-8f2469e413757e12582b651b24f49b0fb0072a34.tar.bz2 aports-8f2469e413757e12582b651b24f49b0fb0072a34.tar.xz |
main/musl: cherry-pick fixes and compatibility improvements from upstream
Diffstat (limited to 'main/musl/0012-fix-uninitialized-output-from-sched_getaffinity.patch')
-rw-r--r-- | main/musl/0012-fix-uninitialized-output-from-sched_getaffinity.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/main/musl/0012-fix-uninitialized-output-from-sched_getaffinity.patch b/main/musl/0012-fix-uninitialized-output-from-sched_getaffinity.patch new file mode 100644 index 0000000000..8e99597be3 --- /dev/null +++ b/main/musl/0012-fix-uninitialized-output-from-sched_getaffinity.patch @@ -0,0 +1,39 @@ +From a56e339419c1a90f8a85f86621f3c73945e07b23 Mon Sep 17 00:00:00 2001 +From: Rich Felker <dalias@aerifal.cx> +Date: Tue, 2 Dec 2014 21:54:36 -0500 +Subject: [PATCH] fix uninitialized output from sched_getaffinity + +the sched_getaffinity syscall only fills a cpu set up to the set size +used/supported by the kernel. the rest is left untouched and userspace +is responsible for zero-filling it based on the return value of the +syscall. +--- + src/sched/affinity.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/sched/affinity.c b/src/sched/affinity.c +index 3b40211..737e41b 100644 +--- a/src/sched/affinity.c ++++ b/src/sched/affinity.c +@@ -1,5 +1,6 @@ + #define _GNU_SOURCE + #include <sched.h> ++#include <string.h> + #include "pthread_impl.h" + #include "syscall.h" + +@@ -16,7 +17,10 @@ int pthread_setaffinity_np(pthread_t td, size_t size, const cpu_set_t *set) + int sched_getaffinity(pid_t tid, size_t size, cpu_set_t *set) + { + long ret = __syscall(SYS_sched_getaffinity, tid, size, set); +- if (ret > 0) ret = 0; ++ if (ret > 0) { ++ if (ret < size) memset((char *)set+ret, 0, size-ret); ++ ret = 0; ++ } + return __syscall_ret(ret); + } + +-- +2.2.0 + |