Re: [PATCH bpf-next] libbpf: Allow kprobe attach using legacy debugfs interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, Andrii

On 2022/3/30 7:18 AM, Andrii Nakryiko wrote:
> On Sat, Mar 26, 2022 at 7:43 AM Hengqi Chen <hengqi.chen@xxxxxxxxx> wrote:
>>
>> On some old kernels, kprobe auto-attach may fail when attach to symbols
>> like udp_send_skb.isra.52 . This is because the kernel has kprobe PMU
>> but don't allow attach to a symbol with '.' ([0]). Add a new option to
>> bpf_kprobe_opts to allow using the legacy kprobe attach directly.
>> This way, users can use bpf_program__attach_kprobe_opts in a dedicated
>> custom sec handler to handle such case.
>>
>>   [0]: https://github.com/torvalds/linux/blob/v4.18/kernel/trace/trace_kprobe.c#L340-L343
>>
>> Signed-off-by: Hengqi Chen <hengqi.chen@xxxxxxxxx>
>> ---
> 
> It's sad, but it makes sense. But, let's have a selftests that
> validates uses legacy option explicitly (e.g., in
> prog_tests/attach_probe.c). Also, let's fix this limitation in the

OK, will add a selftest to exercise the new option.

> kernel? It makes no sense to limit attaching to a proper kallsym
> symbol.

This limitation is lifted in newer kernel. Kernel v5.4 don't have this issue.

> 
>>  tools/lib/bpf/libbpf.c | 9 ++++++++-
>>  tools/lib/bpf/libbpf.h | 4 +++-
>>  2 files changed, 11 insertions(+), 2 deletions(-)
>>
> 
> [...]

--
Hengqi



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux