mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
pping: Attempt to be nice to verifier...
Verifier might have rejected XDP program due to opt_size being loaded from memory, see https://blog.path.net/ebpf-xdp-and-network-security. Add check of opt_size to attempt to convince verifier that it's not a negative value or anything else crazy. Leads to verifier instead thinking the program is too large (over 1m instructions). Signed-off-by: Simon Sundberg <simon.sundberg@kau.se>
This commit is contained in:
@@ -107,6 +107,8 @@ static int parse_tcp_ts(struct tcphdr *tcph, void *data_end, __u32 *tsval,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Some other TCP option - advance option-length bytes
|
// Some other TCP option - advance option-length bytes
|
||||||
|
if (opt_size < 0 || opt_size > 34) // Try to convince verifier that opt-size can't be something crazy - leads to program being too large instead...
|
||||||
|
return -1;
|
||||||
pos += opt_size;
|
pos += opt_size;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user