• Andrii Nakryiko's avatar
    bpf: reorganize struct bpf_reg_state fields · a73bf9f2
    Andrii Nakryiko authored
    Move id and ref_obj_id fields after scalar data section (var_off and
    ranges). This is necessary to simplify next patch which will change
    regsafe()'s logic to be safer, as it makes the contents that has to be
    an exact match (type-specific parts, off, type, and var_off+ranges)
    a single sequential block of memory, while id and ref_obj_id should
    always be remapped and thus can't be memcp()'ed.
    
    There are few places that assume that var_off is after id/ref_obj_id to
    clear out id/ref_obj_id with the single memset(0). These are changed to
    explicitly zero-out id/ref_obj_id fields. Other places are adjusted to
    preserve exact byte-by-byte comparison behavior.
    
    No functional changes.
    Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/r/20221223054921.958283-3-andrii@kernel.orgSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    a73bf9f2
verifier.c 494 KB