summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-05-23 19:13:24 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-05-23 19:13:24 +0200
commit82ecb836995c5abd172739d07182cf0089058728 (patch)
tree86aee513f979efe1435cb887aac14df72ca84897 /debian/patches
parentcaef262a89136bdbef9dc750e46912a98086c557 (diff)
add patch series
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/series3
-rw-r--r--debian/patches/strict-aliasing0001-kern-avoid-breaking-the-strict-aliasing-rules.patch47
-rw-r--r--debian/patches/strict-aliasing0002-i386-avoid-breaking-the-strict-aliasing-rules.patch33
-rw-r--r--debian/patches/strict-aliasing0003-Restrict-fno-strict-aliasing-to-the-Linux-drivers.patch47
4 files changed, 130 insertions, 0 deletions
diff --git a/debian/patches/series b/debian/patches/series
index fa6ae31..186db4c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -12,3 +12,6 @@ sysenter0001-yyy-sysenter-prototype.patch
vm-cache-policy0001-VM-cache-policy-change.patch
vm-cache-policy0002-vm-keep-track-of-clean-pages.patch
vm-cache-policy0003-vm-evict-clean-pages-first.patch
+strict-aliasing0001-kern-avoid-breaking-the-strict-aliasing-rules.patch
+strict-aliasing0002-i386-avoid-breaking-the-strict-aliasing-rules.patch
+strict-aliasing0003-Restrict-fno-strict-aliasing-to-the-Linux-drivers.patch
diff --git a/debian/patches/strict-aliasing0001-kern-avoid-breaking-the-strict-aliasing-rules.patch b/debian/patches/strict-aliasing0001-kern-avoid-breaking-the-strict-aliasing-rules.patch
new file mode 100644
index 0000000..7fa72b9
--- /dev/null
+++ b/debian/patches/strict-aliasing0001-kern-avoid-breaking-the-strict-aliasing-rules.patch
@@ -0,0 +1,47 @@
+From 96ade86f9f410cee6377f60530bcc3aa89b20402 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sat, 23 May 2015 18:23:45 +0200
+Subject: [PATCH gnumach 1/3] kern: avoid breaking the strict-aliasing rules
+
+* kern/exception.c (exception_parse_reply): Use `BAD_TYPECHECK'.
+---
+ kern/exception.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/kern/exception.c b/kern/exception.c
+index 6e84c0a..6cb3bfb 100644
+--- a/kern/exception.c
++++ b/kern/exception.c
+@@ -48,6 +48,7 @@
+ #include <kern/sched.h>
+ #include <kern/sched_prim.h>
+ #include <kern/exception.h>
++#include <kern/macros.h>
+ #include <mach/machine/vm_types.h>
+
+ #if MACH_KDB
+@@ -754,6 +755,12 @@ exception_raise(
+ }
+ }
+
++/* Macro used by MIG to cleanly check the type. */
++#define BAD_TYPECHECK(type, check) unlikely (({\
++ union { mach_msg_type_t t; unsigned32_t w; } _t, _c;\
++ _t.t = *(type); _c.t = *(check);_t.w != _c.w; }))
++
++/* Type descriptor for the return code. */
+ mach_msg_type_t exc_RetCode_proto = {
+ /* msgt_name = */ MACH_MSG_TYPE_INTEGER_32,
+ /* msgt_size = */ 32,
+@@ -786,7 +793,7 @@ exception_parse_reply(ipc_kmsg_t kmsg)
+ MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0)) ||
+ (msg->Head.msgh_size != sizeof *msg) ||
+ (msg->Head.msgh_id != MACH_EXCEPTION_REPLY_ID) ||
+- (* (int *) &msg->RetCodeType != * (int *) &exc_RetCode_proto)) {
++ (BAD_TYPECHECK(&msg->RetCodeType, &exc_RetCode_proto))) {
+ /*
+ * Bozo user sent us a misformatted reply.
+ */
+--
+2.1.4
+
diff --git a/debian/patches/strict-aliasing0002-i386-avoid-breaking-the-strict-aliasing-rules.patch b/debian/patches/strict-aliasing0002-i386-avoid-breaking-the-strict-aliasing-rules.patch
new file mode 100644
index 0000000..01c6889
--- /dev/null
+++ b/debian/patches/strict-aliasing0002-i386-avoid-breaking-the-strict-aliasing-rules.patch
@@ -0,0 +1,33 @@
+From 6af2316771841cd4d2770fae00d3d147aa11a5d9 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sat, 23 May 2015 18:51:56 +0200
+Subject: [PATCH gnumach 2/3] i386: avoid breaking the strict-aliasing rules
+
+* i386/i386/pcb.c (switch_ktss): Cleanly convert the value.
+---
+ i386/i386/pcb.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c
+index dabe481..3a0eba0 100644
+--- a/i386/i386/pcb.c
++++ b/i386/i386/pcb.c
+@@ -193,8 +193,14 @@ void switch_ktss(pcb_t pcb)
+ for (i=0; i < USER_GDT_SLOTS; i++) {
+ if (memcmp(gdt_desc_p (mycpu, USER_GDT + (i << 3)),
+ &pcb->ims.user_gdt[i], sizeof pcb->ims.user_gdt[i])) {
++ union {
++ struct real_descriptor real_descriptor;
++ uint64_t descriptor;
++ } user_gdt;
++ user_gdt.real_descriptor = pcb->ims.user_gdt[i];
++
+ if (hyp_do_update_descriptor(kv_to_ma(gdt_desc_p (mycpu, USER_GDT + (i << 3))),
+- *(uint64_t *) &pcb->ims.user_gdt[i]))
++ user_gdt.descriptor))
+ panic("couldn't set user gdt %d\n",i);
+ }
+ }
+--
+2.1.4
+
diff --git a/debian/patches/strict-aliasing0003-Restrict-fno-strict-aliasing-to-the-Linux-drivers.patch b/debian/patches/strict-aliasing0003-Restrict-fno-strict-aliasing-to-the-Linux-drivers.patch
new file mode 100644
index 0000000..63494ff
--- /dev/null
+++ b/debian/patches/strict-aliasing0003-Restrict-fno-strict-aliasing-to-the-Linux-drivers.patch
@@ -0,0 +1,47 @@
+From b2b8bf37934087f8fb2a246316ecf9e91955ec57 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sat, 23 May 2015 19:06:10 +0200
+Subject: [PATCH gnumach 3/3] Restrict `-fno-strict-aliasing' to the Linux
+ drivers
+
+* Makefile.am: Move `-fno-strict-aliasing'...
+* linux/Makefrag.am: ... here.
+---
+ Makefile.am | 4 ----
+ linux/Makefrag.am | 5 +++++
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index eb940cb..913db55 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -59,10 +59,6 @@ AM_CFLAGS += \
+ AM_CFLAGS += \
+ -Wall
+
+-# See <http://lists.gnu.org/archive/html/bug-hurd/2006-01/msg00148.html>.
+-AM_CFLAGS += \
+- -fno-strict-aliasing
+-
+ # We need the GNU-style inline
+ AM_CFLAGS += \
+ -fgnu89-inline
+diff --git a/linux/Makefrag.am b/linux/Makefrag.am
+index 0973f11..1b69010 100644
+--- a/linux/Makefrag.am
++++ b/linux/Makefrag.am
+@@ -36,6 +36,11 @@ liblinux_a_CPPFLAGS = $(AM_CPPFLAGS) \
+ # Because of the use of `extern inline' in some Linux header files without
+ # corresponding text segment definitions, we must always optimize.
+ liblinux_a_CFLAGS = -O2 $(AM_CFLAGS)
++
++# See <http://lists.gnu.org/archive/html/bug-hurd/2006-01/msg00148.html>.
++liblinux_a_CFLAGS += \
++ -fno-strict-aliasing
++
+ # TODO. Do we really need `-traditional'?
+ liblinux_a_CCASFLAGS = $(AM_CCASFLAGS) \
+ -D__ASSEMBLY__ -traditional \
+--
+2.1.4
+