From 484d1aef7c83a3819cd343e26b530b1cbda41763 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 27 Sep 2015 14:16:59 +0100 Subject: [PATCH] [mips*] pgtable-bits.h: Correct _PAGE_GLOBAL_SHIFT build failure This was a regression in 4.0, but not a build failure for us. --- debian/changelog | 2 + ...s.h-correct-_page_global_shift-build.patch | 88 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 91 insertions(+) create mode 100644 debian/patches/bugfix/mips/mips-pgtable-bits.h-correct-_page_global_shift-build.patch diff --git a/debian/changelog b/debian/changelog index 54cd56372..ba0b484a1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,8 @@ linux (4.2.1-2) UNRELEASED; urgency=medium * [hppa/parisc64-smp,mips*el/loongson-3] udeb: Remove i2c-modules again, as the drivers that belong in it are actually built-in (fixes FTBFS) * sctp: fix race on protocol/netns initialization (CVE-2015-5283) + * [mips*] pgtable-bits.h: Correct _PAGE_GLOBAL_SHIFT build failure + (regression in 4.0, but not a build failure for us) -- Ben Hutchings Sat, 26 Sep 2015 16:40:51 +0100 diff --git a/debian/patches/bugfix/mips/mips-pgtable-bits.h-correct-_page_global_shift-build.patch b/debian/patches/bugfix/mips/mips-pgtable-bits.h-correct-_page_global_shift-build.patch new file mode 100644 index 000000000..b306671b0 --- /dev/null +++ b/debian/patches/bugfix/mips/mips-pgtable-bits.h-correct-_page_global_shift-build.patch @@ -0,0 +1,88 @@ +From: "Maciej W. Rozycki" +Date: Sun, 3 May 2015 10:36:19 +0100 +Subject: MIPS: pgtable-bits.h: Correct _PAGE_GLOBAL_SHIFT build failure +Origin: https://git.kernel.org/linus/1cfa8de2880e5512f9037c7804ea47a79cc8232c + +Correct a build failure introduced by be0c37c9 [MIPS: Rearrange PTE bits +into fixed positions.]: + +In file included from ./arch/mips/include/asm/io.h:27:0, + from ./arch/mips/include/asm/page.h:176, + from include/linux/mm_types.h:15, + from include/linux/sched.h:27, + from include/linux/ptrace.h:5, + from arch/mips/kernel/cpu-probe.c:16: +./arch/mips/include/asm/pgtable-bits.h:164:0: error: "_PAGE_GLOBAL_SHIFT" redefined [-Werror] + #define _PAGE_GLOBAL_SHIFT (_PAGE_MODIFIED_SHIFT + 1) + ^ +./arch/mips/include/asm/pgtable-bits.h:141:0: note: this is the location of the previous definition + #define _PAGE_GLOBAL_SHIFT (_PAGE_SPLITTING_SHIFT + 1) + ^ +cc1: all warnings being treated as errors +make[2]: *** [arch/mips/kernel/cpu-probe.o] Error 1 + +for 64BIT/CPU_MIPSR1/MIPS_HUGE_TLB_SUPPORT configurations. Remove the +scattered double `_PAGE_NO_EXEC_SHIFT' and `_PAGE_GLOBAL_SHIFT' macro +definitions and rearrange them so that the respective macros these +definitions are based on are also those used for guarding conditionals. + +[ralf@linux-mips.org: resolved conflicts and updated commments.] + +Signed-off-by: Maciej W. Rozycki +Cc: Steven J. Hill +Cc: linux-mips@linux-mips.org +Patchwork: https://patchwork.linux-mips.org/patch/9960/ +Signed-off-by: Ralf Baechle +--- + arch/mips/include/asm/pgtable-bits.h | 23 +++++++++-------------- + 1 file changed, 9 insertions(+), 14 deletions(-) + +diff --git a/arch/mips/include/asm/pgtable-bits.h b/arch/mips/include/asm/pgtable-bits.h +index c28a849..4601741 100644 +--- a/arch/mips/include/asm/pgtable-bits.h ++++ b/arch/mips/include/asm/pgtable-bits.h +@@ -133,20 +133,13 @@ + #define _PAGE_HUGE (1 << _PAGE_HUGE_SHIFT) + #define _PAGE_SPLITTING_SHIFT (_PAGE_HUGE_SHIFT + 1) + #define _PAGE_SPLITTING (1 << _PAGE_SPLITTING_SHIFT) +- +-/* Only R2 or newer cores have the XI bit */ +-#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) +-#define _PAGE_NO_EXEC_SHIFT (_PAGE_SPLITTING_SHIFT + 1) +-#else +-#define _PAGE_GLOBAL_SHIFT (_PAGE_SPLITTING_SHIFT + 1) +-#define _PAGE_GLOBAL (1 << _PAGE_GLOBAL_SHIFT) +-#endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ +- + #endif /* CONFIG_64BIT && CONFIG_MIPS_HUGE_TLB_SUPPORT */ + + #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) + /* XI - page cannot be executed */ +-#ifndef _PAGE_NO_EXEC_SHIFT ++#ifdef _PAGE_SPLITTING_SHIFT ++#define _PAGE_NO_EXEC_SHIFT (_PAGE_SPLITTING_SHIFT + 1) ++#else + #define _PAGE_NO_EXEC_SHIFT (_PAGE_MODIFIED_SHIFT + 1) + #endif + #define _PAGE_NO_EXEC (cpu_has_rixi ? (1 << _PAGE_NO_EXEC_SHIFT) : 0) +@@ -156,14 +149,16 @@ + #define _PAGE_READ (cpu_has_rixi ? 0 : (1 << _PAGE_READ_SHIFT)) + #define _PAGE_NO_READ_SHIFT _PAGE_READ_SHIFT + #define _PAGE_NO_READ (cpu_has_rixi ? (1 << _PAGE_READ_SHIFT) : 0) ++#endif /* defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) */ + ++#if defined(_PAGE_NO_READ_SHIFT) + #define _PAGE_GLOBAL_SHIFT (_PAGE_NO_READ_SHIFT + 1) +-#define _PAGE_GLOBAL (1 << _PAGE_GLOBAL_SHIFT) +- +-#else /* !CONFIG_CPU_MIPSR2 && !CONFIG_CPU_MIPSR6 */ ++#elif defined(_PAGE_SPLITTING_SHIFT) ++#define _PAGE_GLOBAL_SHIFT (_PAGE_SPLITTING_SHIFT + 1) ++#else + #define _PAGE_GLOBAL_SHIFT (_PAGE_MODIFIED_SHIFT + 1) ++#endif + #define _PAGE_GLOBAL (1 << _PAGE_GLOBAL_SHIFT) +-#endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ + + #define _PAGE_VALID_SHIFT (_PAGE_GLOBAL_SHIFT + 1) + #define _PAGE_VALID (1 << _PAGE_VALID_SHIFT) diff --git a/debian/patches/series b/debian/patches/series index 36799c86c..f9a58ae23 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -98,3 +98,4 @@ bugfix/all/e1000e-fix-tight-loop-implementation-of-systime-read.patch bugfix/all/usb-whiteheat-fix-potential-null-deref-at-probe.patch bugfix/all/media-uvcvideo-disable-hardware-timestamps-by-defaul.patch bugfix/all/sctp-fix-race-on-protocol-netns-initialization.patch +bugfix/mips/mips-pgtable-bits.h-correct-_page_global_shift-build.patch