lkml.org 
[lkml]   [2021]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[PATCH v3 08/17] bpf: disable CFI in dispatcher functions
    From
    BPF dispatcher functions are patched at runtime to perform direct
    instead of indirect calls. Disable CFI for the dispatcher functions to
    avoid conflicts.

    Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    ---
    include/linux/bpf.h | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/include/linux/bpf.h b/include/linux/bpf.h
    index cccaef1088ea..9acdca574527 100644
    --- a/include/linux/bpf.h
    +++ b/include/linux/bpf.h
    @@ -635,7 +635,7 @@ struct bpf_dispatcher {
    struct bpf_ksym ksym;
    };

    -static __always_inline unsigned int bpf_dispatcher_nop_func(
    +static __always_inline __nocfi unsigned int bpf_dispatcher_nop_func(
    const void *ctx,
    const struct bpf_insn *insnsi,
    unsigned int (*bpf_func)(const void *,
    @@ -663,7 +663,7 @@ void bpf_trampoline_put(struct bpf_trampoline *tr);
    }

    #define DEFINE_BPF_DISPATCHER(name) \
    - noinline unsigned int bpf_dispatcher_##name##_func( \
    + noinline __nocfi unsigned int bpf_dispatcher_##name##_func( \
    const void *ctx, \
    const struct bpf_insn *insnsi, \
    unsigned int (*bpf_func)(const void *, \
    --
    2.31.0.291.g576ba9dcdaf-goog
    \
     
     \ /
      Last update: 2021-03-23 21:42    [W:3.985 / U:0.140 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site