Files
linux/kernel
Yafang Shao d75e30dddf bpf: Fix issue in verifying allow_ptr_leaks
After we converted the capabilities of our networking-bpf program from
cap_sys_admin to cap_net_admin+cap_bpf, our networking-bpf program
failed to start. Because it failed the bpf verifier, and the error log
is "R3 pointer comparison prohibited".

A simple reproducer as follows,

SEC("cls-ingress")
int ingress(struct __sk_buff *skb)
{
	struct iphdr *iph = (void *)(long)skb->data + sizeof(struct ethhdr);

	if ((long)(iph + 1) > (long)skb->data_end)
		return TC_ACT_STOLEN;
	return TC_ACT_OK;
}

Per discussion with Yonghong and Alexei [1], comparison of two packet
pointers is not a pointer leak. This patch fixes it.

Our local kernel is 6.1.y and we expect this fix to be backported to
6.1.y, so stable is CCed.

[1]. https://lore.kernel.org/bpf/CAADnVQ+Nmspr7Si+pxWn8zkE7hX-7s93ugwC+94aXSy4uQ9vBg@mail.gmail.com/

Suggested-by: Yonghong Song <[email protected]>
Suggested-by: Alexei Starovoitov <[email protected]>
Signed-off-by: Yafang Shao <[email protected]>
Acked-by: Eduard Zingerman <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
2023-08-23 09:37:29 -07:00
..
2022-12-21 14:31:52 -08:00
…
2022-08-29 19:47:03 -04:00
2022-09-26 10:13:13 -07:00
…
…
…
2023-03-24 11:01:29 +01:00
…
2023-04-20 22:55:35 -04:00
2023-06-09 17:44:15 -07:00
2023-07-01 08:26:23 -07:00
…
…
…
…
…
…
…
…