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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 7 Jan 2019 08:49:56 -0800
From:   Stanislav Fomichev <sdf@...ichev.me>
To:     Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc:     Stanislav Fomichev <sdf@...gle.com>, netdev@...r.kernel.org,
        davem@...emloft.net, ast@...nel.org, daniel@...earbox.net
Subject: Re: [PATCH bpf] selftests/bpf: fix incorrect users of
 create_and_get_cgroup

On 01/04, Alexei Starovoitov wrote:
> On Thu, Jan 03, 2019 at 10:57:17AM -0800, Stanislav Fomichev wrote:
> > create_and_get_cgroup returns 0 on error, fix the users that assume
> > negative value in case of an error.
> > 
> > Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> > ---
> >  tools/testing/selftests/bpf/get_cgroup_id_user.c | 2 +-
> >  tools/testing/selftests/bpf/test_sockmap.c       | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/bpf/get_cgroup_id_user.c b/tools/testing/selftests/bpf/get_cgroup_id_user.c
> > index e8da7b39158d..dfaa9b353ac3 100644
> > --- a/tools/testing/selftests/bpf/get_cgroup_id_user.c
> > +++ b/tools/testing/selftests/bpf/get_cgroup_id_user.c
> > @@ -64,7 +64,7 @@ int main(int argc, char **argv)
> >  		return 1;
> >  
> >  	cgroup_fd = create_and_get_cgroup(TEST_CGROUP);
> > -	if (CHECK(cgroup_fd < 0, "create_and_get_cgroup", "err %d errno %d\n",
> > +	if (CHECK(!cgroup_fd, "create_and_get_cgroup", "err %d errno %d\n",
> 
> fd can be zero.
Assumed it was fine for the test where we never close stdin.

> Hence I prefer to fix it the other way to avoid this corner case.
> Pls fix create_and_get_cgroup() to return -1 in case of error.
> The diff will be much bigger, but overall it's imo cleaner.
Agree, will sent a v2 shortly.

> Also pls add Fixes tag.
> 
> Thanks
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ