Hi Alexei,
On 6/18/21 10:04 PM, Alexei Starovoitov wrote:
On Wed, Jun 16, 2021 at 11:58 PM Ravi Bangoria
<ravi.bangoria@xxxxxxxxxxxxx> wrote:
$ dmesg
[ 166.864325] BUG: unable to handle page fault for address: 0000000000d12345
[ 166.864336] #PF: supervisor read access in kernel mode
[ 166.864338] #PF: error_code(0x0000) - not-present page
0xd12345 is unallocated userspace address. Similarly, I also tried with
that's unfortunately expected, since this is a user address.
Sure. fwiw, it works with bpf_probe_read().
p->dte = (void *)0xffffffffc1234567 after confirming it's not allocated
to kernel or any module address. I see the same failure with it too.
This one is surprising though. Sounds like a bug in exception table
construction. Can you debug it to see what's causing it?
First check that do_kern_addr_fault() is invoked in this case.
And then fixup_exception() and why search_bpf_extables()
cannot find it.
It seems the commit 4c5de127598e1 ("bpf: Emit explicit NULL pointer checks
for PROBE_LDX instructions.") added few instructions before actual load
but does not consider those additional instruction while calculating
extable offset. Let me prepare a fix.
Separately we probably need to replace the NULL check
with addr >= TASK_SIZE_MAX to close this issue though it's a bit artificial.
Ravi