]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: fix precision bit propagation for BPF_ST instructions
authorAndrii Nakryiko <andriin@fb.com>
Tue, 9 Jul 2019 03:32:44 +0000 (20:32 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 12 Jul 2019 12:48:52 +0000 (14:48 +0200)
commiteccb58c0b6d3d46ef559fb6d64526a8bad8a7296
tree2c74195e178483c0d55ee60b1544073e7edf1d9c
parent504d2b81bc7d278184f00cbc335bf194ad8385fb
bpf: fix precision bit propagation for BPF_ST instructions

When backtracking instructions to propagate precision bit for registers
and stack slots, one class of instructions (BPF_ST) weren't handled
causing extra stack slots to be propagated into parent state. Parent
state might not have that much stack allocated, though, which causes
warning on invalid stack slot usage.

This patch adds handling of BPF_ST instructions:

BPF_MEM | <size> | BPF_ST:   *(size *) (dst_reg + off) = imm32

Reported-by: syzbot+4da3ff23081bafe74fc2@syzkaller.appspotmail.com
Fixes: 0c3dd0a28174 ("bpf: precise scalar_value tracking")
Cc: Alexei Starovoitov <ast@fb.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/verifier.c