lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJ8uoz2ujrys-YbkV=+PeGoRfgTitmJstZQwbQcbBbb=nAZ7Ww@mail.gmail.com>
Date:   Thu, 12 Jan 2023 10:29:13 +0100
From:   Magnus Karlsson <magnus.karlsson@...il.com>
To:     Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc:     magnus.karlsson@...el.com, bjorn@...nel.org, ast@...nel.org,
        daniel@...earbox.net, netdev@...r.kernel.org,
        maciej.fijalkowski@...el.com, bpf@...r.kernel.org, yhs@...com,
        andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org,
        john.fastabend@...il.com, kpsingh@...nel.org, sdf@...gle.com,
        haoluo@...gle.com, jolsa@...nel.org, tirthendu.sarkar@...el.com,
        jonathan.lemon@...il.com
Subject: Re: [PATCH bpf-next v3 04/15] selftests/xsk: print correct error
 codes when exiting

On Thu, Jan 12, 2023 at 3:23 AM Alexei Starovoitov
<alexei.starovoitov@...il.com> wrote:
>
> On Wed, Jan 11, 2023 at 10:35:15AM +0100, Magnus Karlsson wrote:
> > -                                             exit_with_error(-ret);
> > +                                             exit_with_error(errno);
> ...
> > @@ -1323,18 +1323,18 @@ static void thread_common_ops(struct test_spec *test, struct ifobject *ifobject)
> >       if (ifobject->xdp_flags & XDP_FLAGS_SKB_MODE) {
> >               if (opts.attach_mode != XDP_ATTACHED_SKB) {
> >                       ksft_print_msg("ERROR: [%s] XDP prog not in SKB mode\n");
> > -                     exit_with_error(-EINVAL);
> > +                     exit_with_error(EINVAL);
>
> My understanding is that you want exit_with_error() to always see a positive error, right?
> Have you considered doing something like:
> #define exit_with_error(error) ({\
>   if (__builtin_constant_p(error) && error < 0) // build error;
>   __exit_with_error(error, __FILE__, __func__, __LINE__);
> })
> would it help to catch some of these issues?

Yes it would. Will add this to the next series. Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ