summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Wellving <andreas.wellving@enea.com>2018-10-26 13:33:46 +0200
committerAndreas Wellving <andreas.wellving@enea.com>2018-10-26 13:33:46 +0200
commita8c6ff94fd3905f1a35a189b510aac1bfddc883a (patch)
treeb0d350314c0b8881af20651b05e6d72fd6bf7328
parent8675d0d71e339e0933de5aa1b354b74d8ce59d97 (diff)
downloadenea-kernel-cache-a8c6ff94fd3905f1a35a189b510aac1bfddc883a.tar.gz
perf/core: CVE-2017-18255
perf/core: Fix the perf_cpu_time_max_percent check Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.9.y&id=0f8a75e90963019cef486565f2b088bb570a7ddb Change-Id: I1131173ce5a1cf3fec8333a9631cac713f839621 Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
-rw-r--r--patches/cve/4.9.x.scc3
-rw-r--r--patches/cve/CVE-2017-18255-perf-core-Fix-the-perf_cpu_time_max_percent-check.patch53
2 files changed, 56 insertions, 0 deletions
diff --git a/patches/cve/4.9.x.scc b/patches/cve/4.9.x.scc
index 491ffe4..e4346d5 100644
--- a/patches/cve/4.9.x.scc
+++ b/patches/cve/4.9.x.scc
@@ -9,3 +9,6 @@ SRC_URI += "file://CVE-2018-1108-random-fix-crng_ready-test.patch"
9 9
10#CVEs fixed in 4.9.98: 10#CVEs fixed in 4.9.98:
11SRC_URI += "file://CVE-2018-9415-ARM-amba-Fix-race-condition-with-driver_override.patch" 11SRC_URI += "file://CVE-2018-9415-ARM-amba-Fix-race-condition-with-driver_override.patch"
12
13#CVEs fixed in 4.9.99:
14SRC_URI += "file://CVE-2017-18255-perf-core-Fix-the-perf_cpu_time_max_percent-check.patch"
diff --git a/patches/cve/CVE-2017-18255-perf-core-Fix-the-perf_cpu_time_max_percent-check.patch b/patches/cve/CVE-2017-18255-perf-core-Fix-the-perf_cpu_time_max_percent-check.patch
new file mode 100644
index 0000000..b7e14e2
--- /dev/null
+++ b/patches/cve/CVE-2017-18255-perf-core-Fix-the-perf_cpu_time_max_percent-check.patch
@@ -0,0 +1,53 @@
1From 0f8a75e90963019cef486565f2b088bb570a7ddb Mon Sep 17 00:00:00 2001
2From: Tan Xiaojun <tanxiaojun@huawei.com>
3Date: Thu, 23 Feb 2017 14:04:39 +0800
4Subject: [PATCH] perf/core: Fix the perf_cpu_time_max_percent check
5
6commit 1572e45a924f254d9570093abde46430c3172e3d upstream.
7
8Use "proc_dointvec_minmax" instead of "proc_dointvec" to check the input
9value from user-space.
10
11If not, we can set a big value and some vars will overflow like
12"sysctl_perf_event_sample_rate" which will cause a lot of unexpected
13problems.
14
15CVE: CVE-2017-18255
16Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.9.y&id=0f8a75e90963019cef486565f2b088bb570a7ddb]
17
18Signed-off-by: Tan Xiaojun <tanxiaojun@huawei.com>
19Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
20Cc: <acme@kernel.org>
21Cc: <alexander.shishkin@linux.intel.com>
22Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
23Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
24Cc: Jiri Olsa <jolsa@redhat.com>
25Cc: Linus Torvalds <torvalds@linux-foundation.org>
26Cc: Peter Zijlstra <peterz@infradead.org>
27Cc: Stephane Eranian <eranian@google.com>
28Cc: Thomas Gleixner <tglx@linutronix.de>
29Cc: Vince Weaver <vincent.weaver@maine.edu>
30Link: http://lkml.kernel.org/r/1487829879-56237-1-git-send-email-tanxiaojun@huawei.com
31Signed-off-by: Ingo Molnar <mingo@kernel.org>
32Cc: Guenter Roeck <linux@roeck-us.net>
33Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
34Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
35---
36 kernel/events/core.c | 2 +-
37 1 file changed, 1 insertion(+), 1 deletion(-)
38
39diff --git a/kernel/events/core.c b/kernel/events/core.c
40index b1d6b9888fba..cbc51826cb94 100644
41--- a/kernel/events/core.c
42+++ b/kernel/events/core.c
43@@ -453,7 +453,7 @@ int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,
44 void __user *buffer, size_t *lenp,
45 loff_t *ppos)
46 {
47- int ret = proc_dointvec(table, write, buffer, lenp, ppos);
48+ int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
49
50 if (ret || !write)
51 return ret;
52
53