View Issue Details

IDProjectCategoryView StatusLast Update
0014353CentOS-7kernelpublic2018-03-20 13:54
Reportertoracat 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version7.4.1708 
Target VersionFixed in Version 
Summary0014353: Building kernel-plus-3.10.0-693.11.6.el7.centos.plus for i686 fails
DescriptionBuilding kernel-plus-3.10.0-693.11.6.el7.centos.plus for i686 fails. The build log is here:

https://buildlogs.centos.org/c7.1708.u.i386/kernel/20180109171431/3.10.0-693.11.6.el7.centos.plus.i386/build.log
TagsNo tags attached.
abrt_hash
URL

Activities

tru

tru

2018-01-09 19:13

administrator   ~0030894

https://buildlogs.centos.org/c7.1708.u.i386/kernel/20180109171431/3.10.0-693.11.6.el7.centos.plus.i386/build.log
...
In file included from include/linux/topology.h:34:0,
                 from include/linux/gfp.h:8,
                 from include/linux/slab.h:12,
                 from kernel/fork.c:14:
./arch/x86/include/asm/spec_ctrl.h: In function '__spec_ctrl_vm_ibrs':
./arch/x86/include/asm/spec_ctrl.h:290:22: error: 'spec_ctrl_pcp' undeclared (first use in this function)
  if (__this_cpu_read(spec_ctrl_pcp) & (SPEC_CTRL_PCP_IBRS_USER |
...

from the changelog:

* Tue Dec 19 2017 Denys Vlasenko <dvlasenk@redhat.com> [3.10.0-693.11.4.el7]
- [x86] spec_ctrl: allow use_ibp_disable only if both SPEC_CTRL and IBPB_SUPPORT are missing (Andrea Arcangeli) [1519795 1519798]
- [x86] spec_ctrl: Documentation spec_ctrl.txt (Andrea Arcangeli) [1519795 1519798]
- [x86] spec_ctrl: remove irqs_disabled() check from intel_idle() (Andrea Arcangeli) [1519795 1519798]
- [x86] spec_ctrl: use enum when setting ibrs/ibpb_enabled (Andrea Arcangeli) [1519795 1519798]
- [x86] spec_ctrl: undo speculation barrier for ibrs_enabled and noibrs_cmdline (Andrea Arcangeli) [1519795 1519798]
- [x86] spec_ctrl: introduce ibpb_enabled = 2 for IBPB instead of IBRS (Andrea Arcangeli) [1519795 1519798]
- [x86] spec_ctrl: introduce SPEC_CTRL_PCP_ONLY_IBPB (Andrea Arcangeli) [1519795 1519798]
- [x86] spec_ctrl: cleanup s/flush/sync/ naming when sending IPIs (Andrea Arcangeli) [1519795 1519798]
- [x86] spec_ctrl: set IBRS during CPU init if in ibrs_enabled == 2 (Andrea Arcangeli) [1519795 1519798]
- [x86] spec_ctrl: use IBRS_ENABLED instead of 1 (Andrea Arcangeli) [1519795 1519798]
- [x86] spec_ctrl: allow the IBP disable feature to be toggled at runtime (Andrea Arcangeli) [1519795 1519798]
- [x86] spec_ctrl: always initialize save_reg in ENABLE_IBRS_SAVE_AND_CLOBBER (Andrea Arcangeli) [1519795 1519798]
- [x86] spec_ctrl: ibrs_enabled() is expected to return > 1 (Andrea Arcangeli) [1519795 1519798]
- [x86] spec_ctrl: issue a __spec_ctrl_ibpb if a credential check isn't possible (Andrea Arcangeli) [1519795 1519798]
...
kabe

kabe

2018-01-10 09:07

reporter  

patch-spec_ctrl_i686.patch (2,879 bytes)
diff -up ./arch/x86/kernel/cpu/common.c.dist ./arch/x86/kernel/cpu/common.c
--- ./arch/x86/kernel/cpu/common.c.dist	2017-12-29 03:59:43.000000000 +0900
+++ ./arch/x86/kernel/cpu/common.c	2018-01-10 15:37:06.848478838 +0900
@@ -1349,6 +1349,9 @@ DEFINE_PER_CPU(struct task_struct *, fpu
 DEFINE_PER_CPU_ALIGNED(struct stack_canary, stack_canary);
 #endif
 
+DEFINE_PER_CPU_USER_MAPPED(unsigned int, spec_ctrl_pcp);
+EXPORT_PER_CPU_SYMBOL_GPL(spec_ctrl_pcp);
+
 #endif	/* CONFIG_X86_64 */
 
 /*
diff -up ./arch/x86/include/asm/spec_ctrl.h.dist ./arch/x86/include/asm/spec_ctrl.h
--- ./arch/x86/include/asm/spec_ctrl.h.dist	2017-12-29 03:59:43.000000000 +0900
+++ ./arch/x86/include/asm/spec_ctrl.h	2018-01-10 16:10:06.048822844 +0900
@@ -274,6 +274,8 @@ extern void spec_ctrl_rescan_cpuid(void)
 extern void spec_ctrl_init(struct cpuinfo_x86 *c);
 extern void spec_ctrl_cpu_init(void);
 
+DECLARE_PER_CPU_USER_MAPPED(unsigned int, spec_ctrl_pcp);
+
 static inline int cpu_has_spec_ctrl(void)
 {
 	if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
diff -up ./arch/x86/kernel/reboot.c.dist ./arch/x86/kernel/reboot.c
--- ./arch/x86/kernel/reboot.c.dist	2017-12-29 03:59:43.000000000 +0900
+++ ./arch/x86/kernel/reboot.c	2018-01-10 15:43:36.819240224 +0900
@@ -23,6 +23,7 @@
 #include <asm/cpu.h>
 #include <asm/nmi.h>
 #include <asm/smp.h>
+#include <asm/mmu_context.h>
 
 #include <linux/ctype.h>
 #include <linux/mc146818rtc.h>
diff -up ./arch/x86/include/asm/spec_ctrl.h.dist ./arch/x86/include/asm/spec_ctrl.h
--- ./arch/x86/include/asm/spec_ctrl.h.dist	2018-01-10 16:21:16.546686404 +0900
+++ ./arch/x86/include/asm/spec_ctrl.h	2018-01-10 17:56:52.971547314 +0900
@@ -417,7 +417,12 @@ static __always_inline void stuff_RSB(vo
 			     "29:    call 30f; pause;"
 			     "30:    call 31f; pause;"
 			     "31:    call 32f; pause;"
-			     "32:    add $(32*8), %%rsp": : :"memory");
+#ifdef CONFIG_X86_64
+			     "32:    add $(32*8), %%rsp"
+#else
+			     "32:    add $(32*4), %%sp"
+#endif
+				: : :"memory");
 }
 
 #endif /* __ASSEMBLY__ */
diff -up ./arch/x86/kernel/smpboot.c.dist ./arch/x86/kernel/smpboot.c
--- ./arch/x86/kernel/smpboot.c.dist	2018-01-10 14:53:15.251175037 +0900
+++ ./arch/x86/kernel/smpboot.c	2018-01-10 15:45:14.219976320 +0900
@@ -72,6 +72,7 @@
 #include <asm/fpu-internal.h>
 #include <asm/setup.h>
 #include <asm/uv/uv.h>
+#include <asm/mmu_context.h>
 #include <linux/mc146818rtc.h>
 
 #include <asm/smpboot_hooks.h>
diff -up ./arch/x86/platform/efi/efi_32.c.dist ./arch/x86/platform/efi/efi_32.c
--- ./arch/x86/platform/efi/efi_32.c.dist	2017-12-29 03:59:43.000000000 +0900
+++ ./arch/x86/platform/efi/efi_32.c	2018-01-10 15:45:56.356433372 +0900
@@ -30,6 +30,7 @@
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
 #include <asm/efi.h>
+#include <asm/mmu_context.h>
 
 /*
  * To make EFI call EFI runtime service in physical addressing mode we need
kabe

kabe

2018-01-10 09:11

reporter   ~0030902

Posted a preliminary patch:
patch-spec_ctrl_i686.patch
https://bugs.centos.org/file_download.php?file_id=23042&type=bug

Made it compile and seems to work,
but I'm not sure about assmebly fix in arch/x86/include/asm/spec_ctrl.h .
This only affects real machines with vmx or svm, which I don't have around.
kabe

kabe

2018-01-10 09:17

reporter   ~0030903

The spec_ctrl 3.10.0-693.11.6.el7 fix seems to be a hot fix circulating,
which I couldn't find in kernel.org code.
I guess someone will come up with better or totally different code
which also covers i686.
toracat

toracat

2018-01-11 07:56

manager   ~0030911

@kabe

Thank you for the submission of your patch. It really helps. I don't have a real machine running the 32-bit kernel either.

@JohnnyHughes

Should we go ahead and publish the patched kernel? Maybe 'for testing' first?
toracat

toracat

2018-01-12 15:20

manager   ~0030922

Anyone wishing to test-drive the version built with with kabe's patch can find it here:

https://people.centos.org/toracat/kernel/7/plus/i386/
toracat

toracat

2018-01-30 02:31

manager   ~0031098

No issue reported. Closing as resolved.
toracat

toracat

2018-03-08 16:37

manager   ~0031393

Just a short note to say that, as of kernel 3.10.0-693.21.1.el7, this patch is no longer required.
toracat

toracat

2018-03-13 12:42

manager   ~0031418

Reopening...
toracat

toracat

2018-03-20 13:54

manager   ~0031471

Closing (again) as 'resolved'. Issues on the current plus kernel is being handled in https://bugs.centos.org/view.php?id=14597 .

Issue History

Date Modified Username Field Change
2018-01-09 18:05 toracat New Issue
2018-01-09 19:13 tru Note Added: 0030894
2018-01-10 09:07 kabe File Added: patch-spec_ctrl_i686.patch
2018-01-10 09:11 kabe Note Added: 0030902
2018-01-10 09:17 kabe Note Added: 0030903
2018-01-11 07:39 toracat Status new => assigned
2018-01-11 07:56 toracat Note Added: 0030911
2018-01-12 15:20 toracat Note Added: 0030922
2018-01-30 02:31 toracat Status assigned => resolved
2018-01-30 02:31 toracat Resolution open => fixed
2018-01-30 02:31 toracat Note Added: 0031098
2018-03-08 16:37 toracat Note Added: 0031393
2018-03-13 12:42 toracat Status resolved => assigned
2018-03-13 12:42 toracat Note Added: 0031418
2018-03-20 13:54 toracat Status assigned => resolved
2018-03-20 13:54 toracat Note Added: 0031471