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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221109143834.GB24561@mail.hallyn.com>
Date:   Wed, 9 Nov 2022 08:38:34 -0600
From:   "Serge E. Hallyn" <serge@...lyn.com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Paul Moore <paul@...l-moore.com>,
        linux-security-module@...r.kernel.org,
        linux-kernel@...r.kernel.org, serge@...lyn.com
Subject: Re: [GIT PULL] LSM fixes for v6.1 (#1)

On Mon, Oct 31, 2022 at 12:22:29PM -0700, Linus Torvalds wrote:
> On Mon, Oct 31, 2022 at 4:07 AM Paul Moore <paul@...l-moore.com> wrote:
> >
> > A single patch to the capabilities code to fix a potential memory leak
> > in the xattr allocation error handling.  Please apply for v6.1-rcX.
> 
> Pulled.
> 
> However, I react to the strange test condition. Sure, it's
> pre-existing, but does it really make sense?
> 
> It does
> 
> +       if (ret < 0 || !tmpbuf) {
> +               size = ret;
> +               goto out_free;
> +       }
> 
> and how the heck can 'tmpbuf' be NULL if vfs_getxattr_alloc() succeeded?

I had to go through the history a bit - the !tmpbuf check was added

https://www.spinics.net/lists/stable/msg463010.html

because of a gcc warning.  Perhaps there's a better way to tell gcc
that it can't remain NULL if ret was < 0 ?

> I think that's not only impossible in the first place, but if it *was*
> possible, then that
> 
>                 size = ret;
>                goto out_free;
> 
> would be wrong, because this function would return success even if it
> wasn't successful.
> 
> That whole "cast to int, and then cast back to size_t" also smells of
> some serious confusion in the return value handling. It looks to me
> like vfs_getxattr_alloc() fundamentally returns an 'int', not a
> 'ssize_t', just by looking at the ->get function. But it just all
> looks weird.
> 
> So this code has all kinds of oddities.
> 
>                Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ