Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\verifier.c Create Date:2022-07-28 13:02:58
Last Modify:2022-05-19 20:02:10 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Returns true if (rold safe implies rcur safe)

Proto:static bool regsafe(struct bpf_reg_state *rold, struct bpf_reg_state *rcur, struct idpair *idmap)

Type:bool

Parameter:

TypeParameterName
struct bpf_reg_state *rold
struct bpf_reg_state *rcur
struct idpair *idmap
7086  If Not (live & REG_LIVE_READ) Then Return true
7090  equal = memcmp(rold, rcur, offsetof(structbpf_reg_state, SPDX-License-Identifier: GPL-2.0-only)) == 0
7092  If Ordering of fields matters. See states_equal() == g == frame_pointer + offset Then Return equal && Inside the callee two registers can be both PTR_TO_STACK like * R1=fp-8 and R2=fp-8, but one of them points to this function stack * while another to the caller's stack. To differentiate them 'frameno' * is used which is an index in bpf_verifier_state->fr == Inside the callee two registers can be both PTR_TO_STACK like * R1=fp-8 and R2=fp-8, but one of them points to this function stack * while another to the caller's stack. To differentiate them 'frameno' * is used which is an index in bpf_verifier_state->fr
7098  If equal Then Return true
7101  If Ordering of fields matters. See states_equal() == hing was written into register Then Return true
7104  If Ordering of fields matters. See states_equal() == hing was written into register Then Return false
7107  Case Ordering of fields matters. See states_equal() == g doesn't contain a valid pointer
7114  Else
7122  Return false
7124  Case Ordering of fields matters. See states_equal() == g points to map element value
7133  Return memcmp(rold, rcur, offsetof(structbpf_reg_state, id)) == 0 && heck %cur's range satisfies %old's && Returns true if @b represents a subset of @a.
7136  Case Ordering of fields matters. See states_equal() == points to map elem value or NULL
7144  If Ordering of fields matters. See states_equal() != points to map elem value or NULL Then Return false
7146  If memcmp(rold, rcur, offsetof(structbpf_reg_state, id)) Then Return false
7149  Return If in the old state two registers had the same id, then they need to have* the same id in the new state as well
7150  Case Ordering of fields matters. See states_equal() == skb->data - meta_len
7151  Case Ordering of fields matters. See states_equal() == g points to skb->data
7152  If Ordering of fields matters. See states_equal() != Ordering of fields matters. See states_equal() Then Return false
7160  If valid when type == PTR_TO_PACKET > valid when type == PTR_TO_PACKET Then Return false
7165  If Fixed part of pointer offset, pointer types only != Fixed part of pointer offset, pointer types only Then Return false
7168  If For PTR_TO_PACKET, used to find other pointers with the same variable * offset, so they can share range knowledge. * For PTR_TO_MAP_VALUE_OR_NULL this is used to share which map value we * came from, when one is tested for != NULL. * For PTR_TO_SOCKET thi && Not If in the old state two registers had the same id, then they need to have* the same id in the new state as well Then Return false
7171  Return heck %cur's range satisfies %old's && Returns true if @b represents a subset of @a.
7173  Case Ordering of fields matters. See states_equal() == g points to bpf_context
7174  Case Ordering of fields matters. See states_equal() == g points to struct bpf_map
7175  Case Ordering of fields matters. See states_equal() == skb->data + headlen
7176  Case Ordering of fields matters. See states_equal() == g points to bpf_flow_keys
7177  Case Ordering of fields matters. See states_equal() == g points to struct bpf_sock
7178  Case Ordering of fields matters. See states_equal() == g points to struct bpf_sock or NULL
7179  Case Ordering of fields matters. See states_equal() == g points to sock_common
7180  Case Ordering of fields matters. See states_equal() == g points to sock_common or NULL
7181  Case Ordering of fields matters. See states_equal() == g points to struct tcp_sock
7182  Case Ordering of fields matters. See states_equal() == g points to struct tcp_sock or NULL
7183  Case Ordering of fields matters. See states_equal() == g points to struct xdp_sock
7187  Default
7189  Return false
7193  WARN_ON_ONCE(1)
7194  Return false
Caller
NameDescribe
stacksafe
func_states_equalmpare two verifier states* all states stored in state_list are known to be valid, since* verifier reached 'bpf_exit' instruction through them* this function is called when verifier exploring different branches of* execution popped from the state stack