]> www.infradead.org Git - users/dwmw2/linux.git/commit
libbpf: sanitize VAR to conservative 1-byte INT
authorAndrii Nakryiko <andriin@fb.com>
Fri, 19 Jul 2019 19:46:03 +0000 (12:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Aug 2019 06:29:50 +0000 (08:29 +0200)
commit0ea8657938351d2c57126a13f99980ef556ef08c
tree95cfa06739ffcb9e6050d89bc51f9ded38ab2141
parent3883ef3b1de6c8297c5075068da6a1fbb95ba125
libbpf: sanitize VAR to conservative 1-byte INT

[ Upstream commit 1d4126c4e1190d2f7d3f388552f9bd17ae0c64fc ]

If VAR in non-sanitized BTF was size less than 4, converting such VAR
into an INT with size=4 will cause BTF validation failure due to
violationg of STRUCT (into which DATASEC was converted) member size.
Fix by conservatively using size=1.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/lib/bpf/libbpf.c