Bug 48318 - Memory access error by "build/genhooks"?
Summary: Memory access error by "build/genhooks"?
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2011-03-28 15:58 UTC by Markus Elfring
Modified: 2013-11-10 19:52 UTC (History)
0 users

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2011-03-29 10:01:59


Attachments
valgrind log (1.41 KB, text/plain)
2011-03-29 13:13 UTC, Markus Elfring
Details
valgrind log (1.26 KB, text/plain)
2011-03-29 13:15 UTC, Markus Elfring
Details
valgrind log (1.48 KB, text/plain)
2011-03-29 20:32 UTC, Markus Elfring
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Elfring 2011-03-28 15:58:10 UTC
I try to generate the current GCC software for my openSUSE 11.4 system. Unfortunately, I stumble on the following German message.

"...
/bin/sh /home/elfring/Projekte/GNU/GCC/Quellen/4.6.0/gcc/../move-if-change tmp-optionlist optionlist
echo timestamp > s-options
build/genhooks \
		/home/elfring/Projekte/GNU/GCC/Quellen/4.6.0/gcc/doc/tm.texi.in > tmp-tm.texi
gcc   -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE  -o build/genconstants \
    build/genconstants.o build/read-md.o build/errors.o ../build-x86_64-unknown-linux-gnu/libiberty/libiberty.a
/bin/sh: Zeile 1: 29541 Speicherzugriffsfehler  build/genhooks /home/elfring/Projekte/GNU/GCC/Quellen/4.6.0/gcc/doc/tm.texi.in > tmp-tm.texi
make[3]: *** [s-tm-texi] Fehler 139
make[3]: *** Warte auf noch nicht beendete Prozesse...
rm gcc.pod
make[3]: Leaving directory `/home/elfring/Projekte/GNU/GCC/erzeugt/4.6.0/Auswahl/gcc'
make[2]: *** [all-stage1-gcc] Fehler 2
make[2]: Leaving directory `/home/elfring/Projekte/GNU/GCC/erzeugt/4.6.0/Auswahl'
make[1]: *** [stage1-bubble] Fehler 2
make[1]: Leaving directory `/home/elfring/Projekte/GNU/GCC/erzeugt/4.6.0/Auswahl'
make: *** [all] Fehler 2"

How can this "memory access error"/"segmentation fault" be resolved?

I would like to use the configuration parameters "--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr/local".
Comment 1 Markus Elfring 2011-03-28 16:11:02 UTC
I assume that an output from the command "dmesg" like the following belongs to the reported situation.

[37489.218661] genhooks[4926]: segfault at 60fa40 ip 000000000060fa40 sp 00007fffd3ab7bc8 error 15 in genhooks[60c000+4000]
Comment 2 Richard Biener 2011-03-29 10:01:59 UTC
Please provide backtraces with gdb and/or valgrind.
Comment 3 Markus Elfring 2011-03-29 13:10:41 UTC
(In reply to comment #2)

I can not generate a backtrace myself by the tool "GNU debugger" on my system at the moment because of the issue "GDB or dependency python not properly configured?".
https://bugzilla.novell.com/show_bug.cgi?id=677225#c1

I have tried the build again. Now I get a result that is different from yesterday.

dmesg:
...
[10656.313658] genmddeps[9790]: segfault at 607bb0 ip 0000000000607bb0 sp 00007fff77ba4d38 error 15 in genmddeps[607000+1000]
[11339.164308] conftest[20445]: segfault at 600ae0 ip 0000000000600ae0 sp 00007fff009794e8 error 15 in conftest[600000+1000]
[11500.528057] genmodes[29951]: segfault at 608320 ip 0000000000608320 sp 00007fff10bfc488 error 15 in genmodes[608000+1000]


elfring@Sonne:~/Projekte/GNU/GCC/erzeugt/4.6.0/Auswahl1/gcc> valgrind --verbose --trace-children=yes --log-file=vg_log48318_%p.txt build/genmddeps /home/elfring/Projekte/GNU/GCC/Quellen/4.6.0/gcc/config/i386/i386.md > tmp-mddeps
Speicherzugriffsfehler

...
==394== Process terminating with default action of signal 11 (SIGSEGV)
==394==  Bad permissions for mapped region at address 0x607BB0
==394==    at 0x607BB0: ??? (in /home/elfring/Projekte/GNU/GCC/erzeugt/4.6.0/Auswahl1/gcc/build/genmddeps)
==394==    by 0x4036D2: read_md_files (read-md.c:1125)
==394==    by 0x4012B2: main (genmddeps.c:50)
...


elfring@Sonne:~/Projekte/GNU/GCC/erzeugt/4.6.0/Auswahl2/gcc> valgrind --verbose --trace-children=yes --log-file=vg_log48318_%p.txt build/genmodes -h > tmp-modes.h
Speicherzugriffsfehler

...
==31666== Process terminating with default action of signal 11 (SIGSEGV)
==31666==  Bad permissions for mapped region at address 0x608320
==31666==    at 0x608320: ??? (in /home/elfring/Projekte/GNU/GCC/erzeugt/4.6.0/Auswahl2/gcc/build/genmodes)
==31666==    by 0x4E4BBFC: (below main) (in /lib64/libc-2.11.3.so)
...


It seems that some files which names will be generated with the prefix "tmp-" have got a "high" probability for unexpected behaviour in the corresponding programs here.
Comment 4 Markus Elfring 2011-03-29 13:13:52 UTC
Created attachment 23800 [details]
valgrind log
Comment 5 Markus Elfring 2011-03-29 13:15:04 UTC
Created attachment 23801 [details]
valgrind log
Comment 6 Markus Elfring 2011-03-29 20:26:04 UTC
I would like to add that the previous results come from an environment where my self-generated GNU compiler 4.52 should be usually called.

I have hoped to circumvent the reported unexpected behaviour with the following configuration that specifies the tools that are provided by my Linux distribution.

elfring@Sonne:~/Projekte/GNU/GCC/erzeugt/4.6.0/Auswahl3> ~/Projekte/GNU/GCC/Quellen/4.6.0/configure --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr/local CC=/usr/bin/gcc CXX=/usr/bin/g++
...
elfring@Sonne:~/Projekte/GNU/GCC/erzeugt/4.6.0/Auswahl3> echo 'erzeugen ...' && XYZ=$(date) && make -j6 V=1 > Bauprotokoll.txt 2>&1 && date && echo "gestartet: $XYZ"
erzeugen ...


The same error happened.

"...
/bin/sh: Zeile 1:  7397 Speicherzugriffsfehler  build/genhooks /home/elfring/Projekte/GNU/GCC/Quellen/4.6.0/gcc/doc/tm.texi.in > tmp-tm.texi
make[3]: *** [s-tm-texi] Fehler 139
make[3]: *** Warte auf noch nicht beendete Prozesse...
make[3]: *** wait: Keine Kind-Prozesse.  Schluss.
make[2]: *** [all-stage2-gcc] Fehler 2
make[2]: Leaving directory `/home/elfring/Projekte/GNU/GCC/erzeugt/4.6.0/Auswahl3'
make[1]: *** [stage2-bubble] Fehler 2
make[1]: Leaving directory `/home/elfring/Projekte/GNU/GCC/erzeugt/4.6.0/Auswahl3'
make: *** [all] Fehler 2"

elfring@Sonne:~/Projekte/GNU/GCC/erzeugt/4.6.0/Auswahl3> dmesg
...
[37180.932325] genhooks[7397]: segfault at 60e880 ip 000000000060e880 sp 00007ffff159d058 error 15 in genhooks[60e000+1000]
elfring@Sonne:~/Projekte/GNU/GCC/erzeugt/4.6.0/Auswahl3/gcc> valgrind --verbose --trace-children=yes --log-file=vg_log48318_%p.txt build/genhooks /home/elfring/Projekte/GNU/GCC/Quellen/4.6.0/gcc/doc/tm.texi.in > tmp-tm.texi
Speicherzugriffsfehler
Comment 7 Markus Elfring 2011-03-29 20:32:12 UTC
Created attachment 23805 [details]
valgrind log

Will this information help to resolve the reported issues?
Comment 8 Markus Elfring 2011-03-30 14:55:34 UTC
I can also not rebuild the previously used GNU compiler software on my openSUSE 11.4 system at the moment.

"...
/bin/sh: Zeile 1:  1577 Speicherzugriffsfehler  build/genmodes -m > tmp-min-modes.c
make[3]: *** [s-modes-m] Fehler 139
make[3]: *** Warte auf noch nicht beendete Prozesse...
/bin/sh /home/elfring/Projekte/GNU/GCC/Quellen/4.5.2/gcc/../move-if-change tmp-options.h options.h
echo timestamp > s-options-h
rm gcc.pod
make[3]: Leaving directory `/home/elfring/Projekte/GNU/GCC/erzeugt/4.5.2/Auswahl2/gcc'
make[2]: *** [all-stage1-gcc] Fehler 2
make[2]: Leaving directory `/home/elfring/Projekte/GNU/GCC/erzeugt/4.5.2/Auswahl2'
make[1]: *** [stage1-bubble] Fehler 2
make[1]: Leaving directory `/home/elfring/Projekte/GNU/GCC/erzeugt/4.5.2/Auswahl2'
make: *** [all] Fehler 2"

elfring@Sonne:~/Projekte/GNU/GCC/erzeugt/4.5.2/Auswahl2/gcc> valgrind build/genmodes -m > tmp-min-modes.c
...
==24216== Process terminating with default action of signal 11 (SIGSEGV)
==24216==  Bad permissions for mapped region at address 0x608320
==24216==    at 0x608320: ??? (in /home/elfring/Projekte/GNU/GCC/erzeugt/4.5.2/Auswahl2/gcc/build/genmodes)
==24216==    by 0x4E4BBFC: (below main) (in /lib64/libc-2.11.3.so)
...
Speicherzugriffsfehler
Comment 9 Scott L. Burson 2013-04-02 01:58:21 UTC
If anyone still cares, I figured out what this was, having run into it too.

The clue is "bad permissions for mapped region".  A look at /proc/PID/maps confirms this: the region of genhooks that contains strcpy@@GLIBC_2.2.5 is mapped without execute permission.

It appears that the openSUSE 11.4 version of ld is too old for recent versions of GCC.  Installing binutils 2.23.2 has fixed the problem for me.
Comment 10 Andrew Pinski 2013-11-10 19:52:13 UTC
Closing as invalid as reported updating binutils fixes the issue.