From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Ncluj-0000R1-Jg for garchives@archives.gentoo.org; Wed, 03 Feb 2010 20:33:31 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7DBBEE09B0; Wed, 3 Feb 2010 20:31:32 +0000 (UTC) Received: from mx3.uci.cu (ns3.uci.cu [200.55.140.180]) by pigeon.gentoo.org (Postfix) with SMTP id BAECFE09B0 for ; Wed, 3 Feb 2010 20:31:29 +0000 (UTC) Received: (qmail 16956 invoked by uid 507); 3 Feb 2010 20:31:21 -0000 Received: from 10.0.0.184 by ns3.uci.cu (envelope-from , uid 501) with qmail-scanner-2.01st (avp: 5.0.2.0. spamassassin: 3.0.6. perlscan: 2.01st. Clear:RC:1(10.0.0.184):. Processed in 0.660289 secs); 03 Feb 2010 20:31:21 -0000 Received: from unknown (HELO ucimail3.uci.cu) (10.0.0.184) by 0 with SMTP; 3 Feb 2010 20:31:21 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by ucimail3.uci.cu (Postfix) with ESMTP id 15C891E8C056 for ; Wed, 3 Feb 2010 15:31:21 -0500 (CST) X-Virus-Scanned: amavisd-new at uci.cu Received: from ucimail3.uci.cu ([127.0.0.1]) by localhost (ucimail3.uci.cu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2kFlwcWnxnta; Wed, 3 Feb 2010 15:31:20 -0500 (CST) Received: from [10.33.30.51] (ingles313.uci.cu [10.33.30.51]) by ucimail3.uci.cu (Postfix) with ESMTP id 91B4E1E8C091 for ; Wed, 3 Feb 2010 15:31:20 -0500 (CST) Message-ID: <4B69DD18.6000201@uci.cu> Date: Wed, 03 Feb 2010 15:31:20 -0500 From: =?ISO-8859-1?Q?Dariem_P=E9rez_Herrera?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20100123 Lightning/1.0pre Shredder/3.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-hardened@lists.gentoo.org Reply-to: gentoo-hardened@lists.gentoo.org MIME-Version: 1.0 To: gentoo-hardened@lists.gentoo.org Subject: Re: [gentoo-hardened] Virtualbox-OSE PIE/PIC support References: <4B5FE429.9080903@uci.cu>, <4B60293F.3460.5F577321@pageexec.freemail.hu>, <4B608C50.8040308@uci.cu> <4B60E0BE.8500.62243C81@pageexec.freemail.hu> In-Reply-To: <4B60E0BE.8500.62243C81@pageexec.freemail.hu> Content-Type: multipart/mixed; boundary="------------000403090306030607080409" X-Archives-Salt: 74fb49df-1840-44c3-80f8-6954ebfe9949 X-Archives-Hash: 4d979ed905547911f23cb27b1832a810 This is a multi-part message in MIME format. --------------000403090306030607080409 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable If anyone if having trouble compiling virtualbox-ose-3.1.0 with gcc-4.3.4 (hardened, with PIE/PIC and SSP), here is a possible solution (patch attached). --=20 Lic. Dariem P=E9rez Herrera Profesor de Programaci=F3n, Facultad X Desarrollador de Nova GNU/Linux Universidad de las Ciencias Inform=E1ticas, Cuba --------------000403090306030607080409 Content-Type: text/x-patch; name="virtualbox-ose-3.1.0-nova-hardened-pie-pic-support.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="virtualbox-ose-3.1.0-nova-hardened-pie-pic-support.patch" diff -rud VirtualBox-3.1.0_OSE_Orig/src/VBox/Devices/PC/Etherboot-src/arch/i386/core/pci_io.c VirtualBox-3.1.0_OSE/src/VBox/Devices/PC/Etherboot-src/arch/i386/core/pci_io.c --- VirtualBox-3.1.0_OSE_Orig/src/VBox/Devices/PC/Etherboot-src/arch/i386/core/pci_io.c 2009-03-13 06:38:36.000000000 -0400 +++ VirtualBox-3.1.0_OSE/src/VBox/Devices/PC/Etherboot-src/arch/i386/core/pci_io.c 2010-01-27 04:39:46.000000000 -0500 @@ -112,13 +112,30 @@ unsigned long length; /* %ecx */ unsigned long entry; /* %edx */ - __asm__(BIOS32_CALL + __asm__( +#if __PIC__ + "pushl %%ebx\n" + "movl %%ecx, %%ebx\n" +#endif + BIOS32_CALL +#if __PIC__ + "movl %%ebx, %1\n" + "pop %%ebx\n" +#endif : "=a" (return_code), +#if __PIC__ + "=m" (address), +#else "=b" (address), +#endif "=c" (length), "=d" (entry) : "0" (service), +#if __PIC__ + "2" (0), +#else "1" (0), +#endif "S" (bios32_entry)); switch (return_code) { @@ -140,14 +157,26 @@ unsigned long ret; unsigned long bx = (bus << 8) | device_fn; - __asm__(BIOS32_CALL + __asm__( +#if __PIC__ + "pushl %%ebx\n" + "movl %3, %%ebx\n" +#endif + BIOS32_CALL "jc 1f\n\t" "xor %%ah, %%ah\n" +#if __PIC__ + "pop %%ebx\n" +#endif "1:" : "=c" (*value), "=a" (ret) : "1" (PCIBIOS_READ_CONFIG_BYTE), +#if __PIC__ + "m" (bx), +#else "b" (bx), +#endif "D" ((long) where), "S" (pcibios_entry)); return (int) (ret & 0xff00) >> 8; @@ -159,14 +188,26 @@ unsigned long ret; unsigned long bx = (bus << 8) | device_fn; - __asm__(BIOS32_CALL + __asm__( +#if __PIC__ + "pushl %%ebx\n" + "movl %3, %%ebx\n" +#endif + BIOS32_CALL "jc 1f\n\t" "xor %%ah, %%ah\n" +#if __PIC__ + "pop %%ebx\n" +#endif "1:" : "=c" (*value), "=a" (ret) : "1" (PCIBIOS_READ_CONFIG_WORD), +#if __PIC__ + "m" (bx), +#else "b" (bx), +#endif "D" ((long) where), "S" (pcibios_entry)); return (int) (ret & 0xff00) >> 8; @@ -178,14 +219,26 @@ unsigned long ret; unsigned long bx = (bus << 8) | device_fn; - __asm__(BIOS32_CALL + __asm__( +#if __PIC__ + "pushl %%ebx\n" + "movl %3, %%ebx\n" +#endif + BIOS32_CALL "jc 1f\n\t" "xor %%ah, %%ah\n" +#if __PIC__ + "pop %%ebx\n" +#endif "1:" : "=c" (*value), "=a" (ret) : "1" (PCIBIOS_READ_CONFIG_DWORD), +#if __PIC__ + "m" (bx), +#else "b" (bx), +#endif "D" ((long) where), "S" (pcibios_entry)); return (int) (ret & 0xff00) >> 8; @@ -197,14 +250,26 @@ unsigned long ret; unsigned long bx = (bus << 8) | device_fn; - __asm__(BIOS32_CALL + __asm__( +#if __PIC__ + "pushl %%ebx\n" + "movl %3, %%ebx\n" +#endif + BIOS32_CALL "jc 1f\n\t" "xor %%ah, %%ah\n" +#if __PIC__ + "pop %%ebx\n" +#endif "1:" : "=a" (ret) : "0" (PCIBIOS_WRITE_CONFIG_BYTE), "c" (value), - "b" (bx), +#if __PIC__ + "m" (bx), +#else + "b" (bx), +#endif "D" ((long) where), "S" (pcibios_entry)); return (int) (ret & 0xff00) >> 8; @@ -216,14 +281,26 @@ unsigned long ret; unsigned long bx = (bus << 8) | device_fn; - __asm__(BIOS32_CALL + __asm__( +#if __PIC__ + "pushl %%ebx\n" + "movl %3, %%ebx\n" +#endif + BIOS32_CALL "jc 1f\n\t" "xor %%ah, %%ah\n" +#if __PIC__ + "pop %%ebx\n" +#endif "1:" : "=a" (ret) : "0" (PCIBIOS_WRITE_CONFIG_WORD), "c" (value), - "b" (bx), +#if __PIC__ + "m" (bx), +#else + "b" (bx), +#endif "D" ((long) where), "S" (pcibios_entry)); return (int) (ret & 0xff00) >> 8; @@ -235,14 +312,26 @@ unsigned long ret; unsigned long bx = (bus << 8) | device_fn; - __asm__(BIOS32_CALL + __asm__( +#if __PIC__ + "pushl %%ebx\n" + "movl %3, %%ebx\n" +#endif + BIOS32_CALL "jc 1f\n\t" "xor %%ah, %%ah\n" +#if __PIC__ + "pop %%ebx\n" +#endif "1:" : "=a" (ret) : "0" (PCIBIOS_WRITE_CONFIG_DWORD), "c" (value), - "b" (bx), +#if __PIC__ + "m" (bx), +#else + "b" (bx), +#endif "D" ((long) where), "S" (pcibios_entry)); return (int) (ret & 0xff00) >> 8; @@ -257,17 +346,27 @@ int pack; if ((pcibios_entry = bios32_service(PCI_SERVICE))) { - __asm__(BIOS32_CALL + __asm__( +#if __PIC__ + "pushl %%ebx\n" +#endif + BIOS32_CALL "jc 1f\n\t" "xor %%ah, %%ah\n" "1:\tshl $8, %%eax\n\t" - "movw %%bx, %%ax" + "movw %%bx, %%ax\n" +#if __PIC__ + "pop %%ebx\n" +#endif : "=d" (signature), "=a" (pack) : "1" (PCIBIOS_PCI_BIOS_PRESENT), "S" (pcibios_entry) +#if __PIC__ + : "cx"); +#else : "bx", "cx"); - +#endif present_status = (pack >> 16) & 0xff; major_revision = (pack >> 8) & 0xff; minor_revision = pack & 0xff; --------------000403090306030607080409--