函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\verifier.c Create Date:2022-07-27 14:10:54
Last Modify:2022-05-19 20:02:10 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__mark_chain_precision

函数原型:static int __mark_chain_precision(struct bpf_verifier_env *env, int regno, int spi)

返回类型:int

参数:

类型参数名称
struct bpf_verifier_env *env
intregno
intspi
1730  st等于current verifier state
1731  first_idx等于 first and last insn idx of this verifier state
1732  last_idx等于insn_idx
1735  reg_mask等于如果regno大于等于0则1u左移regno位否则0
1736  stack_mask等于如果spi大于等于0则1ull左移spi位否则0
1737  bool skip_first = true
1738  bool new_marks = false
1741  如果非allow_ptr_leaks则返回:0
1745  func等于 call stack tracking [curframe]
1746  如果regno大于等于0则
1747  reg等于regs[regno]
1749  WARN_ONCE(1, "backtracing misuse")
1750  返回:负EFAULT
1752  如果非 if (!precise && SCALAR_VALUE) min/max/tnum don't affect safety new_marks = true
1754  否则reg_mask等于0
1756  if (!precise && SCALAR_VALUE) min/max/tnum don't affect safety = true
1759 spi大于等于0循环
1760  如果slot_type[0]不等于 register spilled into stack
1761  stack_mask等于0
1762  退出
1764  reg等于spilled_ptr
1766  stack_mask等于0
1767  退出
1769  如果非 if (!precise && SCALAR_VALUE) min/max/tnum don't affect safety new_marks = true
1771  否则stack_mask等于0
1773  if (!precise && SCALAR_VALUE) min/max/tnum don't affect safety = true
1774  退出
1777  如果非new_marks则返回:0
1779  如果非reg_mask且非stack_mask则返回:0
1781  循环
1782  DECLARE_BITMAP(mask, 64)
1783  history等于jmp_history_cnt
1785  如果level按位与BPF_LOG_LEVELverbose(env, "last_idx %d first_idx %d\n", last_idx, first_idx)
1787  循环
1788  如果skip_first
1789  err等于0
1790  skip_first = false
1791  否则
1794  如果err恒等于负Operation is not supported
1797  否则如果err
1798  返回:err
1800  如果非reg_mask且非stack_mask则返回:0
1806  如果i恒等于first_idx退出
1809  如果i大于等于 Number of filter blocks
1816  verbose(env, "BUG backtracking idx %d\n", i)
1817  WARN_ONCE(1, "verifier backtracking bug")
1818  返回:负EFAULT
1821  st等于parent
1822  如果非st退出
1825  new_marks = false
1826  func等于 call stack tracking [curframe]
1827  map_from_u64 - Check and swap words within u64.*@mask: source bitmap*@dst: destination bitmap* In 32-bit Big Endian kernel, when using ``(u32 *)(&val)[*]``* to read u64 mask, we will get the wrong word.* That is ``(u32 *)(&val)[0]`` gets the upper 32 bits,
1829  reg等于regs[i]
1831  reg_mask与等于1u左移i位的值的反
1832  继续下一循环
1834  如果非 if (!precise && SCALAR_VALUE) min/max/tnum don't affect safety new_marks = true
1836  if (!precise && SCALAR_VALUE) min/max/tnum don't affect safety = true
1839  map_from_u64 - Check and swap words within u64.*@mask: source bitmap*@dst: destination bitmap* In 32-bit Big Endian kernel, when using ``(u32 *)(&val)[*]``* to read u64 mask, we will get the wrong word.* That is ``(u32 *)(&val)[0]`` gets the upper 32 bits,
1841  如果i大于等于allocated_stacksize of eBPF register in bytes
1855  he scalar precision tracking algorithm:* . at the start all registers have precise=false.* . scalar ranges are tracked as normal through alu and jmp insns.* . once precise value of the scalar register is used in:* . ptr + scalar alu*
1856  返回:0
1859  如果slot_type[0]不等于 register spilled into stack
1860  stack_mask与等于1ull左移i位的值的反
1861  继续下一循环
1863  reg等于spilled_ptr
1864  如果 Ordering of fields matters. See states_equal() 不等于g doesn't contain a valid pointer
1865  stack_mask与等于1ull左移i位的值的反
1866  继续下一循环
1868  如果非 if (!precise && SCALAR_VALUE) min/max/tnum don't affect safety new_marks = true
1870  if (!precise && SCALAR_VALUE) min/max/tnum don't affect safety = true
1872  如果level按位与BPF_LOG_LEVEL
1873  print_verifier_state(env, func)
1874  verbose(env, "parent %s regs=%x stack=%llx marks\n", new_marks ? "didn't have" : "already had", reg_mask, stack_mask)
1879  如果非reg_mask且非stack_mask退出
1881  如果非new_marks退出
1884  last_idx等于last_insn_idx
1885  first_idx等于 first and last insn idx of this verifier state
1887  返回:0
调用者
名称描述
mark_chain_precision
mark_chain_precision_stack