Thread (10 messages) flat view 10 messages, 5 authors, 2021-11-05

Re: [PATCH v4 bpf-next 1/2] bpf: introduce helper bpf_find_vma

From: Yonghong Song <hidden>
Date: 2021-11-04 23:28:26
Also in: bpf


On 11/4/21 2:31 PM, Song Liu wrote:
In some profiler use cases, it is necessary to map an address to the
backing file, e.g., a shared library. bpf_find_vma helper provides a
flexible way to achieve this. bpf_find_vma maps an address of a task to
the vma (vm_area_struct) for this address, and feed the vma to an callback
BPF function. The callback function is necessary here, as we need to
ensure mmap_sem is unlocked.

It is necessary to lock mmap_sem for find_vma. To lock and unlock mmap_sem
safely when irqs are disable, we use the same mechanism as stackmap with
build_id. Specifically, when irqs are disabled, the unlocked is postponed
in an irq_work. Refactor stackmap.c so that the irq_work is shared among
bpf_find_vma and stackmap helpers.

Reported-by: kernel test robot <redacted>
You don't need the above "Reported-by".
Signed-off-by: Song Liu <redacted>
LGTM.

Acked-by: Yonghong Song <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help