• Maciej Fijalkowski's avatar
    bpf: propagate poke descriptors to subprograms · a748c697
    Maciej Fijalkowski authored
    Previously, there was no need for poke descriptors being present in
    subprogram's bpf_prog_aux struct since tailcalls were simply not allowed
    in them. Each subprog is JITed independently so in order to enable
    JITing subprograms that use tailcalls, do the following:
    
    - in fixup_bpf_calls() store the index of tailcall insn onto the generated
      poke descriptor,
    - in case when insn patching occurs, adjust the tailcall insn idx from
      bpf_patch_insn_data,
    - then in jit_subprogs() check whether the given poke descriptor belongs
      to the current subprog by checking if that previously stored absolute
      index of tail call insn is in the scope of the insns of given subprog,
    - update the insn->imm with new poke descriptor slot so that while JITing
      the proper poke descriptor will be grabbed
    
    This way each of the main program's poke descriptors are distributed
    across the subprograms poke descriptor array, so main program's
    descriptors can be untracked out of the prog array map.
    
    Add also subprog's aux struct to the BPF map poke_progs list by calling
    on it map_poke_track().
    
    In case of any error, call the map_poke_untrack() on subprog's aux
    structs that have already been registered to prog array map.
    Signed-off-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    a748c697
verifier.c 332 KB