Re: [PATCH bpf-next] selftests/bpf: Preserve errno in test_progs CHECK macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 19, 2019 at 4:05 PM Andrey Ignatov <rdna@xxxxxx> wrote:
>
> 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@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
>
> Signed-off-by: Andrey Ignatov <rdna@xxxxxx>

Applied. Thanks



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux