summaryrefslogtreecommitdiffstats
path: root/samples/bpf
diff options
context:
space:
mode:
authorAndrey Ignatov <rdna@fb.com>2019-12-19 16:05:11 -0800
committerAlexei Starovoitov <ast@kernel.org>2019-12-20 16:06:02 -0800
commit478bee0df0ec9067c12e7d058d78721a7e7a1b29 (patch)
tree537e46aa39c0c2fe37da471dd970177c513051d8 /samples/bpf
parentce3cec27933c069d2015a81e59b93eb656fe7ee4 (diff)
downloadlinux-478bee0df0ec9067c12e7d058d78721a7e7a1b29.tar.gz
linux-478bee0df0ec9067c12e7d058d78721a7e7a1b29.tar.bz2
linux-478bee0df0ec9067c12e7d058d78721a7e7a1b29.zip
selftests/bpf: Preserve errno in test_progs CHECK macros
It's follow-up for discussion [1] CHECK and CHECK_FAIL macros in test_progs.h can affect errno in some circumstances, e.g. if some code accidentally closes stdout. It makes checking errno in patterns like this unreliable: if (CHECK(!bpf_prog_attach_xattr(...), "tag", "msg")) goto err; CHECK_FAIL(errno != ENOENT); , since by CHECK_FAIL time errno could be affected not only by bpf_prog_attach_xattr but by CHECK as well. Fix it by saving and restoring errno in the macros. There is no "Fixes" tag since no problems were discovered yet and it's rather precaution. test_progs was run with this change and no difference was identified. [1] https://lore.kernel.org/bpf/20191219210907.GD16266@rdna-mbp.dhcp.thefacebook.com/ Signed-off-by: Andrey Ignatov <rdna@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/20191220000511.1684853-1-rdna@fb.com
Diffstat (limited to 'samples/bpf')
0 files changed, 0 insertions, 0 deletions