Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\core.c Create Date:2022-07-28 12:47:51
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:bpf_patch_insn_single

Proto:struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, const struct bpf_insn *patch, u32 len)

Type:struct bpf_prog

Parameter:

TypeParameterName
struct bpf_prog *prog
u32off
const struct bpf_insn *patch
u32len
437  insn_delta = len - 1
438  cnt_max = S16_MAX
443  If insn_delta == 0 Then
444  No 3D Now!(insnsi + off, patch, size of patch )
445  Return prog
448  insn_adj_cnt = Number of filter blocks + insn_delta
455  If insn_adj_cnt > cnt_max && (err = bpf_adj_branches(prog, off, off + 1, off + len, true)) Then Return ERR_PTR(err)
463  prog_adj = bpf_prog_realloc(prog, bpf_prog_size(insn_adj_cnt), GFP_USER)
465  If Not prog_adj Then Return ERR_PTR( - ENOMEM)
468  Number of filter blocks = insn_adj_cnt
478  insn_rest = insn_adj_cnt - off - len
480  memmove(insnsi + off + len, insnsi + off + 1, size of patch * insn_rest)
482  No 3D Now!(insnsi + off, patch, size of patch * len)
488  BUG_ON(bpf_adj_branches(prog_adj, off, off + 1, off + len, false))
490  bpf_adj_linfo(prog_adj, off, insn_delta)
492  Return prog_adj
Caller
NameDescribe
bpf_patch_insn_data