• Gianluca Borello's avatar
    bpf: split check_mem_access logic for map values · dbcfe5f7
    Gianluca Borello authored
    Move the logic to check memory accesses to a PTR_TO_MAP_VALUE_ADJ from
    check_mem_access() to a separate helper check_map_access_adj(). This
    enables to use those checks in other parts of the verifier as well,
    where boundaries on PTR_TO_MAP_VALUE_ADJ might need to be checked, for
    example when checking helper function arguments. The same thing is
    already happening for other types such as PTR_TO_PACKET and its
    check_packet_access() helper.
    
    The code has been copied verbatim, with the only difference of removing
    the "off += reg->max_value" statement and moving the sum into the call
    statement to check_map_access(), as that was only needed due to the
    earlier common check_map_access() call.
    Signed-off-by: default avatarGianluca Borello <g.borello@gmail.com>
    Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    dbcfe5f7
verifier.c 93.2 KB