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: <CAHk-=wj9guryjifHyr26w73ta+kNeoHtGde682Z5N6OSjKu4UQ@mail.gmail.com>
Date:   Sat, 4 Mar 2023 14:35:00 -0800
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Andrew Morton <akpm@...ux-foundation.org>,
        "Huang, Ying" <ying.huang@...el.com>
Cc:     linux-mm@...ck.org, mm-commits@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [GIT PULL] hotfixes for 6.3-rc1

On Sat, Mar 4, 2023 at 1:15 PM Andrew Morton <akpm@...ux-foundation.org> wrote:
>
> 17 hotfixes.  Eight are for MM and seven are for other parts of the
> kernel.  Seven are cc:stable and eight address post-6.3 issues or were
> judged unsuitable for -stable backporting.

Hmm. Since this pull didn't fix the gcc note about playing pointer
games that I get for my allmodconfig test build, and since I _really_
don't want to have an rc1 release tomorrow with that (valid) warning,
I fixed it up myself.

I fixed up the gcc note the cleanest way I could, by using a union to
make it very explicit that yes, we're basically doing a bit-for-bit
assignment from one incompatible type to another.

I would *not* encourage this pattern in general, but it had a comment
about why that invalid pointer conversion was fine in this case, and
it really does seem to be a fairly natural use of a union. This
situation really is that kind of "don't convert types, just copy the
bit representation".

So it's kind of conceptually quite similar to the traditional "use a
union to convert floating point bit representations to integers" and
back (as opposed to using a cast to convert a pointer in order to then
_use_ it as a pointer in the new form).

See

    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e77d587a2c04e82c6a0dffa4a32c874a4029385d

for details.

At least gcc generated identical code (well, for an unholy version of
that patch that had been edited to avoid line number changes) for me,
so that "go through a union type" doesn't cause any other differences
than getting rid of the gcc note.

(And this was definitely one of the cases where I felt that the gcc
note was entirely valid, and a good warning - even if it wasn't
technically a warnign that would cause -Werror to trigger. So I didn't
want to shut up the note by turning it off, I really wanted the code
to be more clear about what it does).

             Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ