aboutsummaryrefslogtreecommitdiff
path: root/kernel/gcov/gcov.h
diff options
context:
space:
mode:
authorMartin KaFai Lau <[email protected]>2021-11-01 23:45:35 -0700
committerDaniel Borkmann <[email protected]>2021-11-03 15:46:46 +0100
commitf30d4968e9aee737e174fc97942af46cfb49b484 (patch)
tree169aa41553126c12b1e8e5c36812f951c1b1607e /kernel/gcov/gcov.h
parent401a33da3a45cc05859b121314f8ab52c2c01977 (diff)
bpf: Do not reject when the stack read size is different from the tracked scalar size
Below is a simplified case from a report in bcc [0]: r4 = 20 *(u32 *)(r10 -4) = r4 *(u32 *)(r10 -8) = r4 /* r4 state is tracked */ r4 = *(u64 *)(r10 -8) /* Read more than the tracked 32bit scalar. * verifier rejects as 'corrupted spill memory'. */ After commit 354e8f1970f8 ("bpf: Support <8-byte scalar spill and refill"), the 8-byte aligned 32bit spill is also tracked by the verifier and the register state is stored. However, if 8 bytes are read from the stack instead of the tracked 4 byte scalar, then verifier currently rejects the program as "corrupted spill memory". This patch fixes this case by allowing it to read but marks the register as unknown. Also note that, if the prog is trying to corrupt/leak an earlier spilled pointer by spilling another <8 bytes register on top, this has already been rejected in the check_stack_write_fixed_off(). [0] https://github.com/iovisor/bcc/pull/3683 Fixes: 354e8f1970f8 ("bpf: Support <8-byte scalar spill and refill") Reported-by: Hengqi Chen <[email protected]> Reported-by: Yonghong Song <[email protected]> Signed-off-by: Martin KaFai Lau <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Tested-by: Hengqi Chen <[email protected]> Acked-by: Yonghong Song <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'kernel/gcov/gcov.h')
0 files changed, 0 insertions, 0 deletions