[Nestedvm] Problem with gcc 3.3.6

Andre Pietsch andre.pietsch at advicio-servdesk.de
Wed May 11 12:21:06 EDT 2011


The patch worked great. I compiled the nestedVM without any further 
problems.

After that I compiled the c++ part with "make cxxtest" what worked fine, 
too.

Now I was able to translate a cpp file to mips without an error. When I 
try to create a class from that with

java org.ibex.nestedvm.Compiler -outfile MyAlass.class MyArray myArray.mips

I get the following error:

Exception in thread "main" org.ibex.nestedvm.util.ELF$ELFException: Bad 
Magic
         at org.ibex.nestedvm.util.ELF$ELFIdent.<init>(ELF.java:98)
         at org.ibex.nestedvm.util.ELF.<init>(ELF.java:215)
         at org.ibex.nestedvm.Compiler.<init>(Compiler.java:195)
         at 
org.ibex.nestedvm.ClassFileCompiler.<init>(ClassFileCompiler.java:64)
         at 
org.ibex.nestedvm.ClassFileCompiler.<init>(ClassFileCompiler.java:54)
         at org.ibex.nestedvm.Compiler.main(Compiler.java:152)

Google has no clue about "Bad Magic" within elfs. What could I look for?

Kind regards


Andre



Am 10.05.2011 19:12, schrieb Matthias Fratz:
> Hi,
>
> When I compiled it I "fixed" that buffer overflow by disabling Ubuntu's
> stack protector using -fno-stack-protector -U_FORTIFY_SOURCE. It's a
> terrible hack but it appears to work quite well; so far none of my nested
> programs has misbehaved.
>
> Applying the attached patch used to work on my 32-bit system a few months
> back, however by now the nestedvm build fails to find some "classgen" --
> probably unrelated to the patch itsself but it means I cannot easily test it
> now. The patch doesn't involve anything 32bit-ish, but it blindly overrides
> the CFLAGS, so it may or may not work on the 64-bit version.
>
> That thing's actually been on the list for a few months but was completely
> ignored, so even though it worked fine for me, I suppose I made some really
> embarassing mistake, so be careful.
>
> - Matthias
>
>
> On 10.05.2011 16:49, Andre Pietsch wrote:
>> OK...
>>
>> I googled it and somone changed the line 1575 in the collect2.c file to:
>>
>> redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT, 0644)
>>
>> that seemd to work but now I get the following buffer overflow:
>>
>> ------------snip--------------
>> *** buffer overflow detected ***: mips-unknown-elf-ar terminated
>> ======= Backtrace: =========
>> /lib/libc.so.6(__fortify_fail+0x37)[0x2ad20f6bb537]
>> /lib/libc.so.6(+0xfe3f0)[0x2ad20f6ba3f0]
>> /lib/libc.so.6(+0xfd859)[0x2ad20f6b9859]
>> /lib/libc.so.6(_IO_default_xsputn+0xcc)[0x2ad20f631c2c]
>> /lib/libc.so.6(_IO_padn+0xe8)[0x2ad20f6256e8]
>> /lib/libc.so.6(_IO_vfprintf+0x2af3)[0x2ad20f604133]
>> /lib/libc.so.6(__vsprintf_chk+0x99)[0x2ad20f6b98f9]
>> /lib/libc.so.6(__sprintf_chk+0x7f)[0x2ad20f6b983f]
>> mips-unknown-elf-ar[0x409824]
>> mips-unknown-elf-ar[0x407a81]
>> mips-unknown-elf-ar[0x40a0cd]
>> mips-unknown-elf-ar[0x40d3f7]
>> mips-unknown-elf-ar[0x40457f]
>> mips-unknown-elf-ar[0x404a3d]
>> mips-unknown-elf-ar[0x4053d2]
>> /lib/libc.so.6(__libc_start_main+0xfe)[0x2ad20f5dad8e]
>> mips-unknown-elf-ar[0x401c89]
>> ======= Memory map: ========
>> 00400000-00469000 r-xp 00000000 08:01 214720
>>
>> /home/andrepietsch/software/nestedvm/upstream/install/bin/mips-unknown-elf-ar
>> 00668000-00669000 r--p 00068000 08:01 214720
>>
>> /home/andrepietsch/software/nestedvm/upstream/install/bin/mips-unknown-elf-ar
>> 00669000-0066a000 rw-p 00069000 08:01 214720
>>
>> /home/andrepietsch/software/nestedvm/upstream/install/bin/mips-unknown-elf-ar
>> 0066a000-0066c000 rw-p 00000000 00:00 0
>> 01804000-01ebe000 rw-p 00000000 00:00 0
>>    [heap]
>> 2ad20f399000-2ad20f3b9000 r-xp 00000000 08:01 164673
>>    /lib/ld-2.12.1.so
>> 2ad20f3b9000-2ad20f3bb000 rw-p 00000000 00:00 0
>> 2ad20f5b9000-2ad20f5ba000 r--p 00020000 08:01 164673
>>    /lib/ld-2.12.1.so
>> 2ad20f5ba000-2ad20f5bb000 rw-p 00021000 08:01 164673
>>    /lib/ld-2.12.1.so
>> 2ad20f5bb000-2ad20f5bc000 rw-p 00000000 00:00 0
>> 2ad20f5bc000-2ad20f736000 r-xp 00000000 08:01 164665
>>    /lib/libc-2.12.1.so
>> 2ad20f736000-2ad20f935000 ---p 0017a000 08:01 164665
>>    /lib/libc-2.12.1.so
>> 2ad20f935000-2ad20f939000 r--p 00179000 08:01 164665
>>    /lib/libc-2.12.1.so
>> 2ad20f939000-2ad20f93a000 rw-p 0017d000 08:01 164665
>>    /lib/libc-2.12.1.so
>> 2ad20f93a000-2ad20f941000 rw-p 00000000 00:00 0
>> 2ad20f941000-2ad20fbe5000 r--p 00000000 08:01 14
>>    /usr/lib/locale/locale-archive
>> 2ad20fbe5000-2ad20fbec000 r--s 00000000 08:01 2057
>>    /usr/lib/gconv/gconv-modules.cache
>> 2ad20fbec000-2ad20fbf6000 rw-p 00000000 00:00 0
>> 2ad20fc11000-2ad20fc26000 r-xp 00000000 08:01 133437
>>    /lib/libgcc_s.so.1
>> 2ad20fc26000-2ad20fe25000 ---p 00015000 08:01 133437
>>    /lib/libgcc_s.so.1
>> 2ad20fe25000-2ad20fe26000 r--p 00014000 08:01 133437
>>    /lib/libgcc_s.so.1
>> 2ad20fe26000-2ad20fe27000 rw-p 00015000 08:01 133437
>>    /lib/libgcc_s.so.1
>> 7ffffaf6a000-7ffffaf8d000 rw-p 00000000 00:00 0
>>    [stack]
>> 7ffffafff000-7ffffb000000 r-xp 00000000 00:00 0
>>    [vdso]
>> ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
>>    [vsyscall]
>> make[4]: *** [libgcc.a] Aborted
>> make[4]: *** Deleting file `libgcc.a'
>> make[4]: Leaving directory
>> `/home/andrepietsch/software/nestedvm/upstream/build/gcc-obj/gcc'
>> make[3]: *** [stmp-multilib] Error 2
>> make[3]: Leaving directory
>> `/home/andrepietsch/software/nestedvm/upstream/build/gcc-obj/gcc'
>> make[2]: *** [all-gcc] Error 2
>> make[2]: Leaving directory
>> `/home/andrepietsch/software/nestedvm/upstream/build/gcc-obj'
>> make[1]: *** [tasks/build_gcc] Error 2
>> make[1]: Leaving directory `/home/andrepietsch/software/nestedvm/upstream'
>> make: *** [upstream/tasks/build_gcc] Error 2
>> -----------------snap--------------
>>
>> could it be a problem with the 64 bit version of the installed ubuntu?
>>
>> regards
>>
>>
>> andre
>>
>>
>> Am 10.05.2011 16:34, schrieb Andre Pietsch:
>>> Hi,
>>>
>>> I tried to compile nestedVM under cygwin and it worked. Because of
>>> problems with the project I wanted to "nestVM" I had to switch to
>>> current ubuntu version. The checkout and start of the compilation worked
>>> but I get the following error:
>>>
>>> In file included from /usr/include/fcntl.h:252,
>>>                     from ../../gcc-3.3.6/gcc/system.h:208,
>>>                     from ../../gcc-3.3.6/gcc/collect2.c:30:
>>> In function "open",
>>>        inlined from "collect_execute" at ../../gcc-3.3.6/gcc/collect2.c:1575:
>>> /usr/include/bits/fcntl2.h:51: error: call to "__open_missing_mode"
>>> declared with attribute error: open with O_CREAT in second argument
>>> needs 3 arguments
>>> make[3]: *** [collect2.o] Error 1
>>> make[3]: Leaving directory
>>> `/home/andrepietsch/software/nestedvm/upstream/build/gcc-obj/gcc'
>>> make[2]: *** [all-gcc] Error 2
>>> make[2]: Leaving directory
>>> `/home/andrepietsch/software/nestedvm/upstream/build/gcc-obj'
>>> make[1]: *** [tasks/build_gcc] Error 2
>>> make[1]: Leaving directory `/home/andrepietsch/software/nestedvm/upstream'
>>> make: *** [upstream/tasks/build_gcc] Error 2
>>>
>>> Has anyone a clue what that means?
>>>
>>> Andre
>>
>> _______________________________________________
>> Nestedvm mailing list
>> Nestedvm at lists.hcoop.net
>> https://lists.hcoop.net/listinfo/nestedvm
>>
>



More information about the Nestedvm mailing list