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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230112022328.zbazaaoxbxfornh6@MacBook-Pro-6.local>
Date:   Wed, 11 Jan 2023 18:23:28 -0800
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Magnus Karlsson <magnus.karlsson@...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 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?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ