• Jesper Dangaard Brouer's avatar
    xdp: avoid leaking info stored in frame data on page reuse · 6dfb970d
    Jesper Dangaard Brouer authored
    The bpf infrastructure and verifier goes to great length to avoid
    bpf progs leaking kernel (pointer) info.
    
    For queueing an xdp_buff via XDP_REDIRECT, xdp_frame info stores
    kernel info (incl pointers) in top part of frame data (xdp->data_hard_start).
    Checks are in place to assure enough headroom is available for this.
    
    This info is not cleared, and if the frame is reused, then a
    malicious user could use bpf_xdp_adjust_head helper to move
    xdp->data into this area.  Thus, making this area readable.
    
    This is not super critical as XDP progs requires root or
    CAP_SYS_ADMIN, which are privileged enough for such info.  An
    effort (is underway) towards moving networking bpf hooks to the
    lesser privileged mode CAP_NET_ADMIN, where leaking such info
    should be avoided.  Thus, this patch to clear the info when
    needed.
    Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    6dfb970d
filter.c 149 KB