Re: [PATCH bpf-next] bpf: simplify __bpf_arch_text_poke poke type handling

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

 



On Sat, Nov 23, 2019 at 4:39 PM Daniel Borkmann <daniel@xxxxxxxxxxxxx> wrote:
>
> Given that we have BPF_MOD_NOP_TO_{CALL,JUMP}, BPF_MOD_{CALL,JUMP}_TO_NOP
> and BPF_MOD_{CALL,JUMP}_TO_{CALL,JUMP} poke types and that we also pass in
> old_addr as well as new_addr, it's a bit redundant and unnecessarily
> complicates __bpf_arch_text_poke() itself since we can derive the same from
> the *_addr that were passed in. Hence simplify and use BPF_MOD_{CALL,JUMP}
> as types which also allows to clean up call-sites.
>
> In addition to that, __bpf_arch_text_poke() currently verifies that text
> matches expected old_insn before we invoke text_poke_bp(). Also add a check
> on new_insn and skip rewrite if it already matches. Reason why this is rather
> useful is that it avoids making any special casing in prog_array_map_poke_run()
> when old and new prog were NULL and has the benefit that also for this case
> we perform a check on text whether it really matches our expectations.
>
> Suggested-by: Andrii Nakryiko <andriin@xxxxxx>
> Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>

Applied. Thanks



[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