From: "Dariem Pérez Herrera" <dariemp@uci.cu>
To: gentoo-hardened@lists.gentoo.org
Subject: Re: [gentoo-hardened] Virtualbox-OSE PIE/PIC support
Date: Wed, 03 Feb 2010 15:31:20 -0500 [thread overview]
Message-ID: <4B69DD18.6000201@uci.cu> (raw)
In-Reply-To: <4B60E0BE.8500.62243C81@pageexec.freemail.hu>
[-- Attachment #1: Type: text/plain, Size: 316 bytes --]
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).
--
Lic. Dariem Pérez Herrera
Profesor de Programación, Facultad X
Desarrollador de Nova GNU/Linux
Universidad de las Ciencias Informáticas, Cuba
[-- Attachment #2: virtualbox-ose-3.1.0-nova-hardened-pie-pic-support.patch --]
[-- Type: text/x-patch, Size: 5145 bytes --]
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;
next prev parent reply other threads:[~2010-02-03 20:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-27 6:58 [gentoo-hardened] Virtualbox-OSE PIE/PIC support Dariem Pérez Herrera
2010-01-27 10:53 ` pageexec
2010-01-27 18:56 ` Dariem Pérez Herrera
2010-01-27 23:56 ` pageexec
2010-02-03 20:31 ` Dariem Pérez Herrera [this message]
2010-01-27 18:39 ` basile
2010-01-27 20:13 ` Dariem Pérez Herrera
2010-01-27 22:59 ` Ed W
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B69DD18.6000201@uci.cu \
--to=dariemp@uci.cu \
--cc=gentoo-hardened@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox