Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ldind(size) and ldabs(size) memory is not the same as input #92

Open
QiongwenXu opened this issue Aug 31, 2020 · 0 comments
Open

ldind(size) and ldabs(size) memory is not the same as input #92

QiongwenXu opened this issue Aug 31, 2020 · 0 comments

Comments

@QiongwenXu
Copy link
Collaborator

now ldind(size) and ldabs(size) are implemented as the the same memory as input. Actually, they are different.

  1. These instructions can only be used when interpreter context is a pointer to 'struct sk_buff' and have seven implicit operands. Register R6 is an implicit input that must contain pointer to sk_buff. Register R0 is an implicit output which contains the data fetched from the packet. Registers R1-R5 are scratch registers and must not be used to store the data across BPF_ABS | BPF_LD or BPF_IND | BPF_LD instructions.(https://www.kernel.org/doc/Documentation/networking/filter.txt)
  2. the relationship between input __skb_buff and pkt(ldind, ldabs):
struct __sk_buff {
	__u32 len;
	__u32 pkt_type;
	__u32 mark;
	__u32 queue_mapping;
	__u32 protocol;
	__u32 vlan_present;
	__u32 vlan_tci;
	__u32 vlan_proto;
	__u32 priority;
	__u32 ingress_ifindex;
	__u32 ifindex;
	__u32 tc_index;
	__u32 cb[5];
	__u32 hash;
	__u32 tc_classid;
	__u32 data;             // pkt start
	__u32 data_end;         // pkt end
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant