Thread (26 messages) 26 messages, 7 authors, 2021-01-29

Re: [PATCH bpf] x86/bpf: handle bpf-program-triggered exceptions properly

From: Andy Lutomirski <luto@kernel.org>
Date: 2021-01-29 00:48:44

On Thu, Jan 28, 2021 at 4:41 PM Alexei Starovoitov
[off-list ref] wrote:
On Thu, Jan 28, 2021 at 04:29:51PM -0800, Andy Lutomirski wrote:
quoted
BPF generated a NULL pointer dereference (where NULL is a user
pointer) and expected it to recover cleanly. What exactly am I
supposed to debug?  IMO the only thing wrong with the x86 code is that
it doesn't complain more loudly.  I will fix that, too.
are you saying that NULL is a _user_ pointer?!
It's NULL. All zeros.
probe_read_kernel(NULL) was returning EFAULT on it and should continue doing so.
probe_read_kernel() does not exist.  get_kernel_nofault() returns -ERANGE.

And yes, NULL is a user pointer.  I can write you a little Linux
program that maps some real valid data at user address 0.  As I noted
when I first analyzed this bug, because NULL is a user address, bpf is
incorrectly triggering the *user* fault handling code, and that code
is objecting.

I propose the following fix to the x86 code.  I'll send it as a real
patch tomorrow.

https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/commit/?h=x86/fixes&id=f61282777772f375bba7130ae39ccbd7e83878b2

--Andy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help