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: <20250924201347.GA4511@quark>
Date: Wed, 24 Sep 2025 13:13:47 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-crypto@...r.kernel.org, Herbert Xu <herbert@...dor.apana.org.au>,
	linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] crypto: af_alg - Fix incorrect boolean values in
 af_alg_ctx

On Wed, Sep 24, 2025 at 12:40:29PM -0700, Linus Torvalds wrote:
> On Wed, 24 Sept 2025 at 12:27, Eric Biggers <ebiggers@...nel.org> wrote:
> >
> > -       u32             more:1,
> > -                       merge:1,
> > -                       enc:1,
> > -                       write:1,
> > -                       init:1;
> > +       bool more;
> > +       bool merge;
> > +       bool enc;
> > +       bool write;
> > +       bool init;
> 
> This actually packs horribly, since a 'bool' will take up a byte for
> each, so now those five bits take up 8 bytes of storage (because the
> five bytes will then cause the next field to have to be aligned too).
> 
> You could just keep the bitfield format, but change the 'u32' to
> 'bool' and get the best of both worlds, ie just do something like
> 
> -       u32             more:1,
> +       bool             more:1,
> 
> and now you get the bit packing _and_ the automatic bool behavior.

Sure, I'll send out v2 with your suggestion.

I do think the idea of trying to re-pack the structure as part of a bug
fix is a bit misguided, though.  It's what caused this additional bug in
the first place, and it's not like it actually matters here.  (AF_ALG is
rarely used, and when it is, the sockets tend not to be kept open for
very long.  And the entire concept of AF_ALG is a mistake anyway.)

- Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ