From ed8842afb0315a3c8cb50507474e95709f6cfc3b Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 16 May 2013 16:43:20 -0400 Subject: [PATCH] Fix release to -18 as that's the build we're doing... This build: - Moves starfield to a subpackage - Doesn't allow SSE or MMX on UEFI builds (#949761) Signed-off-by: Peter Jones --- ...n-t-use-extended-registers-on-x86_64.patch | 28 +++ ...-t-disable-extended-registers-on-emu.patch | 27 +++ ...mmon-Poison-float-and-double-on-non-.patch | 48 +++++ ...ad-of-direct-assignment-for-complex-.patch | 200 ------------------ grub2.spec | 11 +- 5 files changed, 108 insertions(+), 206 deletions(-) create mode 100644 0002-configure.ac-Don-t-use-extended-registers-on-x86_64.patch create mode 100644 0003-configure.ac-Don-t-disable-extended-registers-on-emu.patch create mode 100644 0004-conf-Makefile.common-Poison-float-and-double-on-non-.patch delete mode 100644 0364-Use-memcpy-instead-of-direct-assignment-for-complex-.patch diff --git a/0002-configure.ac-Don-t-use-extended-registers-on-x86_64.patch b/0002-configure.ac-Don-t-use-extended-registers-on-x86_64.patch new file mode 100644 index 0000000..34330dc --- /dev/null +++ b/0002-configure.ac-Don-t-use-extended-registers-on-x86_64.patch @@ -0,0 +1,28 @@ +From ebef39797bef17e7a28678f4b8370e6b63e10cc4 Mon Sep 17 00:00:00 2001 +From: Vladimir 'phcoder' Serbinenko +Date: Tue, 7 May 2013 20:42:05 +0200 +Subject: [PATCH 2/5] * configure.ac: Don't use extended registers on + x86_64. Reported by: Peter Jones. + +--- + ChangeLog | 5 +++++ + configure.ac | 2 ++ + 2 files changed, 7 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 6c310f7..80549b0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -464,7 +464,9 @@ if test "x$target_cpu" = xi386; then + else + TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" + fi ++fi + ++if test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64; then + # Some toolchains enable these features by default, but they need + # registers that aren't set up properly in GRUB. + TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow" +-- +1.8.2.1 + diff --git a/0003-configure.ac-Don-t-disable-extended-registers-on-emu.patch b/0003-configure.ac-Don-t-disable-extended-registers-on-emu.patch new file mode 100644 index 0000000..b98c9a5 --- /dev/null +++ b/0003-configure.ac-Don-t-disable-extended-registers-on-emu.patch @@ -0,0 +1,27 @@ +From 780556c3e1047acbcdfa588980f52c73d9aae89a Mon Sep 17 00:00:00 2001 +From: Vladimir 'phcoder' Serbinenko +Date: Wed, 8 May 2013 11:01:11 +0200 +Subject: [PATCH 3/5] * configure.ac: Don't disable extended registers on + emu. + +--- + ChangeLog | 4 ++++ + configure.ac | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 80549b0..fa0e00a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -466,7 +466,7 @@ if test "x$target_cpu" = xi386; then + fi + fi + +-if test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64; then ++if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then + # Some toolchains enable these features by default, but they need + # registers that aren't set up properly in GRUB. + TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow" +-- +1.8.2.1 + diff --git a/0004-conf-Makefile.common-Poison-float-and-double-on-non-.patch b/0004-conf-Makefile.common-Poison-float-and-double-on-non-.patch new file mode 100644 index 0000000..df0a7f2 --- /dev/null +++ b/0004-conf-Makefile.common-Poison-float-and-double-on-non-.patch @@ -0,0 +1,48 @@ +From 5c6c289a6a6c939e7fb3f4a7ba8a737794875a44 Mon Sep 17 00:00:00 2001 +From: Vladimir 'phcoder' Serbinenko +Date: Wed, 8 May 2013 11:05:37 +0200 +Subject: [PATCH 4/5] * conf/Makefile.common: Poison float and double on + non-emu. + +--- + ChangeLog | 4 ++++ + conf/Makefile.common | 5 +++++ + util/import_gcry.py | 6 ++++++ + 3 files changed, 15 insertions(+) + +diff --git a/conf/Makefile.common b/conf/Makefile.common +index c185a55..ca1cb17 100644 +--- a/conf/Makefile.common ++++ b/conf/Makefile.common +@@ -40,6 +40,11 @@ endif + + # Other options + ++if ! COND_emu ++CFLAGS_PLATFORM += -Dfloat=__grub_poision ++CFLAGS_PLATFORM += -Ddouble=__grub_poision ++endif ++ + CPPFLAGS_DEFAULT = -DGRUB_FILE=\"$(subst $(srcdir)/,,$<)\" + CPPFLAGS_DEFAULT += -I$(builddir) + CPPFLAGS_DEFAULT += -I$(srcdir) +diff --git a/util/import_gcry.py b/util/import_gcry.py +index 18f5253..afa8e69 100644 +--- a/util/import_gcry.py ++++ b/util/import_gcry.py +@@ -488,6 +488,12 @@ for src in sorted (os.listdir (os.path.join (indir, "src"))): + fw.close () + continue + f = codecs.open (infile, "r", "utf-8") ++ if src == "types.h": ++ fw.write (f.read ().replace ("float f;", "").replace ("double g;", "")) ++ f.close () ++ fw.close () ++ continue ++ + fw.write (f.read ()) + f.close () + fw.close () +-- +1.8.2.1 + diff --git a/0364-Use-memcpy-instead-of-direct-assignment-for-complex-.patch b/0364-Use-memcpy-instead-of-direct-assignment-for-complex-.patch deleted file mode 100644 index 897020f..0000000 --- a/0364-Use-memcpy-instead-of-direct-assignment-for-complex-.patch +++ /dev/null @@ -1,200 +0,0 @@ -From 14870ff4617fd482054ceb2f307a91582e5e8817 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 18 Apr 2013 13:10:53 -0400 -Subject: [PATCH] Use memcpy instead of direct assignment for complex values. - (#949761) - -gcc 4.8.0 will emit SSE copies for such large chunks of data, and that -means using XMM0, which the UEFI ABI forbids. - -So with 4.7.2, you get: -000000000000000f : - f: 48 8b 06 mov (%rsi),%rax - 12: 48 89 47 38 mov %rax,0x38(%rdi) - 16: 48 8b 46 08 mov 0x8(%rsi),%rax - 1a: 48 89 47 40 mov %rax,0x40(%rdi) - 1e: c3 retq - -And with 4.8.0 you get: -000000000000000f : - f: 48 83 ec 18 sub $0x18,%rsp - 13: 0f 10 06 movups (%rsi),%xmm0 - 16: 0f 29 04 24 movaps %xmm0,(%rsp) - 1a: 0f 11 47 38 movups %xmm0,0x38(%rdi) - 1e: 48 83 c4 18 add $0x18,%rsp - 22: c3 retq - -As soon as we hit the movaps, we hit a trap. Once we do, though, since the -memory pointed at by the IDT is basically random memory during UEFI execution, -we find our CPU looping between the entry point for #UD (invalid opcode) and -the first piece of garbage in RAM after it. - -Right now, we have two options. Either 1) trick the compiler into not -emitting that sequence of instructions, or 2) turn off SSE instruction -generation. Number 2 currently requires making gnulib's printf not use -double or long double. It's probably the right thing to do, but I'm not -sure what the right way to do it is. - -So the following is method #1. ---- - grub-core/gfxmenu/gui_box.c | 4 ++-- - grub-core/gfxmenu/gui_canvas.c | 4 ++-- - grub-core/gfxmenu/gui_circular_progress.c | 4 ++-- - grub-core/gfxmenu/gui_image.c | 4 ++-- - grub-core/gfxmenu/gui_label.c | 4 ++-- - grub-core/gfxmenu/gui_list.c | 4 ++-- - grub-core/gfxmenu/gui_progress_bar.c | 4 ++-- - 7 files changed, 14 insertions(+), 14 deletions(-) - -diff --git a/grub-core/gfxmenu/gui_box.c b/grub-core/gfxmenu/gui_box.c -index 38b15f9..702f844 100644 ---- a/grub-core/gfxmenu/gui_box.c -+++ b/grub-core/gfxmenu/gui_box.c -@@ -264,7 +264,7 @@ static void - box_set_bounds (void *vself, const grub_video_rect_t *bounds) - { - grub_gui_box_t self = vself; -- self->bounds = *bounds; -+ memcpy(&self->bounds, bounds, sizeof (*bounds)); - self->layout_func (self, 1, 0, 0); /* Relayout the children. */ - } - -@@ -272,7 +272,7 @@ static void - box_get_bounds (void *vself, grub_video_rect_t *bounds) - { - grub_gui_box_t self = vself; -- *bounds = self->bounds; -+ memcpy(bounds, &self->bounds, sizeof (*bounds)); - } - - /* The box's preferred size is based on the preferred sizes -diff --git a/grub-core/gfxmenu/gui_canvas.c b/grub-core/gfxmenu/gui_canvas.c -index b3919c2..3d4fae9 100644 ---- a/grub-core/gfxmenu/gui_canvas.c -+++ b/grub-core/gfxmenu/gui_canvas.c -@@ -160,14 +160,14 @@ static void - canvas_set_bounds (void *vself, const grub_video_rect_t *bounds) - { - grub_gui_canvas_t self = vself; -- self->bounds = *bounds; -+ memcpy(&self->bounds, bounds, sizeof (*bounds)); - } - - static void - canvas_get_bounds (void *vself, grub_video_rect_t *bounds) - { - grub_gui_canvas_t self = vself; -- *bounds = self->bounds; -+ memcpy(bounds, &self->bounds, sizeof (*bounds)); - } - - static grub_err_t -diff --git a/grub-core/gfxmenu/gui_circular_progress.c b/grub-core/gfxmenu/gui_circular_progress.c -index e06d40c..f7684cc 100644 ---- a/grub-core/gfxmenu/gui_circular_progress.c -+++ b/grub-core/gfxmenu/gui_circular_progress.c -@@ -202,14 +202,14 @@ static void - circprog_set_bounds (void *vself, const grub_video_rect_t *bounds) - { - circular_progress_t self = vself; -- self->bounds = *bounds; -+ memcpy(&self->bounds, bounds, sizeof (*bounds)); - } - - static void - circprog_get_bounds (void *vself, grub_video_rect_t *bounds) - { - circular_progress_t self = vself; -- *bounds = self->bounds; -+ memcpy(bounds, &self->bounds, sizeof (*bounds)); - } - - static void -diff --git a/grub-core/gfxmenu/gui_image.c b/grub-core/gfxmenu/gui_image.c -index 29784ed..d864096 100644 ---- a/grub-core/gfxmenu/gui_image.c -+++ b/grub-core/gfxmenu/gui_image.c -@@ -158,7 +158,7 @@ static void - image_set_bounds (void *vself, const grub_video_rect_t *bounds) - { - grub_gui_image_t self = vself; -- self->bounds = *bounds; -+ memcpy(&self->bounds, bounds, sizeof (*bounds)); - rescale_image (self); - } - -@@ -166,7 +166,7 @@ static void - image_get_bounds (void *vself, grub_video_rect_t *bounds) - { - grub_gui_image_t self = vself; -- *bounds = self->bounds; -+ memcpy(bounds, &self->bounds, sizeof (*bounds)); - } - - /* FIXME: inform rendering system it's not forced minimum. */ -diff --git a/grub-core/gfxmenu/gui_label.c b/grub-core/gfxmenu/gui_label.c -index 637578f..daf6290 100644 ---- a/grub-core/gfxmenu/gui_label.c -+++ b/grub-core/gfxmenu/gui_label.c -@@ -134,14 +134,14 @@ static void - label_set_bounds (void *vself, const grub_video_rect_t *bounds) - { - grub_gui_label_t self = vself; -- self->bounds = *bounds; -+ memcpy(&self->bounds, bounds, sizeof (*bounds)); - } - - static void - label_get_bounds (void *vself, grub_video_rect_t *bounds) - { - grub_gui_label_t self = vself; -- *bounds = self->bounds; -+ memcpy(bounds, &self->bounds, sizeof (*bounds)); - } - - static void -diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c -index 1982d9a..23b29ba 100644 ---- a/grub-core/gfxmenu/gui_list.c -+++ b/grub-core/gfxmenu/gui_list.c -@@ -362,14 +362,14 @@ static void - list_set_bounds (void *vself, const grub_video_rect_t *bounds) - { - list_impl_t self = vself; -- self->bounds = *bounds; -+ memcpy(&self->bounds, bounds, sizeof (*bounds)); - } - - static void - list_get_bounds (void *vself, grub_video_rect_t *bounds) - { - list_impl_t self = vself; -- *bounds = self->bounds; -+ memcpy(bounds, &self->bounds, sizeof (*bounds)); - } - - static void -diff --git a/grub-core/gfxmenu/gui_progress_bar.c b/grub-core/gfxmenu/gui_progress_bar.c -index 965c6b3..4e458e9 100644 ---- a/grub-core/gfxmenu/gui_progress_bar.c -+++ b/grub-core/gfxmenu/gui_progress_bar.c -@@ -232,14 +232,14 @@ static void - progress_bar_set_bounds (void *vself, const grub_video_rect_t *bounds) - { - grub_gui_progress_bar_t self = vself; -- self->bounds = *bounds; -+ memcpy(&self->bounds, bounds, sizeof (*bounds)); - } - - static void - progress_bar_get_bounds (void *vself, grub_video_rect_t *bounds) - { - grub_gui_progress_bar_t self = vself; -- *bounds = self->bounds; -+ memcpy(bounds, &self->bounds, sizeof (*bounds)); - } - - static void --- -1.8.2.1 - diff --git a/grub2.spec b/grub2.spec index 417d1ba..f774788 100644 --- a/grub2.spec +++ b/grub2.spec @@ -41,7 +41,7 @@ Name: grub2 Epoch: 1 Version: 2.00 -Release: 19%{?dist} +Release: 18%{?dist} Summary: Bootloader with support for Linux, Multiboot and more Group: System Environment/Base @@ -415,7 +415,9 @@ Patch0360: 0360-Add-bootpath-device-to-the-list.patch Patch0361: 0361-add-GRUB_DISABLE_SUBMENU-option.patch Patch0362: 0362-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch Patch0363: 0363-Move-bash-completion-script-922997.patch -Patch0364: 0364-Use-memcpy-instead-of-direct-assignment-for-complex-.patch +Patch0364: 0002-configure.ac-Don-t-use-extended-registers-on-x86_64.patch +Patch0365: 0003-configure.ac-Don-t-disable-extended-registers-on-emu.patch +Patch0366: 0004-conf-Makefile.common-Poison-float-and-double-on-non-.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -758,7 +760,6 @@ fi %{_bindir}/%{name}-mkimage %{_bindir}/%{name}-mkpasswd-pbkdf2 %{_bindir}/%{name}-mkrelpath -%{_bindir}/%{name}-mount %{_bindir}/%{name}-glue-efi %{_bindir}/%{name}-render-label %ifnarch %{sparc} @@ -788,11 +789,9 @@ fi %{_datarootdir}/grub/themes/starfield %changelog -* Wed May 15 2013 Matthias Clasen - 2.00-19 -- Fix a typo - * Fri May 10 2013 Matthias Clasen - 2.00-18 - Move the starfield theme to a subpackage (#962004) +- Don't allow SSE or MMX on UEFI builds (#949761) * Wed Apr 24 2013 Peter Jones - 2.00-17.pj0 - Rebase to upstream snapshot.