Re: [RFC][PATCH] x86/mm: Sync all vmalloc mappings before text_poke()

From: Joerg Roedel
Date: Thu Apr 30 2020 - 15:14:40 EST


On Thu, Apr 30, 2020 at 12:11:36PM -0400, Steven Rostedt wrote:
> bool trace_event_ignore_this_pid(struct trace_event_file *trace_file)
> {
> struct trace_array *tr = trace_file->tr;
> struct trace_array_cpu *data;
> struct trace_pid_list *no_pid_list;
> struct trace_pid_list *pid_list;
>
> pid_list = rcu_dereference_raw(tr->filtered_pids);
> no_pid_list = rcu_dereference_raw(tr->filtered_no_pids);
>
> if (!pid_list && !no_pid_list)
> return false;
>
> data = this_cpu_ptr(tr->array_buffer.data);
>
> return data->ignore_pid;
> }
>
> [...]
>
> tl;dr; It's not an issue with the vmalloc, it's an issue with per_cpu
> allocations!

Yes, looks like you are right, it faults on the return statement, so the
data-pointer seems not to be mapped. I looked at another instance:

The trapping instruction is:

movzbl 0x7c(%rax),%eax

Which is a pointer-dereference, with %rax=0xffffe8ffffccc870. The 'data'
pointer is allocated with alloc_percpu().

And alloc_percpu() calls down into pcpu_alloc(), which allocates new
percpu chunks using vmalloc() on x86. And there we are again in the
vmalloc area.

Regards,

Joerg