OSDN Git Service

bpf: Add sanity check for upper ptr_limit
authorPiotr Krysiuk <piotras@gmail.com>
Tue, 16 Mar 2021 08:47:02 +0000 (09:47 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 17 Mar 2021 20:57:39 +0000 (21:57 +0100)
commit1b1597e64e1a610c7a96710fc4717158e98a08b3
tree2bff02cdb86111e2e17e49b066992fb5b41e0cfa
parentb5871dca250cd391885218b99cc015aca1a51aea
bpf: Add sanity check for upper ptr_limit

Given we know the max possible value of ptr_limit at the time of retrieving
the latter, add basic assertions, so that the verifier can bail out if
anything looks odd and reject the program. Nothing triggered this so far,
but it also does not hurt to have these.

Signed-off-by: Piotr Krysiuk <piotras@gmail.com>
Co-developed-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c