• D
    bpf: guarantee r1 to be ctx in case of bpf_helper_changes_pkt_data · 04514d13
    Daniel Borkmann 提交于
    Some JITs don't cache skb context on stack in prologue, so when
    LD_ABS/IND is used and helper calls yield bpf_helper_changes_pkt_data()
    as true, then they temporarily save/restore skb pointer. However,
    the assumption that skb always has to be in r1 is a bit of a
    gamble. Right now it turned out to be true for all helpers listed
    in bpf_helper_changes_pkt_data(), but lets enforce that from verifier
    side, so that we make this a guarantee and bail out if the func
    proto is misconfigured in future helpers.
    
    In case of BPF helper calls from cBPF, bpf_helper_changes_pkt_data()
    is completely unrelevant here (since cBPF is context read-only) and
    therefore always false.
    Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
    Acked-by: NAlexei Starovoitov <ast@kernel.org>
    Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
    04514d13
verifier.c 135.1 KB