[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] x86/boot: Drop .note.gnu.properties in build32.lds



reloc.S and cmdline.S as arrays of executable bytes for inclusion in
head.S generated from compiled object files.  Object files generated by
an -fcf-protection toolchain include a .note.gnu.property section.  The
way reloc.S and cmdline.S are generated, the bytes of .note.gnu.property
become the start of the .S files.  When head.S calls reloc or
cmdline_parse_early, those note bytes are executed instead of the
intended .text section.  This results in an early crash in reloc.

Discard the .note.gnu.property section when linking to avoid the extra
bytes.

Stefan Bader also noticed that build32.mk requires -fcf-protection=none
or else the hypervisor will not boot.
https://bugs.launchpad.net/ubuntu/+source/gcc-9/+bug/1863260

CC: Stefan Bader <stefan.bader@xxxxxxxxxxxxx>
Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx>
---
 xen/arch/x86/boot/build32.lds | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds
index da35aee910..0f69765579 100644
--- a/xen/arch/x86/boot/build32.lds
+++ b/xen/arch/x86/boot/build32.lds
@@ -48,5 +48,10 @@ SECTIONS
          * Please check build32.mk for more details.
          */
         /* *(.got.plt) */
+        /*
+         * The note will end up before the .text section and be called
+         * incorrectly as instructions.
+         */
+        *(.note.gnu.property)
   }
 }
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.