lkml.org 
[lkml]   [2019]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v6 1/6] x86/uaccess: Allow access_ok() in irq context if pagefault_disabled
Hi Steve,

It seems I missed this message...

On Thu, 21 Mar 2019 22:46:02 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Mon, 18 Mar 2019 15:43:17 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > WARN_ON_IN_IRQ() assumes that the access_ok() and following
> > user memory access can sleep. But this assumption is not
> > always correct; when the pagefault is disabled, following
> > memory access will just returns -EFAULT and never sleep.
> >
> > Add pagefault_disabled() check in WARN_ON_ONCE() so that
> > it can ignore the case we call it with disabling pagefault.
> > For this purpose, this modified pagefault_disabled() as
> > an inline function.
> >
>
> Actually, accessing user space from an interrupt doesn't really make
> sense. Now I'm differentiating a true interrupt (like a device handler)
> from an exception. The difference is that an exception is synchronous
> with the execution of the code, but an interrupt is something where you
> don't know what task is running. A uaccess in this type of interrupt
> will randomly grab some user space memory but have no idea what task is
> running.

I see. Would you mean the title is incorrect?

>
> The one time this makes sense is if you are doing some kind of
> profiling, where the randomness is fine.

Agreed.

>
> I'm curious, what interrupt handler are kprobes executing in that needs
> random user space addresses?

Sorry for confusion. Kprobes is using an exception (of course!). So the
title can mislead, it should be "in exception" instead of "in irq context",
However, current code checks it by "!in_task()", which includes both of
IRQ and exception. A better solution might change it to "in_irq()".

However, I could not find a way to distinguish the "exception" and
"external IRQ" by the execution context (based on the preempt count)
because exception is treated as a kind of IRQ.
Thus, in this patch, I changed it as not only checking what the context
is, but also whether it is appropriately called.


Thank you,


--
Masami Hiramatsu <mhiramat@kernel.org>

\
 
 \ /
  Last update: 2019-05-06 17:22    [W:0.095 / U:5.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site