public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111034] New: Precompiled headers still non-deterministic
@ 2023-08-16  1:05 skunk at iskunk dot org
  0 siblings, 0 replies; only message in thread
From: skunk at iskunk dot org @ 2023-08-16  1:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111034

            Bug ID: 111034
           Summary: Precompiled headers still non-deterministic
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: skunk at iskunk dot org
  Target Milestone: ---

This is a follow-on of bug #92717.

In that bug, it was noted that .gch files are basically GCC memory dumps, and
that because ASLR is typically enabled on modern Linux systems, this results in
non-deterministic output every time such a file is generated.

The solution given was to disable ASLR, e.g. by using "setarch -R". And I
confirmed that if I generate the same .gch file multiple times in a tight loop
with ASLR disabled, every file comes out identical.

That was only a test, however. My production fix was to disable ASLR for the
entire build process, with "setarch -R make bootstrap".

And that yielded much spottier results. After multiple attempts, maybe 10% of
the pairs of bootstraps that I ran came out with identical .gch files. And that
was running on the same container host---if I tried the build in the same
container architecture/environment but a different host, the files would end up
different as a matter of course.

I think, in the interests of reproducibility, the way .gch files are generated
needs to be reworked in a way that does not depend on the runtime environment.
The current approach may be fine for PCH purposes, but the security
implications of any opaque non-determinism will only get worse with time.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-16  1:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-16  1:05 [Bug c++/111034] New: Precompiled headers still non-deterministic skunk at iskunk dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).