• Yafang Shao's avatar
    bpftool: Show kprobe_multi link info · edd7f49b
    Yafang Shao authored
    Show the already expose kprobe_multi link info in bpftool. The result as
    follows,
    
    $ tools/bpf/bpftool/bpftool link show
    91: kprobe_multi  prog 244
            kprobe.multi  func_cnt 7
            addr             func [module]
            ffffffff98c44f20 schedule_timeout_interruptible
            ffffffff98c44f60 schedule_timeout_killable
            ffffffff98c44fa0 schedule_timeout_uninterruptible
            ffffffff98c44fe0 schedule_timeout_idle
            ffffffffc075b8d0 xfs_trans_get_efd [xfs]
            ffffffffc0768a10 xfs_trans_get_buf_map [xfs]
            ffffffffc076c320 xfs_trans_get_dqtrx [xfs]
            pids kprobe_multi(188367)
    92: kprobe_multi  prog 244
            kretprobe.multi  func_cnt 7
            addr             func [module]
            ffffffff98c44f20 schedule_timeout_interruptible
            ffffffff98c44f60 schedule_timeout_killable
            ffffffff98c44fa0 schedule_timeout_uninterruptible
            ffffffff98c44fe0 schedule_timeout_idle
            ffffffffc075b8d0 xfs_trans_get_efd [xfs]
            ffffffffc0768a10 xfs_trans_get_buf_map [xfs]
            ffffffffc076c320 xfs_trans_get_dqtrx [xfs]
            pids kprobe_multi(188367)
    
    $ tools/bpf/bpftool/bpftool link show -j
    [{"id":91,"type":"kprobe_multi","prog_id":244,"retprobe":false,"func_cnt":7,"funcs":[{"addr":18446744071977586464,"func":"schedule_timeout_interruptible","module":null},{"addr":18446744071977586528,"func":"schedule_timeout_killable","module":null},{"addr":18446744071977586592,"func":"schedule_timeout_uninterruptible","module":null},{"addr":18446744071977586656,"func":"schedule_timeout_idle","module":null},{"addr":18446744072643524816,"func":"xfs_trans_get_efd","module":"xfs"},{"addr":18446744072643578384,"func":"xfs_trans_get_buf_map","module":"xfs"},{"addr":18446744072643592992,"func":"xfs_trans_get_dqtrx","module":"xfs"}],"pids":[{"pid":188367,"comm":"kprobe_multi"}]},{"id":92,"type":"kprobe_multi","prog_id":244,"retprobe":true,"func_cnt":7,"funcs":[{"addr":18446744071977586464,"func":"schedule_timeout_interruptible","module":null},{"addr":18446744071977586528,"func":"schedule_timeout_killable","module":null},{"addr":18446744071977586592,"func":"schedule_timeout_uninterruptible","module":null},{"addr":18446744071977586656,"func":"schedule_timeout_idle","module":null},{"addr":18446744072643524816,"func":"xfs_trans_get_efd","module":"xfs"},{"addr":18446744072643578384,"func":"xfs_trans_get_buf_map","module":"xfs"},{"addr":18446744072643592992,"func":"xfs_trans_get_dqtrx","module":"xfs"}],"pids":[{"pid":188367,"comm":"kprobe_multi"}]}]
    
    When kptr_restrict is 2, the result is,
    
    $ tools/bpf/bpftool/bpftool link show
    91: kprobe_multi  prog 244
            kprobe.multi  func_cnt 7
    92: kprobe_multi  prog 244
            kretprobe.multi  func_cnt 7
    Signed-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
    Reviewed-by: default avatarQuentin Monnet <quentin@isovalent.com>
    Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
    Link: https://lore.kernel.org/r/20230709025630.3735-4-laoar.shao@gmail.comSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    edd7f49b
link.c 16.2 KB