mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Tan Xiaojun <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tanxiaojun@huawei.com, acme@kernel.org, peterz@infradead.org,
	torvalds@linux-foundation.org, tglx@linutronix.de,
	vincent.weaver@maine.edu, eranian@google.com,
	linux-kernel@vger.kernel.org, acme@redhat.com, hpa@zytor.com,
	mingo@kernel.org, jolsa@redhat.com,
	alexander.shishkin@linux.intel.com
Subject: [tip:perf/urgent] perf/core: Fix the perf_cpu_time_max_percent check
Date: Fri, 24 Feb 2017 01:15:30 -0800	[thread overview]
Message-ID: <tip-1572e45a924f254d9570093abde46430c3172e3d@git.kernel.org> (raw)
In-Reply-To: <1487829879-56237-1-git-send-email-tanxiaojun@huawei.com>

Commit-ID:  1572e45a924f254d9570093abde46430c3172e3d
Gitweb:     http://git.kernel.org/tip/1572e45a924f254d9570093abde46430c3172e3d
Author:     Tan Xiaojun <tanxiaojun@huawei.com>
AuthorDate: Thu, 23 Feb 2017 14:04:39 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 24 Feb 2017 08:56:33 +0100

perf/core: Fix the perf_cpu_time_max_percent check

Use "proc_dointvec_minmax" instead of "proc_dointvec" to check the input
value from user-space.

If not, we can set a big value and some vars will overflow like
"sysctl_perf_event_sample_rate" which will cause a lot of unexpected
problems.

Signed-off-by: Tan Xiaojun <tanxiaojun@huawei.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: <acme@kernel.org>
Cc: <alexander.shishkin@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: http://lkml.kernel.org/r/1487829879-56237-1-git-send-email-tanxiaojun@huawei.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index d4e3f8d..c1c1cdf 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -455,7 +455,7 @@ int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,
 				void __user *buffer, size_t *lenp,
 				loff_t *ppos)
 {
-	int ret = proc_dointvec(table, write, buffer, lenp, ppos);
+	int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
 
 	if (ret || !write)
 		return ret;

  reply	other threads:[~2017-02-24  9:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-23  6:04 [PATCH] perf/core: Fix to check perf_cpu_time_max_percent Tan Xiaojun
2017-02-24  9:15 ` tip-bot for Tan Xiaojun [this message]
2017-02-25  8:10   ` [tip:perf/urgent] perf/core: Fix the perf_cpu_time_max_percent check Tan Xiaojun
2017-02-25  9:51     ` Peter Zijlstra
2017-02-27  0:36       ` Tan Xiaojun
2017-03-13 18:35       ` Vince Weaver
2017-03-14  1:52         ` Tan Xiaojun
2017-04-15  7:58       ` [BUG arm64] OOPS when using /proc/kcore to disassemble the kernel symbols in "perf top" Tan Xiaojun

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=tip-1572e45a924f254d9570093abde46430c3172e3d@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tanxiaojun@huawei.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=vincent.weaver@maine.edu \
    /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: link
Be 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

Powered by JetHome