• Daniel Borkmann's avatar
    bpf: restrict map value pointer arithmetic for unprivileged · 0d6303db
    Daniel Borkmann authored
    Restrict map value pointer arithmetic for unprivileged users in that
    arithmetic itself must not go out of bounds as opposed to the actual
    access later on. Therefore after each adjust_ptr_min_max_vals() with a
    map value pointer as a destination it will simulate a check_map_access()
    of 1 byte on the destination and once that fails the program is rejected
    for unprivileged program loads. We use this later on for masking any
    pointer arithmetic with the remainder of the map value space. The
    likelihood of breaking any existing real-world unprivileged eBPF
    program is very small for this corner case.
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    0d6303db
verifier.c 203 KB