View Issue Details

IDProjectCategoryView StatusLast Update
0014888CentOS-7kernel-pluspublic2018-12-17 00:11
Reporterkabe 
PrioritynormalSeverityblockReproducibilityalways
Status assignedResolutionopen 
Product Version7.5.1804 
Target VersionFixed in Version 
Summary0014888: kernel-3.10.0-862.3.2.el7.centos.plus does not compile on i686
DescriptionUpstream has patched things breaking i686 compile (as usual).
Posting revised patches.
Tagsi386
abrt_hash
URL

Activities

kabe

kabe

2018-05-30 10:33

reporter   ~0031953

Replace this with existing SOURCES/patch-spec_ctrl_i686.patch .

patch-spec_ctrl_i686-v2.patch (1,739 bytes)
diff -up ./arch/x86/kernel/cpu/common.c.spec2 ./arch/x86/kernel/cpu/common.c
--- ./arch/x86/kernel/cpu/common.c.spec2	2018-05-16 06:03:51.000000000 +0900
+++ ./arch/x86/kernel/cpu/common.c	2018-05-29 20:03:08.000000000 +0900
@@ -1441,6 +1442,9 @@ DEFINE_PER_CPU(struct task_struct *, fpu
 DEFINE_PER_CPU_ALIGNED(struct stack_canary, stack_canary);
 #endif
 
+DEFINE_PER_CPU_USER_MAPPED(struct kernel_ibrs_spec_ctrl, spec_ctrl_pcp);
+EXPORT_PER_CPU_SYMBOL_GPL(spec_ctrl_pcp);
+
 #endif	/* CONFIG_X86_64 */
 
 /*
diff -up ./arch/x86/kernel/reboot.c.spec2 ./arch/x86/kernel/reboot.c
--- ./arch/x86/kernel/reboot.c.spec2	2018-05-16 06:03:51.000000000 +0900
+++ ./arch/x86/kernel/reboot.c	2018-05-29 20:03:08.000000000 +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/kernel/smpboot.c.spec2 ./arch/x86/kernel/smpboot.c
--- ./arch/x86/kernel/smpboot.c.spec2	2018-05-16 06:03:51.000000000 +0900
+++ ./arch/x86/kernel/smpboot.c	2018-05-29 20:03:08.000000000 +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.spec2 ./arch/x86/platform/efi/efi_32.c
--- ./arch/x86/platform/efi/efi_32.c.spec2	2018-05-16 06:03:51.000000000 +0900
+++ ./arch/x86/platform/efi/efi_32.c	2018-05-29 20:03:08.000000000 +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-05-30 10:41

reporter   ~0031954

Replace this with existing SOURCES/patch-i686-fpu-issues.patch .

patch-i686-fpu-issues-v2.patch (2,231 bytes)
https://bugs.centos.org/view.php?id=14597
https://bugs.centos.org/file_download.php?file_id=23451&type=bug

diff -up ./arch/x86/kernel/cpu/bugs.c.fpu2 ./arch/x86/kernel/cpu/bugs.c
--- ./arch/x86/kernel/cpu/bugs.c.fpu2	2018-05-28 21:40:16.000000000 +0900
+++ ./arch/x86/kernel/cpu/bugs.c	2018-05-28 21:40:25.000000000 +0900
@@ -25,6 +25,70 @@
 #include <asm/spec_ctrl.h>
 #include <linux/prctl.h>
 
+static int __init no_387(char *s)
+{
+	boot_cpu_data.hard_math = 0;
+	write_cr0(X86_CR0_TS | X86_CR0_EM | X86_CR0_MP | read_cr0());
+	return 1;
+}
+
+__setup("no387", no_387);
+
+static double __initdata x = 4195835.0;
+static double __initdata y = 3145727.0;
+
+/*
+ * This used to check for exceptions..
+ * However, it turns out that to support that,
+ * the XMM trap handlers basically had to
+ * be buggy. So let's have a correct XMM trap
+ * handler, and forget about printing out
+ * some status at boot.
+ *
+ * We should really only care about bugs here
+ * anyway. Not features.
+ */
+static void __init check_fpu(void)
+{
+	s32 fdiv_bug;
+
+	if (!boot_cpu_data.hard_math) {
+#ifndef CONFIG_MATH_EMULATION
+		pr_emerg("No coprocessor found and no math emulation present\n");
+		pr_emerg("Giving up\n");
+		for (;;) ;
+#endif
+		return;
+	}
+
+	kernel_fpu_begin();
+
+	/*
+	 * trap_init() enabled FXSR and company _before_ testing for FP
+	 * problems here.
+	 *
+	 * Test for the divl bug: http://en.wikipedia.org/wiki/Fdiv_bug
+	 */
+	__asm__("fninit\n\t"
+		"fldl %1\n\t"
+		"fdivl %2\n\t"
+		"fmull %2\n\t"
+		"fldl %1\n\t"
+		"fsubp %%st,%%st(1)\n\t"
+		"fistpl %0\n\t"
+		"fwait\n\t"
+		"fninit"
+		: "=m" (*&fdiv_bug)
+		: "m" (*&x), "m" (*&y));
+
+	kernel_fpu_end();
+
+	if (fdiv_bug) {
+		set_cpu_bug(&boot_cpu_data, X86_BUG_FDIV);
+		pr_warn("Hmm, FPU with FDIV bug\n");
+	}
+}
+
 static void __init spectre_v2_select_mitigation(void);
 static void __init ssb_parse_cmdline(void);
 void ssb_select_mitigation(void);
@@ -426,8 +490,10 @@ ssize_t cpu_show_meltdown(struct device
 {
 	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
 		return sprintf(buf, "Not affected\n");
+#ifdef CONFIG_KAISER
 	if (kaiser_enabled)
 		return sprintf(buf, "Mitigation: PTI\n");
+#endif
 	return sprintf(buf, "Vulnerable\n");
 }
 
kabe

kabe

2018-05-30 10:58

reporter   ~0031956

That's all.
My i686 real machine is running the new kernel:
$ uname -a
Linux capricorn.five.ten 3.10.0-862.3.2.el7.centos.plus.i686 #1 SMP Tue May 29 20:42:55 JST 2018 i686 i686 i386 GNU/Linux
toracat

toracat

2018-05-30 16:31

manager   ~0031961

@kabe

Thank you for your help with the patches (as usual). The latest i686 kernel has been released not long ago. @pgreco kindly offered the patches which are basically the same as yours. Thanks to both geniuses!
kabe

kabe

2018-05-31 01:24

reporter   ~0031967

Is the src.rpm published somewhere?
I've been relying on https://buildlogs.centos.org/ to pick up latest sources
but sometimes binaries are published without using the buildsystem.
toracat

toracat

2018-05-31 03:32

manager   ~0031968

The srpms can be found here:
http://vault.centos.org/7.5.1804/centosplus/Source/SPackages/
kabe

kabe

2018-05-31 04:44

reporter   ~0031969

http://vault.centos.org/7.5.1804/centosplus/Source/SPackages/
only holds kernel-plus src.rpm for x86_64.
I believe kernel-3.10.0-*.i686.rpm is based on modified version of these.

AFAIK src.rpm for kernel-3.10.0-862.2.3.el7.centos.plus.i686.rpm only exists on buildlogs.centos.org,
and for kernel-3.10.0-862.3.2.el7.centos.plus.i686.rpm, it isn't in public.
(Yes, I could rebuild similar src from various bits of info, but "official" src.rpm is helpful to work on)
toracat

toracat

2018-05-31 04:56

manager   ~0031970

Not really the "official" one but the published binaries are based on this srpm:

https://people.centos.org/toracat/kernel/7/plus/i386/src/kernel-3.10.0-862.3.2.el7.centos.plus.src.rpm

@JohnnyHughes could you release the srpms to vault.c.o.?
toracat

toracat

2018-06-04 18:44

manager   ~0031999

Reminder sent to: JohnnyHughes

@JohnnyHughes

We'd like to see the i686 kernel srpms here:
http://vault.centos.org/altarch/7.5.1804/centosplus/Source/i386/
toracat

toracat

2018-07-19 17:31

manager   ~0032308

Reminder sent to: JohnnyHughes

Or maybe here:

http://vault.centos.org/altarch/7/centosplus/Source/i386/
toracat

toracat

2018-08-28 15:38

manager   ~0032617

Reminder sent to: JohnnyHughes

Testing to see if @JohnnyHughes responds.....
JohnnyHughes

JohnnyHughes

2018-08-28 15:51

administrator   ~0032618

HEH
toracat

toracat

2018-12-17 00:11

manager   ~0033362

@JohnnyHughes

bump.

Issue History

Date Modified Username Field Change
2018-05-30 10:32 kabe New Issue
2018-05-30 10:32 kabe Tag Attached: i386
2018-05-30 10:33 kabe File Added: patch-spec_ctrl_i686-v2.patch
2018-05-30 10:33 kabe Note Added: 0031953
2018-05-30 10:41 kabe File Added: patch-i686-fpu-issues-v2.patch
2018-05-30 10:41 kabe Note Added: 0031954
2018-05-30 10:58 kabe Note Added: 0031956
2018-05-30 16:31 toracat Status new => assigned
2018-05-30 16:31 toracat Note Added: 0031961
2018-05-31 01:24 kabe Note Added: 0031967
2018-05-31 03:32 toracat Note Added: 0031968
2018-05-31 04:44 kabe Note Added: 0031969
2018-05-31 04:56 toracat Note Added: 0031970
2018-06-04 18:44 toracat Note Added: 0031999
2018-07-19 17:31 toracat Note Added: 0032308
2018-08-28 15:38 toracat Note Added: 0032617
2018-08-28 15:51 JohnnyHughes Note Added: 0032618
2018-12-17 00:11 toracat Note Added: 0033362