[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wg-6b_=XQbwKqEwuAbQCOcXx7_mw78-GopQ5==_TuTPLQ@mail.gmail.com>
Date: Sun, 17 Jul 2022 14:11:52 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Segher Boessenkool <segher@...nel.crashing.org>
Cc: Sudip Mukherjee <sudipm.mukherjee@...il.com>,
Michael Ellerman <mpe@...erman.id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Kees Cook <keescook@...omium.org>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
linux-hardening@...r.kernel.org
Subject: Re: mainline build failure of powerpc allmodconfig for prom_init_check
On Sun, Jul 17, 2022 at 2:00 PM Segher Boessenkool
<segher@...nel.crashing.org> wrote:
>
> Calling mem* on a volatile object (or a struct containing one) is not
> valid. I opened gcc.gnu.org/PR106335.
Well, that very quickly got marked as a duplicate of a decade-old bug.
So I guess we shouldn't expect this to be fixed any time soon.
That said, your test-case of copying the whole structure is very
different from the one in the kernel that works on them one structure
member at a time.
I can *kind of* see the logic that when you do a whole struct
assignment, it turns into a "memcpy" without regard for volatile
members. You're not actually accessing the volatile members in some
particular order, so the struct assignment arguably does not really
have an access ordering that needs to be preserved.
But the kernel code in question very much does access the members
individually, and so I think that the compiler quite unequivocally did
something horribly horribly bad by turning them into a memset.
So I don't think your test-case is really particularly good, and maybe
that's why that old bug has languished for over a decade - people
didn't realize just *how* incredibly broken it was.
Linus
Powered by blists - more mailing lists