Skip to content

Commit e1cb561

Browse files
pchaignoKernel Patches Daemon
authored andcommitted
bpf: Check flow_dissector ctx accesses are aligned
flow_dissector_is_valid_access doesn't check that the context access is aligned. As a consequence, an unaligned access within one of the exposed field is considered valid and later rejected by flow_dissector_convert_ctx_access when we try to convert it. The later rejection is problematic because it's reported as a verifier bug with a kernel warning and doesn't point to the right instruction in verifier logs. Fixes: d58e468 ("flow_dissector: implements flow dissector BPF hook") Reported-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=ccac90e482b2a81d74aa Signed-off-by: Paul Chaignon <[email protected]> Acked-by: Yonghong Song <[email protected]> Acked-by: Eduard Zingerman <[email protected]>
1 parent 821bb1d commit e1cb561

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/core/filter.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9458,6 +9458,9 @@ static bool flow_dissector_is_valid_access(int off, int size,
94589458
if (off < 0 || off >= sizeof(struct __sk_buff))
94599459
return false;
94609460

9461+
if (off % size != 0)
9462+
return false;
9463+
94619464
if (type == BPF_WRITE)
94629465
return false;
94639466

0 commit comments

Comments
 (0)