From: Peter Zijlstra <peterz@infradead.org>
To: Dave Hansen <dave@sr71.net>
Cc: linux-kernel@vger.kernel.org, dave.hansen@linux.intel.com,
x86@kernel.org, paulus@samba.org, acme@kernel.org,
jkenisto@us.ibm.com, srikar@linux.vnet.ibm.com,
tglx@linutronix.de, ananth@in.ibm.com,
anil.s.keshavamurthy@intel.com, davem@davemloft.net,
masami.hiramatsu.pt@hitachi.com
Subject: Re: [PATCH] x86: remove arbitrary instruction size limit in instruction decoder
Date: Thu, 13 Nov 2014 02:43:20 +0100 [thread overview]
Message-ID: <20141113014320.GR29390@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20141112225352.D49917A8@viggo.jf.intel.com>
On Wed, Nov 12, 2014 at 02:53:52PM -0800, Dave Hansen wrote:
> We shouldn't simply error out when we get short copy_from_user*()
> results from userspace (like intel_pmu_pebs_fixup_ip() does
> currently). It is perfectly valid to be executing an instruction
> within MAX_INSN_SIZE bytes of an unreadable page. We should be
> able to gracefully handle short reads in those cases.
> diff -puN arch/x86/kernel/cpu/perf_event_intel_ds.c~x86-insn-decoder-remove-arbitrary-limit arch/x86/kernel/cpu/perf_event_intel_ds.c
> --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c~x86-insn-decoder-remove-arbitrary-limit 2014-11-12 12:45:52.954753152 -0800
> +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c 2014-11-12 12:45:52.970753874 -0800
> @@ -758,11 +759,12 @@ static int intel_pmu_pebs_fixup_ip(struc
> return 1;
> }
>
> + size = ip - to;
> if (!kernel_ip(ip)) {
> - int size, bytes;
> + int bytes;
> u8 *buf = this_cpu_read(insn_buffer);
>
> - size = ip - to; /* Must fit our buffer, see above */
> + /* 'size' must fit our buffer, see above */
> bytes = copy_from_user_nmi(buf, (void __user *)to, size);
> if (bytes != 0)
> return 0;
Right, so we should better deal with short copies there. Should be
doable.
next prev parent reply other threads:[~2014-11-13 1:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 22:53 Dave Hansen
2014-11-13 1:43 ` Peter Zijlstra [this message]
2014-11-13 14:49 ` Masami Hiramatsu
2014-11-17 20:49 ` Dave Hansen
2014-11-17 22:16 ` Masami Hiramatsu
2014-11-14 0:20 ` Jim Keniston
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=20141113014320.GR29390@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=ananth@in.ibm.com \
--cc=anil.s.keshavamurthy@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=dave@sr71.net \
--cc=davem@davemloft.net \
--cc=jkenisto@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=paulus@samba.org \
--cc=srikar@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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: 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