[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 Jakub Jelinek changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED Target Milestone|--- |12.5 --- Comment #15 from Jakub Jelinek --- Fixed also for 12.5.
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 --- Comment #14 from GCC Commits --- The releases/gcc-12 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:9586f7a78533ef4feb92f838f9f70aa2341d0ede commit r12-11179-g9586f7a78533ef4feb92f838f9f70aa2341d0ede Author: Jakub Jelinek Date: Mon Apr 14 10:18:13 2025 +0200 driver: On linux hosts disable ASLR during -freport-bug [PR119727] Andi had a useful comment that even with the PR119727 workaround to ignore differences in libbacktrace printed addresses, it is still better to turn off ASLR when easily possible, e.g. in case some address leaks in somewhere in the ICE message elsewhere, or to verify the ICE doesn't depend on a particular library/binary load addresses. The following patch adds a configure check and uses personality syscall to turn off randomization for further -freport-bug subprocesses. 2025-04-14 Jakub Jelinek PR driver/119727 * configure.ac (HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE): New check. * gcc.cc: Include sys/personality.h if HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE is defined. (try_generate_repro): Call personality (personality (0xU) | ADDR_NO_RANDOMIZE) if HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE is defined. * config.in: Regenerate. * configure: Regenerate. (cherry picked from commit 5a32e85810d33dc46b1b5fe2803ee787d40709d5)
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 --- Comment #13 from GCC Commits --- The releases/gcc-12 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:d3c3322577ca0d37adf47e1b67f35be003a7425d commit r12-11178-gd3c3322577ca0d37adf47e1b67f35be003a7425d Author: Jakub Jelinek Date: Sat Apr 12 13:15:13 2025 +0200 driver: Fix up -freport-bug for ASLR [PR119727] With --enable-host-pie -freport-bug almost never prepares preprocessed source and instead emits The bug is not reproducible, so it is likely a hardware or OS problem. message even for bogus which are 100% reproducible. The way -freport-bug works is that it reruns it 3 times, capturing stdout and stderr from each and then tries to compare the outputs in between different runs. The libbacktrace emitted hexadecimal addresses at the start of the lines can differ between runs due to ASLR, either of the PIE executable, or even if not PIE if there is some frame with e.g. libc function (say crash in strlen/memcpy etc.). The following patch fixes it by ignoring such differences at the start of the lines. 2025-04-12 Jakub Jelinek PR driver/119727 * gcc.cc (files_equal_p): Rewritten using fopen/fgets/fclose instead of open/fstat/read/close. At the start of lines, ignore lowercase hexadecimal addresses followed by space. (cherry picked from commit 8b2ceb421f045ee8b39d7941f39f1e9a67217583)
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 --- Comment #12 from Jakub Jelinek --- Fixed also for 13.4.
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 --- Comment #10 from GCC Commits --- The releases/gcc-13 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:c3c451bcb0d1900068cfe9d1bb3cb76fce95284b commit r13-9605-gc3c451bcb0d1900068cfe9d1bb3cb76fce95284b Author: Jakub Jelinek Date: Sat Apr 12 13:15:13 2025 +0200 driver: Fix up -freport-bug for ASLR [PR119727] With --enable-host-pie -freport-bug almost never prepares preprocessed source and instead emits The bug is not reproducible, so it is likely a hardware or OS problem. message even for bogus which are 100% reproducible. The way -freport-bug works is that it reruns it 3 times, capturing stdout and stderr from each and then tries to compare the outputs in between different runs. The libbacktrace emitted hexadecimal addresses at the start of the lines can differ between runs due to ASLR, either of the PIE executable, or even if not PIE if there is some frame with e.g. libc function (say crash in strlen/memcpy etc.). The following patch fixes it by ignoring such differences at the start of the lines. 2025-04-12 Jakub Jelinek PR driver/119727 * gcc.cc (files_equal_p): Rewritten using fopen/fgets/fclose instead of open/fstat/read/close. At the start of lines, ignore lowercase hexadecimal addresses followed by space. (cherry picked from commit 8b2ceb421f045ee8b39d7941f39f1e9a67217583)
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 --- Comment #11 from GCC Commits --- The releases/gcc-13 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:b00d87fcc4fcb23fb8c7f1928b5067bd73a9 commit r13-9606-gb00d87fcc4fcb23fb8c7f1928b5067bd73a9 Author: Jakub Jelinek Date: Mon Apr 14 10:18:13 2025 +0200 driver: On linux hosts disable ASLR during -freport-bug [PR119727] Andi had a useful comment that even with the PR119727 workaround to ignore differences in libbacktrace printed addresses, it is still better to turn off ASLR when easily possible, e.g. in case some address leaks in somewhere in the ICE message elsewhere, or to verify the ICE doesn't depend on a particular library/binary load addresses. The following patch adds a configure check and uses personality syscall to turn off randomization for further -freport-bug subprocesses. 2025-04-14 Jakub Jelinek PR driver/119727 * configure.ac (HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE): New check. * gcc.cc: Include sys/personality.h if HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE is defined. (try_generate_repro): Call personality (personality (0xU) | ADDR_NO_RANDOMIZE) if HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE is defined. * config.in: Regenerate. * configure: Regenerate. (cherry picked from commit 5a32e85810d33dc46b1b5fe2803ee787d40709d5)
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 --- Comment #8 from GCC Commits --- The releases/gcc-14 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:2aa812386ad5950283f800257c37bdb78691e770 commit r14-11659-g2aa812386ad5950283f800257c37bdb78691e770 Author: Jakub Jelinek Date: Sat Apr 12 13:15:13 2025 +0200 driver: Fix up -freport-bug for ASLR [PR119727] With --enable-host-pie -freport-bug almost never prepares preprocessed source and instead emits The bug is not reproducible, so it is likely a hardware or OS problem. message even for bogus which are 100% reproducible. The way -freport-bug works is that it reruns it 3 times, capturing stdout and stderr from each and then tries to compare the outputs in between different runs. The libbacktrace emitted hexadecimal addresses at the start of the lines can differ between runs due to ASLR, either of the PIE executable, or even if not PIE if there is some frame with e.g. libc function (say crash in strlen/memcpy etc.). The following patch fixes it by ignoring such differences at the start of the lines. 2025-04-12 Jakub Jelinek PR driver/119727 * gcc.cc (files_equal_p): Rewritten using fopen/fgets/fclose instead of open/fstat/read/close. At the start of lines, ignore lowercase hexadecimal addresses followed by space. (cherry picked from commit 8b2ceb421f045ee8b39d7941f39f1e9a67217583)
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 --- Comment #9 from GCC Commits --- The releases/gcc-14 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:438c4df22217280df3f141bd0b1df0523b4de6d3 commit r14-11660-g438c4df22217280df3f141bd0b1df0523b4de6d3 Author: Jakub Jelinek Date: Mon Apr 14 10:18:13 2025 +0200 driver: On linux hosts disable ASLR during -freport-bug [PR119727] Andi had a useful comment that even with the PR119727 workaround to ignore differences in libbacktrace printed addresses, it is still better to turn off ASLR when easily possible, e.g. in case some address leaks in somewhere in the ICE message elsewhere, or to verify the ICE doesn't depend on a particular library/binary load addresses. The following patch adds a configure check and uses personality syscall to turn off randomization for further -freport-bug subprocesses. 2025-04-14 Jakub Jelinek PR driver/119727 * configure.ac (HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE): New check. * gcc.cc: Include sys/personality.h if HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE is defined. (try_generate_repro): Call personality (personality (0xU) | ADDR_NO_RANDOMIZE) if HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE is defined. * config.in: Regenerate. * configure: Regenerate. (cherry picked from commit 5a32e85810d33dc46b1b5fe2803ee787d40709d5)
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 --- Comment #7 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:5a32e85810d33dc46b1b5fe2803ee787d40709d5 commit r15-9420-g5a32e85810d33dc46b1b5fe2803ee787d40709d5 Author: Jakub Jelinek Date: Mon Apr 14 10:18:13 2025 +0200 driver: On linux hosts disable ASLR during -freport-bug [PR119727] Andi had a useful comment that even with the PR119727 workaround to ignore differences in libbacktrace printed addresses, it is still better to turn off ASLR when easily possible, e.g. in case some address leaks in somewhere in the ICE message elsewhere, or to verify the ICE doesn't depend on a particular library/binary load addresses. The following patch adds a configure check and uses personality syscall to turn off randomization for further -freport-bug subprocesses. 2025-04-14 Jakub Jelinek PR driver/119727 * configure.ac (HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE): New check. * gcc.cc: Include sys/personality.h if HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE is defined. (try_generate_repro): Call personality (personality (0xU) | ADDR_NO_RANDOMIZE) if HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE is defined. * config.in: Regenerate. * configure: Regenerate.
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 --- Comment #6 from Sam James --- Let's consider backporting this one after some time on trunk? It'd help us a lot with user reports and would mean we can default-enable -freport-bug downstream.
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 --- Comment #5 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:8b2ceb421f045ee8b39d7941f39f1e9a67217583 commit r15-9398-g8b2ceb421f045ee8b39d7941f39f1e9a67217583 Author: Jakub Jelinek Date: Sat Apr 12 13:15:13 2025 +0200 driver: Fix up -freport-bug for ASLR [PR119727] With --enable-host-pie -freport-bug almost never prepares preprocessed source and instead emits The bug is not reproducible, so it is likely a hardware or OS problem. message even for bogus which are 100% reproducible. The way -freport-bug works is that it reruns it 3 times, capturing stdout and stderr from each and then tries to compare the outputs in between different runs. The libbacktrace emitted hexadecimal addresses at the start of the lines can differ between runs due to ASLR, either of the PIE executable, or even if not PIE if there is some frame with e.g. libc function (say crash in strlen/memcpy etc.). The following patch fixes it by ignoring such differences at the start of the lines. 2025-04-12 Jakub Jelinek PR driver/119727 * gcc.cc (files_equal_p): Rewritten using fopen/fgets/fclose instead of open/fstat/read/close. At the start of lines, ignore lowercase hexadecimal addresses followed by space.
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 --- Comment #4 from Andi Kleen --- Yes but on the OS where you know it it's better to do both to make the runs more reproducible. There are also bugs that don't reproduce on ASLR
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 --- Comment #3 from Jakub Jelinek --- We need something that works on other OSes too.
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 Andi Kleen changed: What|Removed |Added CC||andi-gcc at firstfloor dot org --- Comment #2 from Andi Kleen --- On Linux you could also disable it with personality(personality(0x) | ADDR_NO_RANDOMIZATION); (see https://github.com/redox-os/binutils-gdb/blob/master/gdb/linux-nat.c)
[Bug driver/119727] -freport-bug vs. ASLR
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119727 Jakub Jelinek changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org Ever confirmed|0 |1 Last reconfirmed||2025-04-11 --- Comment #1 from Jakub Jelinek --- Created attachment 61074 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61074&action=edit gcc15-pr119727.patch Untested fix.
