[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190215191949.04604191@gandalf.local.home>
Date: Fri, 15 Feb 2019 19:19:49 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Andy Lutomirski <luto@...capital.net>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
stable <stable@...r.kernel.org>,
Changbin Du <changbin.du@...il.com>,
Jann Horn <jannh@...gle.com>,
Kees Cook <keescook@...omium.org>,
Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH 1/2 v2] kprobe: Do not use uaccess functions to access
kernel memory that can fault
On Fri, 15 Feb 2019 15:49:35 -0800
Andy Lutomirski <luto@...capital.net> wrote:
> I’m missing most of the context here, but even probe_kernel_...() is
> unwise for a totally untrustworthy address. It could be MMIO, for
> example.
True, but kprobes are used like modules, and only allowed by root. They
are used to poke literally anywhere one wants. That's the entire
purpose of kprobes.
>
> If needed, we could come up with a safe-ish helper for tracing. For
> direct-map addresses, probe_kernel_...() is probably okay. Same for
> the current stack. Otherwise we could walk the page tables and check
> that the address is cacheable, I suppose, although this is slightly
> dubious if we don’t also check MTRRs. We could also check that the PA
> is in main memory, I suppose, although this may have unfortunate
> interactions with the MCE code.
I added you just because I wanted help getting the change log correct,
as that's what Linus was complaining about. I kept using "kernel
address" when the sample bug used for the patch was really a
non-canonical address (as Linus said, it's just garbage. Neither kernel
or user space). But I pointed out that this can also bug if the
address is canonical and in the kernel address space. The old code
didn't complain about non-canonical or kernel address faulting before
commit 9da3f2b7405, which only talks about kernel address space
faulting (which is why I only mentioned that in my messages).
Would changing all the mention of "kernel address" to "non user space"
be accurate?
For reference:
http://lkml.kernel.org/r/20190215174945.557218316@goodmis.org
http://lkml.kernel.org/r/20190215142015.860423791@goodmis.org
-- Steve
Powered by blists - more mailing lists