On Thu, May 27, 2021 at 6:28 PM Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote: > > On Thu, May 27, 2021 at 1:14 PM Zvi Effron <zeffron@xxxxxxxxxxxxx> wrote: > > > > + > > + /* Data past the end of the kernel's struct xdp_md must be 0 */ > > + bad_ctx[sizeof(bad_ctx) - 1] = 1; > > + tattr.ctx_in = bad_ctx; > > + tattr.ctx_size_in = sizeof(bad_ctx); > > + err = bpf_prog_test_run_opts(prog_fd, &tattr); > > + ASSERT_ERR(err, "bpf_prog_test_run(test2)"); > > + ASSERT_EQ(errno, 22, "test2-errno"); > > by the time you are checking errno it might get overwritten. If you > want to check errno, you have to remember it right after the function > returns Is it sufficient to simply make the errno ASSERT the first thing after the function returns? Or would we still need to preserve it into a local variable?