Gentoo Archives: gentoo-hardened

From: Alexander Tsoy <alexander@××××.me>
To: gentoo-hardened@l.g.o
Subject: Re: [gentoo-hardened] erlang fails to install on kvm guest (illegal instruction)
Date: Tue, 20 Nov 2012 18:03:08
Message-Id: 20121120201356.4fd02f6a@work.puleglot
In Reply to: Re: [gentoo-hardened] erlang fails to install on kvm guest (illegal instruction) by Yannis Kontekakis
1 ÷ Tue, 20 Nov 2012 17:50:36 +0200
2 Yannis Kontekakis <tolis@×××××××××××.gr> ÐÉÛÅÔ:
3
4 > On 11/20/2012 05:34 PM, Alexander Tsoy wrote:
5 > > ÷ Tue, 20 Nov 2012 16:54:39 +0200
6 > > Yannis Kontekakis<tolis@×××××××××××.gr> ÐÉÛÅÔ:
7 > >
8 > >> Hello,
9 > >>
10 > >> I am trying to install erlang on a hardened amd64 gentoo system running
11 > >> on a kvm guest. The use flags and version of erlang are the following:
12 > >>
13 > >> dev-lang/erlang-15.2 USE="hipe java kpoll odbc smp ssl -compat-ethread
14 > >> -doc -emacs -halfword -sctp -tk -wxwidgets"
15 > >>
16 > >> my CFLAGS are:
17 > >> CFLAGS="-march=core2 -O2 -pipe"
18 > >> CXXFLAGS="${CFLAGS}"
19 > >>
20 > >> cat /proc/cpuinfo reports 4 cores of:
21 > >>
22 > >> processor : 3
23 > >> vendor_id : AuthenticAMD
24 > >> cpu family : 6
25 > >> model : 2
26 > >> model name : QEMU Virtual CPU version 1.0
27 > >> stepping : 3
28 > >> microcode : 0x1000065
29 > >> cpu MHz : 2100.278
30 > >> cache size : 512 KB
31 > >> fpu : yes
32 > >> fpu_exception : yes
33 > >> cpuid level : 4
34 > >> wp : yes
35 > >> flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
36 > >> pat pse36 clflush mmx fxsr sse sse2 syscall nx lm nopl pni cx16 popcnt
37 > >> hypervisor lahf_lm svm abm sse4a
38 > >> bogomips : 4200.55
39 > >> TLB size : 1024 4K pages
40 > >> clflush size : 64
41 > >> cache_alignment : 64
42 > >> address sizes : 40 bits physical, 48 bits virtual
43 > >> power management:
44 > >>
45 > >> the error message that emerge prints while dying:
46 > >>
47 > >> === Entering application hipe
48 > >> make[3]: Entering directory
49 > >> `/var/tmp/portage/dev-lang/erlang-15.2/work/otp_src_R15B/lib/hipe/rtl'
50 > >> (cd ../main&& make hipe.hrl)
51 > >> make[4]: Entering directory
52 > >> `/var/tmp/portage/dev-lang/erlang-15.2/work/otp_src_R15B/lib/hipe/main'
53 > >> sed -e "s;%VSN%;3.9;" ../../hipe/main/hipe.hrl.src>
54 > >> ../../hipe/main/hipe.hrl
55 > >> make[4]: Leaving directory
56 > >> `/var/tmp/portage/dev-lang/erlang-15.2/work/otp_src_R15B/lib/hipe/main'
57 > >> erlc -W +debug_info +inline -o../ebin hipe_rtl.erl
58 > >> make[3]: *** [../ebin/hipe_rtl.beam] Illegal instruction
59 > >> make[3]: Leaving directory
60 > >> `/var/tmp/portage/dev-lang/erlang-15.2/work/otp_src_R15B/lib/hipe/rtl'
61 > >> make[2]: *** [opt] Error 2
62 > >> make[2]: Leaving directory
63 > >> `/var/tmp/portage/dev-lang/erlang-15.2/work/otp_src_R15B/lib/hipe'
64 > >> make[1]: *** [opt] Error 2
65 > >> make[1]: Leaving directory
66 > >> `/var/tmp/portage/dev-lang/erlang-15.2/work/otp_src_R15B/lib'
67 > >> make: *** [secondary_bootstrap_build] Error 2
68 > >> emake failed
69 > >> * ERROR: dev-lang/erlang-15.2 failed (compile phase):
70 > >> * (no error message)
71 > >> *
72 > >> * Call stack:
73 > >> * ebuild.sh, line 93: Called src_compile
74 > >> * environment, line 3965: Called die
75 > >> * The specific snippet of code:
76 > >> * emake -j1 || die;
77 > >> *
78 > >>
79 > >> And finally, dmesg reports:
80 > >> beam.smp[27752] trap invalid opcode ip:54b49c00c4 sp:3d9f459d3f0 error:0
81 > >> in beam.smp[54b48e4000+261000]
82 > >>
83 > >> Emerging erlang on my desktop(a similar hardened gentoo setup) completes
84 > >> successfully. The only thing I can think of is that something is wrong
85 > >> with my CFLAGS(but this is just an assumption).
86 > >>
87 > >> Any help would be appreciated
88 > >>
89 > >> Regards,
90 > >>
91 > >> Yannis
92 > >>
93 > > It seems that KVM host is and AMD-based system. I suggest you to drop
94 > > "-march=core2" from CFLAGS. Or if you do not plan to migrate this VM
95 > > you can also try to replace it with something like "-march=amdfam10
96 > > -mno-3dnow". :)
97 > >
98 >
99 > I thought so... I now have to rebuild the whole world :) Is anyone aware
100 > of an -march value that can be used interchangeably between 64bit intel
101 > & amd cpus? The kvm host is not under my administration, so at any time
102 > my guest could be switched between hosts.
103 >
104
105 Simply do not use -march:
106 CFLAGS="-O2 -pipe"
107 Binaries compiled with this cflags should work on any x86_64 system.
108
109 --
110 With best regards,
111 Alexander Tsoy

Replies

Subject Author
Re: [gentoo-hardened] erlang fails to install on kvm guest (illegal instruction) Yannis Kontekakis <tolis@×××××××××××.gr>