[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQ+oH6MsP=TKU2kStj0SPqeXf1D=+MpMqrnuqGWdMPS70Q@mail.gmail.com>
Date: Sat, 23 Nov 2019 17:24:32 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
Network Development <netdev@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, Andrii Nakryiko <andriin@...com>
Subject: Re: [PATCH bpf-next] bpf: simplify __bpf_arch_text_poke poke type handling
On Sat, Nov 23, 2019 at 4:39 PM Daniel Borkmann <daniel@...earbox.net> 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@...com>
> Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
Applied. Thanks
Powered by blists - more mailing lists