[kernel/f18] Update ARM alignment patch to upstream
Peter Robinson
pbrobinson at fedoraproject.org
Mon Oct 29 18:04:15 UTC 2012
commit 39c7bf392f92af6bd430f8b9db2936f56254666f
Author: Peter Robinson <pbrobinson at gmail.com>
Date: Mon Oct 29 18:04:05 2012 +0000
Update ARM alignment patch to upstream
arm-alignment-faults.patch | 127 ++++++++++++++++++++
...vert-missaligned-access-check-on-put_user.patch | 83 -------------
config-arm-generic | 3 -
kernel.spec | 7 +-
4 files changed, 132 insertions(+), 88 deletions(-)
---
diff --git a/arm-alignment-faults.patch b/arm-alignment-faults.patch
new file mode 100644
index 0000000..d386a5c
--- /dev/null
+++ b/arm-alignment-faults.patch
@@ -0,0 +1,127 @@
+ arch/arm/kernel/traps.c | 34 +++++++---------------------------
+ arch/arm/mm/alignment.c | 11 ++++-------
+ 2 files changed, 11 insertions(+), 34 deletions(-)
+
+diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
+index b0179b8..62f429e 100644
+--- a/arch/arm/kernel/traps.c
++++ b/arch/arm/kernel/traps.c
+@@ -89,17 +89,8 @@ static void dump_mem(const char *lvl, const char *str, unsigned long bottom,
+ unsigned long top)
+ {
+ unsigned long first;
+- mm_segment_t fs;
+ int i;
+
+- /*
+- * We need to switch to kernel mode so that we can use __get_user
+- * to safely read from kernel space. Note that we now dump the
+- * code first, just in case the backtrace kills us.
+- */
+- fs = get_fs();
+- set_fs(KERNEL_DS);
+-
+ printk("%s%s(0x%08lx to 0x%08lx)\n", lvl, str, bottom, top);
+
+ for (first = bottom & ~31; first < top; first += 32) {
+@@ -112,7 +103,7 @@ static void dump_mem(const char *lvl, const char *str, unsigned long bottom,
+ for (p = first, i = 0; i < 8 && p < top; i++, p += 4) {
+ if (p >= bottom && p < top) {
+ unsigned long val;
+- if (__get_user(val, (unsigned long *)p) == 0)
++ if (probe_kernel_address(p, val) == 0)
+ sprintf(str + i * 9, " %08lx", val);
+ else
+ sprintf(str + i * 9, " ????????");
+@@ -120,8 +111,6 @@ static void dump_mem(const char *lvl, const char *str, unsigned long bottom,
+ }
+ printk("%s%04lx:%s\n", lvl, first & 0xffff, str);
+ }
+-
+- set_fs(fs);
+ }
+
+ static void dump_instr(const char *lvl, struct pt_regs *regs)
+@@ -129,25 +118,18 @@ static void dump_instr(const char *lvl, struct pt_regs *regs)
+ unsigned long addr = instruction_pointer(regs);
+ const int thumb = thumb_mode(regs);
+ const int width = thumb ? 4 : 8;
+- mm_segment_t fs;
+ char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str;
+ int i;
+
+- /*
+- * We need to switch to kernel mode so that we can use __get_user
+- * to safely read from kernel space. Note that we now dump the
+- * code first, just in case the backtrace kills us.
+- */
+- fs = get_fs();
+- set_fs(KERNEL_DS);
+-
+ for (i = -4; i < 1 + !!thumb; i++) {
+ unsigned int val, bad;
+
+- if (thumb)
+- bad = __get_user(val, &((u16 *)addr)[i]);
+- else
+- bad = __get_user(val, &((u32 *)addr)[i]);
++ if (thumb) {
++ u16 instr;
++ bad = probe_kernel_address(addr, instr);
++ val = instr;
++ } else
++ bad = probe_kernel_address(addr, val);
+
+ if (!bad)
+ p += sprintf(p, i == 0 ? "(%0*x) " : "%0*x ",
+@@ -158,8 +140,6 @@ static void dump_instr(const char *lvl, struct pt_regs *regs)
+ }
+ }
+ printk("%sCode: %s\n", lvl, str);
+-
+- set_fs(fs);
+ }
+
+ #ifdef CONFIG_ARM_UNWIND
+diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
+index b9f60eb..f8f14fc 100644
+--- a/arch/arm/mm/alignment.c
++++ b/arch/arm/mm/alignment.c
+@@ -749,7 +749,6 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+ unsigned long instr = 0, instrptr;
+ int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs);
+ unsigned int type;
+- mm_segment_t fs;
+ unsigned int fault;
+ u16 tinstr = 0;
+ int isize = 4;
+@@ -760,16 +759,15 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+
+ instrptr = instruction_pointer(regs);
+
+- fs = get_fs();
+- set_fs(KERNEL_DS);
+ if (thumb_mode(regs)) {
+- fault = __get_user(tinstr, (u16 *)(instrptr & ~1));
++ unsigned long ptr = instrptr;
++ fault = probe_kernel_address(ptr, tinstr);
+ if (!fault) {
+ if (cpu_architecture() >= CPU_ARCH_ARMv7 &&
+ IS_T32(tinstr)) {
+ /* Thumb-2 32-bit */
+ u16 tinst2 = 0;
+- fault = __get_user(tinst2, (u16 *)(instrptr+2));
++ fault = probe_kernel_address(ptr + 2, tinst2);
+ instr = (tinstr << 16) | tinst2;
+ thumb2_32b = 1;
+ } else {
+@@ -778,8 +776,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+ }
+ }
+ } else
+- fault = __get_user(instr, (u32 *)instrptr);
+- set_fs(fs);
++ fault = probe_kernel_address(instrptr, instr);
+
+ if (fault) {
+ type = TYPE_FAULT;
diff --git a/config-arm-generic b/config-arm-generic
index 8b7f508..e0507a0 100644
--- a/config-arm-generic
+++ b/config-arm-generic
@@ -88,9 +88,6 @@ CONFIG_STRICT_DEVMEM=y
CONFIG_SPARSE_IRQ=y
-CONFIG_DEFAULT_MMAP_MIN_ADDR=32768
-CONFIG_LSM_MMAP_MIN_ADDR=32768
-
# Generic HW for all ARM platforms
CONFIG_LEDS=y
CONFIG_LEDS_CPU=y
diff --git a/kernel.spec b/kernel.spec
index 16dfe9b..f1749a5 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -733,7 +733,7 @@ Patch19001: i82975x-edac-fix.patch
Patch21000: arm-read_current_timer.patch
Patch21001: arm-fix-omapdrm.patch
Patch21002: arm-fix_radio_shark.patch
-Patch21003: arm-linux-3.6-revert-missaligned-access-check-on-put_user.patch
+Patch21003: arm-alignment-faults.patch
# OMAP
# ARM tegra
@@ -1368,7 +1368,7 @@ ApplyPatch arm-tegra-nvec-kconfig.patch
ApplyPatch arm-tegra-usb-no-reset-linux33.patch
ApplyPatch arm-tegra-sdhci-module-fix.patch
ApplyPatch arm-highbank-sata-fix.patch
-ApplyPatch arm-linux-3.6-revert-missaligned-access-check-on-put_user.patch
+ApplyPatch arm-alignment-faults.patch
ApplyPatch arm-smdk310-regulator-fix.patch
ApplyPatch arm-origen-regulator-fix.patch
@@ -2376,6 +2376,9 @@ fi
# ||----w |
# || ||
%changelog
+* Mon Oct 29 2012 Peter Robinson <pbrobinson at fedoraproject.org>
+- Update ARM alignment patch to upstream
+
* Mon Oct 29 2012 Justin M. Forbes <jforbes at redhat.com> 3.6.4-1
- Linux 3.6.4
More information about the scm-commits
mailing list