Commit e9f7497
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 <yonghong.song@linux.dev>
Suggested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: stable@vger.kernel.org1 parent 7c7c04b commit e9f7497
1 file changed
+9
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14047 | 14047 | | |
14048 | 14048 | | |
14049 | 14049 | | |
| 14050 | + | |
| 14051 | + | |
| 14052 | + | |
| 14053 | + | |
| 14054 | + | |
| 14055 | + | |
14050 | 14056 | | |
14051 | 14057 | | |
14052 | 14058 | | |
| |||
14058 | 14064 | | |
14059 | 14065 | | |
14060 | 14066 | | |
14061 | | - | |
| 14067 | + | |
| 14068 | + | |
| 14069 | + | |
14062 | 14070 | | |
14063 | 14071 | | |
14064 | 14072 | | |
14065 | 14073 | | |
14066 | | - | |
14067 | 14074 | | |
14068 | 14075 | | |
14069 | 14076 | | |
14070 | 14077 | | |
14071 | 14078 | | |
14072 | 14079 | | |
14073 | 14080 | | |
14074 | | - | |
14075 | | - | |
14076 | | - | |
14077 | | - | |
14078 | | - | |
14079 | | - | |
14080 | 14081 | | |
14081 | 14082 | | |
14082 | 14083 | | |
| |||
0 commit comments