summaryrefslogtreecommitdiffstats
path: root/debian/patches/features/x86
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:38 +0000
commit08b74a000942a380fe028845f92cd3a0dee827d5 (patch)
treeaa78b4e12607c3e1fcce8d5cc42df4330792f118 /debian/patches/features/x86
parentAdding upstream version 4.19.249. (diff)
downloadlinux-08b74a000942a380fe028845f92cd3a0dee827d5.tar.xz
linux-08b74a000942a380fe028845f92cd3a0dee827d5.zip
Adding debian version 4.19.249-2.debian/4.19.249-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/features/x86')
-rw-r--r--debian/patches/features/x86/x86-acpi-x86-boot-Take-RSDP-address-for-boot-params-.patch101
-rw-r--r--debian/patches/features/x86/x86-acpi-x86-boot-Take-RSDP-address-from-boot-params.patch51
-rw-r--r--debian/patches/features/x86/x86-boot-Add-ACPI-RSDP-address-to-setup_header.patch232
-rw-r--r--debian/patches/features/x86/x86-boot-Mostly-revert-commit-ae7e1238e68f2a-Add-ACP.patch236
-rw-r--r--debian/patches/features/x86/x86-make-x32-syscall-support-conditional.patch227
-rw-r--r--debian/patches/features/x86/x86-memtest-WARN-if-bad-RAM-found.patch30
6 files changed, 877 insertions, 0 deletions
diff --git a/debian/patches/features/x86/x86-acpi-x86-boot-Take-RSDP-address-for-boot-params-.patch b/debian/patches/features/x86/x86-acpi-x86-boot-Take-RSDP-address-for-boot-params-.patch
new file mode 100644
index 000000000..d56f9f289
--- /dev/null
+++ b/debian/patches/features/x86/x86-acpi-x86-boot-Take-RSDP-address-for-boot-params-.patch
@@ -0,0 +1,101 @@
+From: Juergen Gross <jgross@suse.com>
+Date: Wed, 10 Oct 2018 08:14:56 +0200
+Subject: x86/acpi, x86/boot: Take RSDP address for boot params if available
+Origin: https://git.kernel.org/linus/e7b66d16fe41722350ba87f5788052ef53ee28bb
+
+In case the RSDP address in struct boot_params is specified don't try
+to find the table by searching, but take the address directly as set
+by the boot loader.
+
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Cc: Baoquan He <bhe@redhat.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Jia Zhang <qianyue.zj@alibaba-inc.com>
+Cc: Len Brown <len.brown@intel.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Pavel Machek <pavel@ucw.cz>
+Cc: Pavel Tatashin <pasha.tatashin@oracle.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: boris.ostrovsky@oracle.com
+Cc: linux-kernel@vger.kernel.org
+Cc: linux-pm@vger.kernel.org
+Cc: xen-devel@lists.xenproject.org
+Link: http://lkml.kernel.org/r/20181010061456.22238-4-jgross@suse.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+---
+ arch/x86/include/asm/acpi.h | 7 +++++++
+ arch/x86/kernel/acpi/boot.c | 6 ++++++
+ arch/x86/kernel/x86_init.c | 3 +--
+ 3 files changed, 14 insertions(+), 2 deletions(-)
+
+Index: linux/arch/x86/include/asm/acpi.h
+===================================================================
+--- linux.orig/arch/x86/include/asm/acpi.h
++++ linux/arch/x86/include/asm/acpi.h
+@@ -142,6 +142,8 @@ static inline u64 acpi_arch_get_root_poi
+
+ void acpi_generic_reduced_hw_init(void);
+
++u64 x86_default_get_root_pointer(void);
++
+ #else /* !CONFIG_ACPI */
+
+ #define acpi_lapic 0
+@@ -153,6 +155,11 @@ static inline void disable_acpi(void) {
+
+ static inline void acpi_generic_reduced_hw_init(void) { }
+
++static inline u64 x86_default_get_root_pointer(void)
++{
++ return 0;
++}
++
+ #endif /* !CONFIG_ACPI */
+
+ #define ARCH_HAS_POWER_INIT 1
+Index: linux/arch/x86/kernel/acpi/boot.c
+===================================================================
+--- linux.orig/arch/x86/kernel/acpi/boot.c
++++ linux/arch/x86/kernel/acpi/boot.c
+@@ -48,6 +48,7 @@
+ #include <asm/mpspec.h>
+ #include <asm/smp.h>
+ #include <asm/i8259.h>
++#include <asm/setup.h>
+
+ #include "sleep.h" /* To include x86_acpi_suspend_lowlevel */
+ static int __initdata acpi_force = 0;
+@@ -1771,3 +1772,8 @@ void __init arch_reserve_mem_area(acpi_p
+ e820__range_add(addr, size, E820_TYPE_ACPI);
+ e820__update_table_print();
+ }
++
++u64 x86_default_get_root_pointer(void)
++{
++ return boot_params.hdr.acpi_rsdp_addr;
++}
+Index: linux/arch/x86/kernel/x86_init.c
+===================================================================
+--- linux.orig/arch/x86/kernel/x86_init.c
++++ linux/arch/x86/kernel/x86_init.c
+@@ -31,7 +31,6 @@ static int __init iommu_init_noop(void)
+ static void iommu_shutdown_noop(void) { }
+ static bool __init bool_x86_init_noop(void) { return false; }
+ static void x86_op_int_noop(int cpu) { }
+-static u64 u64_x86_init_noop(void) { return 0; }
+
+ /*
+ * The platform setup functions are preset with the default functions
+@@ -96,7 +95,7 @@ struct x86_init_ops x86_init __initdata
+ },
+
+ .acpi = {
+- .get_root_pointer = u64_x86_init_noop,
++ .get_root_pointer = x86_default_get_root_pointer,
+ .reduced_hw_early_init = acpi_generic_reduced_hw_init,
+ },
+ };
diff --git a/debian/patches/features/x86/x86-acpi-x86-boot-Take-RSDP-address-from-boot-params.patch b/debian/patches/features/x86/x86-acpi-x86-boot-Take-RSDP-address-from-boot-params.patch
new file mode 100644
index 000000000..5382acce3
--- /dev/null
+++ b/debian/patches/features/x86/x86-acpi-x86-boot-Take-RSDP-address-from-boot-params.patch
@@ -0,0 +1,51 @@
+From: Juergen Gross <jgross@suse.com>
+Date: Tue, 20 Nov 2018 08:25:29 +0100
+Subject: x86/acpi, x86/boot: Take RSDP address from boot params if available
+Origin: https://git.kernel.org/linus/e6e094e053af75cbc164e950814d3d084fb1e698
+
+In case the RSDP address in struct boot_params is specified don't try
+to find the table by searching, but take the address directly as set
+by the boot loader.
+
+Suggested-by: "H. Peter Anvin" <hpa@zytor.com>
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: boris.ostrovsky@oracle.com
+Cc: bp@alien8.de
+Cc: daniel.kiper@oracle.com
+Cc: sstabellini@kernel.org
+Cc: xen-devel@lists.xenproject.org
+Link: http://lkml.kernel.org/r/20181120072529.5489-3-jgross@suse.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+---
+ arch/x86/include/uapi/asm/bootparam.h | 3 ++-
+ arch/x86/kernel/acpi/boot.c | 2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+Index: linux/arch/x86/include/uapi/asm/bootparam.h
+===================================================================
+--- linux.orig/arch/x86/include/uapi/asm/bootparam.h
++++ linux/arch/x86/include/uapi/asm/bootparam.h
+@@ -155,7 +155,8 @@ struct boot_params {
+ __u8 _pad2[4]; /* 0x054 */
+ __u64 tboot_addr; /* 0x058 */
+ struct ist_info ist_info; /* 0x060 */
+- __u8 _pad3[16]; /* 0x070 */
++ __u64 acpi_rsdp_addr; /* 0x070 */
++ __u8 _pad3[8]; /* 0x078 */
+ __u8 hd0_info[16]; /* obsolete! */ /* 0x080 */
+ __u8 hd1_info[16]; /* obsolete! */ /* 0x090 */
+ struct sys_desc_table sys_desc_table; /* obsolete! */ /* 0x0a0 */
+Index: linux/arch/x86/kernel/acpi/boot.c
+===================================================================
+--- linux.orig/arch/x86/kernel/acpi/boot.c
++++ linux/arch/x86/kernel/acpi/boot.c
+@@ -1775,5 +1775,5 @@ void __init arch_reserve_mem_area(acpi_p
+
+ u64 x86_default_get_root_pointer(void)
+ {
+- return 0;
++ return boot_params.acpi_rsdp_addr;
+ }
diff --git a/debian/patches/features/x86/x86-boot-Add-ACPI-RSDP-address-to-setup_header.patch b/debian/patches/features/x86/x86-boot-Add-ACPI-RSDP-address-to-setup_header.patch
new file mode 100644
index 000000000..55b116db9
--- /dev/null
+++ b/debian/patches/features/x86/x86-boot-Add-ACPI-RSDP-address-to-setup_header.patch
@@ -0,0 +1,232 @@
+From: Juergen Gross <jgross@suse.com>
+Date: Wed, 10 Oct 2018 08:14:55 +0200
+Subject: x86/boot: Add ACPI RSDP address to setup_header
+Origin: https://git.kernel.org/linus/ae7e1238e68f2a472a125673ab506d49158c1889
+
+Xen PVH guests receive the address of the RSDP table from Xen. In order
+to support booting a Xen PVH guest via Grub2 using the standard x86
+boot entry we need a way for Grub2 to pass the RSDP address to the
+kernel.
+
+For this purpose expand the struct setup_header to hold the physical
+address of the RSDP address. Being zero means it isn't specified and
+has to be located the legacy way (searching through low memory or
+EBDA).
+
+While documenting the new setup_header layout and protocol version
+2.14 add the missing documentation of protocol version 2.13.
+
+There are Grub2 versions in several distros with a downstream patch
+violating the boot protocol by writing past the end of setup_header.
+This requires another update of the boot protocol to enable the kernel
+to distinguish between a specified RSDP address and one filled with
+garbage by such a broken Grub2.
+
+From protocol 2.14 on Grub2 will write the version it is supporting
+(but never a higher value than found to be supported by the kernel)
+ored with 0x8000 to the version field of setup_header. This enables
+the kernel to know up to which field Grub2 has written information
+to. All fields after that are supposed to be clobbered.
+
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: boris.ostrovsky@oracle.com
+Cc: bp@alien8.de
+Cc: corbet@lwn.net
+Cc: linux-doc@vger.kernel.org
+Cc: xen-devel@lists.xenproject.org
+Link: http://lkml.kernel.org/r/20181010061456.22238-3-jgross@suse.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+---
+ Documentation/x86/boot.txt | 32 ++++++++++++++++++++++++++-
+ arch/x86/boot/header.S | 6 ++++-
+ arch/x86/include/asm/x86_init.h | 2 ++
+ arch/x86/include/uapi/asm/bootparam.h | 4 ++++
+ arch/x86/kernel/head32.c | 1 +
+ arch/x86/kernel/head64.c | 2 ++
+ arch/x86/kernel/setup.c | 17 ++++++++++++++
+ 7 files changed, 62 insertions(+), 2 deletions(-)
+
+Index: linux/Documentation/x86/boot.txt
+===================================================================
+--- linux.orig/Documentation/x86/boot.txt
++++ linux/Documentation/x86/boot.txt
+@@ -61,6 +61,18 @@ Protocol 2.12: (Kernel 3.8) Added the xl
+ to struct boot_params for loading bzImage and ramdisk
+ above 4G in 64bit.
+
++Protocol 2.13: (Kernel 3.14) Support 32- and 64-bit flags being set in
++ xloadflags to support booting a 64-bit kernel from 32-bit
++ EFI
++
++Protocol 2.14: (Kernel 4.20) Added acpi_rsdp_addr holding the physical
++ address of the ACPI RSDP table.
++ The bootloader updates version with:
++ 0x8000 | min(kernel-version, bootloader-version)
++ kernel-version being the protocol version supported by
++ the kernel and bootloader-version the protocol version
++ supported by the bootloader.
++
+ **** MEMORY LAYOUT
+
+ The traditional memory map for the kernel loader, used for Image or
+@@ -197,6 +209,7 @@ Offset Proto Name Meaning
+ 0258/8 2.10+ pref_address Preferred loading address
+ 0260/4 2.10+ init_size Linear memory required during initialization
+ 0264/4 2.11+ handover_offset Offset of handover entry point
++0268/8 2.14+ acpi_rsdp_addr Physical address of RSDP table
+
+ (1) For backwards compatibility, if the setup_sects field contains 0, the
+ real value is 4.
+@@ -309,7 +322,7 @@ Protocol: 2.00+
+ Contains the magic number "HdrS" (0x53726448).
+
+ Field name: version
+-Type: read
++Type: modify
+ Offset/size: 0x206/2
+ Protocol: 2.00+
+
+@@ -317,6 +330,12 @@ Protocol: 2.00+
+ e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version
+ 10.17.
+
++ Up to protocol version 2.13 this information is only read by the
++ bootloader. From protocol version 2.14 onwards the bootloader will
++ write the used protocol version or-ed with 0x8000 to the field. The
++ used protocol version will be the minimum of the supported protocol
++ versions of the bootloader and the kernel.
++
+ Field name: realmode_swtch
+ Type: modify (optional)
+ Offset/size: 0x208/4
+@@ -744,6 +763,17 @@ Offset/size: 0x264/4
+
+ See EFI HANDOVER PROTOCOL below for more details.
+
++Field name: acpi_rsdp_addr
++Type: write
++Offset/size: 0x268/8
++Protocol: 2.14+
++
++ This field can be set by the boot loader to tell the kernel the
++ physical address of the ACPI RSDP table.
++
++ A value of 0 indicates the kernel should fall back to the standard
++ methods to locate the RSDP.
++
+
+ **** THE IMAGE CHECKSUM
+
+Index: linux/arch/x86/boot/header.S
+===================================================================
+--- linux.orig/arch/x86/boot/header.S
++++ linux/arch/x86/boot/header.S
+@@ -300,7 +300,7 @@ _start:
+ # Part 2 of the header, from the old setup.S
+
+ .ascii "HdrS" # header signature
+- .word 0x020d # header version number (>= 0x0105)
++ .word 0x020e # header version number (>= 0x0105)
+ # or else old loadlin-1.5 will fail)
+ .globl realmode_swtch
+ realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
+@@ -558,6 +558,10 @@ pref_address: .quad LOAD_PHYSICAL_ADDR
+ init_size: .long INIT_SIZE # kernel initialization size
+ handover_offset: .long 0 # Filled in by build.c
+
++acpi_rsdp_addr: .quad 0 # 64-bit physical pointer to the
++ # ACPI RSDP table, added with
++ # version 2.14
++
+ # End of setup header #####################################################
+
+ .section ".entrytext", "ax"
+Index: linux/arch/x86/include/asm/x86_init.h
+===================================================================
+--- linux.orig/arch/x86/include/asm/x86_init.h
++++ linux/arch/x86/include/asm/x86_init.h
+@@ -303,4 +303,6 @@ extern void x86_init_noop(void);
+ extern void x86_init_uint_noop(unsigned int unused);
+ extern bool x86_pnpbios_disabled(void);
+
++void x86_verify_bootdata_version(void);
++
+ #endif
+Index: linux/arch/x86/include/uapi/asm/bootparam.h
+===================================================================
+--- linux.orig/arch/x86/include/uapi/asm/bootparam.h
++++ linux/arch/x86/include/uapi/asm/bootparam.h
+@@ -16,6 +16,9 @@
+ #define RAMDISK_PROMPT_FLAG 0x8000
+ #define RAMDISK_LOAD_FLAG 0x4000
+
++/* version flags */
++#define VERSION_WRITTEN 0x8000
++
+ /* loadflags */
+ #define LOADED_HIGH (1<<0)
+ #define KASLR_FLAG (1<<1)
+@@ -86,6 +89,7 @@ struct setup_header {
+ __u64 pref_address;
+ __u32 init_size;
+ __u32 handover_offset;
++ __u64 acpi_rsdp_addr;
+ } __attribute__((packed));
+
+ struct sys_desc_table {
+Index: linux/arch/x86/kernel/head32.c
+===================================================================
+--- linux.orig/arch/x86/kernel/head32.c
++++ linux/arch/x86/kernel/head32.c
+@@ -37,6 +37,7 @@ asmlinkage __visible void __init i386_st
+ cr4_init_shadow();
+
+ sanitize_boot_params(&boot_params);
++ x86_verify_bootdata_version();
+
+ x86_early_init_platform_quirks();
+
+Index: linux/arch/x86/kernel/head64.c
+===================================================================
+--- linux.orig/arch/x86/kernel/head64.c
++++ linux/arch/x86/kernel/head64.c
+@@ -477,6 +477,8 @@ void __init x86_64_start_reservations(ch
+ if (!boot_params.hdr.version)
+ copy_bootdata(__va(real_mode_data));
+
++ x86_verify_bootdata_version();
++
+ x86_early_init_platform_quirks();
+
+ switch (boot_params.hdr.hardware_subarch) {
+Index: linux/arch/x86/kernel/setup.c
+===================================================================
+--- linux.orig/arch/x86/kernel/setup.c
++++ linux/arch/x86/kernel/setup.c
+@@ -1281,6 +1281,23 @@ void __init setup_arch(char **cmdline_p)
+ unwind_init();
+ }
+
++/*
++ * From boot protocol 2.14 onwards we expect the bootloader to set the
++ * version to "0x8000 | <used version>". In case we find a version >= 2.14
++ * without the 0x8000 we assume the boot loader supports 2.13 only and
++ * reset the version accordingly. The 0x8000 flag is removed in any case.
++ */
++void __init x86_verify_bootdata_version(void)
++{
++ if (boot_params.hdr.version & VERSION_WRITTEN)
++ boot_params.hdr.version &= ~VERSION_WRITTEN;
++ else if (boot_params.hdr.version >= 0x020e)
++ boot_params.hdr.version = 0x020d;
++
++ if (boot_params.hdr.version < 0x020e)
++ boot_params.hdr.acpi_rsdp_addr = 0;
++}
++
+ #ifdef CONFIG_X86_32
+
+ static struct resource video_ram_resource = {
diff --git a/debian/patches/features/x86/x86-boot-Mostly-revert-commit-ae7e1238e68f2a-Add-ACP.patch b/debian/patches/features/x86/x86-boot-Mostly-revert-commit-ae7e1238e68f2a-Add-ACP.patch
new file mode 100644
index 000000000..d2b67f4ea
--- /dev/null
+++ b/debian/patches/features/x86/x86-boot-Mostly-revert-commit-ae7e1238e68f2a-Add-ACP.patch
@@ -0,0 +1,236 @@
+From: Juergen Gross <jgross@suse.com>
+Date: Tue, 20 Nov 2018 08:25:28 +0100
+Subject: x86/boot: Mostly revert commit ae7e1238e68f2a ("Add ACPI RSDP address
+ to setup_header")
+Origin: https://git.kernel.org/linus/3841840449817ba6cf3e636008bc4e1061a03388
+
+Peter Anvin pointed out that commit:
+
+ ae7e1238e68f2a ("x86/boot: Add ACPI RSDP address to setup_header")
+
+should be reverted as setup_header should only contain items set by the
+legacy BIOS.
+
+So revert said commit. Instead of fully reverting the dependent commit
+of:
+
+ e7b66d16fe4172 ("x86/acpi, x86/boot: Take RSDP address for boot params if available")
+
+just remove the setup_header reference in order to replace it by
+a boot_params in a followup patch.
+
+Suggested-by: "H. Peter Anvin" <hpa@zytor.com>
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: boris.ostrovsky@oracle.com
+Cc: bp@alien8.de
+Cc: daniel.kiper@oracle.com
+Cc: sstabellini@kernel.org
+Cc: xen-devel@lists.xenproject.org
+Link: http://lkml.kernel.org/r/20181120072529.5489-2-jgross@suse.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+---
+ Documentation/x86/boot.txt | 32 +--------------------------
+ arch/x86/boot/header.S | 6 +----
+ arch/x86/include/asm/x86_init.h | 2 --
+ arch/x86/include/uapi/asm/bootparam.h | 4 ----
+ arch/x86/kernel/acpi/boot.c | 2 +-
+ arch/x86/kernel/head32.c | 1 -
+ arch/x86/kernel/head64.c | 2 --
+ arch/x86/kernel/setup.c | 17 --------------
+ 8 files changed, 3 insertions(+), 63 deletions(-)
+
+Index: linux/Documentation/x86/boot.txt
+===================================================================
+--- linux.orig/Documentation/x86/boot.txt
++++ linux/Documentation/x86/boot.txt
+@@ -61,18 +61,6 @@ Protocol 2.12: (Kernel 3.8) Added the xl
+ to struct boot_params for loading bzImage and ramdisk
+ above 4G in 64bit.
+
+-Protocol 2.13: (Kernel 3.14) Support 32- and 64-bit flags being set in
+- xloadflags to support booting a 64-bit kernel from 32-bit
+- EFI
+-
+-Protocol 2.14: (Kernel 4.20) Added acpi_rsdp_addr holding the physical
+- address of the ACPI RSDP table.
+- The bootloader updates version with:
+- 0x8000 | min(kernel-version, bootloader-version)
+- kernel-version being the protocol version supported by
+- the kernel and bootloader-version the protocol version
+- supported by the bootloader.
+-
+ **** MEMORY LAYOUT
+
+ The traditional memory map for the kernel loader, used for Image or
+@@ -209,7 +197,6 @@ Offset Proto Name Meaning
+ 0258/8 2.10+ pref_address Preferred loading address
+ 0260/4 2.10+ init_size Linear memory required during initialization
+ 0264/4 2.11+ handover_offset Offset of handover entry point
+-0268/8 2.14+ acpi_rsdp_addr Physical address of RSDP table
+
+ (1) For backwards compatibility, if the setup_sects field contains 0, the
+ real value is 4.
+@@ -322,7 +309,7 @@ Protocol: 2.00+
+ Contains the magic number "HdrS" (0x53726448).
+
+ Field name: version
+-Type: modify
++Type: read
+ Offset/size: 0x206/2
+ Protocol: 2.00+
+
+@@ -330,12 +317,6 @@ Protocol: 2.00+
+ e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version
+ 10.17.
+
+- Up to protocol version 2.13 this information is only read by the
+- bootloader. From protocol version 2.14 onwards the bootloader will
+- write the used protocol version or-ed with 0x8000 to the field. The
+- used protocol version will be the minimum of the supported protocol
+- versions of the bootloader and the kernel.
+-
+ Field name: realmode_swtch
+ Type: modify (optional)
+ Offset/size: 0x208/4
+@@ -763,17 +744,6 @@ Offset/size: 0x264/4
+
+ See EFI HANDOVER PROTOCOL below for more details.
+
+-Field name: acpi_rsdp_addr
+-Type: write
+-Offset/size: 0x268/8
+-Protocol: 2.14+
+-
+- This field can be set by the boot loader to tell the kernel the
+- physical address of the ACPI RSDP table.
+-
+- A value of 0 indicates the kernel should fall back to the standard
+- methods to locate the RSDP.
+-
+
+ **** THE IMAGE CHECKSUM
+
+Index: linux/arch/x86/boot/header.S
+===================================================================
+--- linux.orig/arch/x86/boot/header.S
++++ linux/arch/x86/boot/header.S
+@@ -300,7 +300,7 @@ _start:
+ # Part 2 of the header, from the old setup.S
+
+ .ascii "HdrS" # header signature
+- .word 0x020e # header version number (>= 0x0105)
++ .word 0x020d # header version number (>= 0x0105)
+ # or else old loadlin-1.5 will fail)
+ .globl realmode_swtch
+ realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
+@@ -558,10 +558,6 @@ pref_address: .quad LOAD_PHYSICAL_ADDR
+ init_size: .long INIT_SIZE # kernel initialization size
+ handover_offset: .long 0 # Filled in by build.c
+
+-acpi_rsdp_addr: .quad 0 # 64-bit physical pointer to the
+- # ACPI RSDP table, added with
+- # version 2.14
+-
+ # End of setup header #####################################################
+
+ .section ".entrytext", "ax"
+Index: linux/arch/x86/include/asm/x86_init.h
+===================================================================
+--- linux.orig/arch/x86/include/asm/x86_init.h
++++ linux/arch/x86/include/asm/x86_init.h
+@@ -303,6 +303,4 @@ extern void x86_init_noop(void);
+ extern void x86_init_uint_noop(unsigned int unused);
+ extern bool x86_pnpbios_disabled(void);
+
+-void x86_verify_bootdata_version(void);
+-
+ #endif
+Index: linux/arch/x86/include/uapi/asm/bootparam.h
+===================================================================
+--- linux.orig/arch/x86/include/uapi/asm/bootparam.h
++++ linux/arch/x86/include/uapi/asm/bootparam.h
+@@ -16,9 +16,6 @@
+ #define RAMDISK_PROMPT_FLAG 0x8000
+ #define RAMDISK_LOAD_FLAG 0x4000
+
+-/* version flags */
+-#define VERSION_WRITTEN 0x8000
+-
+ /* loadflags */
+ #define LOADED_HIGH (1<<0)
+ #define KASLR_FLAG (1<<1)
+@@ -89,7 +86,6 @@ struct setup_header {
+ __u64 pref_address;
+ __u32 init_size;
+ __u32 handover_offset;
+- __u64 acpi_rsdp_addr;
+ } __attribute__((packed));
+
+ struct sys_desc_table {
+Index: linux/arch/x86/kernel/acpi/boot.c
+===================================================================
+--- linux.orig/arch/x86/kernel/acpi/boot.c
++++ linux/arch/x86/kernel/acpi/boot.c
+@@ -1775,5 +1775,5 @@ void __init arch_reserve_mem_area(acpi_p
+
+ u64 x86_default_get_root_pointer(void)
+ {
+- return boot_params.hdr.acpi_rsdp_addr;
++ return 0;
+ }
+Index: linux/arch/x86/kernel/head32.c
+===================================================================
+--- linux.orig/arch/x86/kernel/head32.c
++++ linux/arch/x86/kernel/head32.c
+@@ -37,7 +37,6 @@ asmlinkage __visible void __init i386_st
+ cr4_init_shadow();
+
+ sanitize_boot_params(&boot_params);
+- x86_verify_bootdata_version();
+
+ x86_early_init_platform_quirks();
+
+Index: linux/arch/x86/kernel/head64.c
+===================================================================
+--- linux.orig/arch/x86/kernel/head64.c
++++ linux/arch/x86/kernel/head64.c
+@@ -477,8 +477,6 @@ void __init x86_64_start_reservations(ch
+ if (!boot_params.hdr.version)
+ copy_bootdata(__va(real_mode_data));
+
+- x86_verify_bootdata_version();
+-
+ x86_early_init_platform_quirks();
+
+ switch (boot_params.hdr.hardware_subarch) {
+Index: linux/arch/x86/kernel/setup.c
+===================================================================
+--- linux.orig/arch/x86/kernel/setup.c
++++ linux/arch/x86/kernel/setup.c
+@@ -1281,23 +1281,6 @@ void __init setup_arch(char **cmdline_p)
+ unwind_init();
+ }
+
+-/*
+- * From boot protocol 2.14 onwards we expect the bootloader to set the
+- * version to "0x8000 | <used version>". In case we find a version >= 2.14
+- * without the 0x8000 we assume the boot loader supports 2.13 only and
+- * reset the version accordingly. The 0x8000 flag is removed in any case.
+- */
+-void __init x86_verify_bootdata_version(void)
+-{
+- if (boot_params.hdr.version & VERSION_WRITTEN)
+- boot_params.hdr.version &= ~VERSION_WRITTEN;
+- else if (boot_params.hdr.version >= 0x020e)
+- boot_params.hdr.version = 0x020d;
+-
+- if (boot_params.hdr.version < 0x020e)
+- boot_params.hdr.acpi_rsdp_addr = 0;
+-}
+-
+ #ifdef CONFIG_X86_32
+
+ static struct resource video_ram_resource = {
diff --git a/debian/patches/features/x86/x86-make-x32-syscall-support-conditional.patch b/debian/patches/features/x86/x86-make-x32-syscall-support-conditional.patch
new file mode 100644
index 000000000..3dde15cce
--- /dev/null
+++ b/debian/patches/features/x86/x86-make-x32-syscall-support-conditional.patch
@@ -0,0 +1,227 @@
+From: Ben Hutchings <ben@decadent.org.uk>
+Date: Mon, 12 Feb 2018 23:59:26 +0000
+Subject: x86: Make x32 syscall support conditional on a kernel parameter
+Bug-Debian: https://bugs.debian.org/708070
+Forwarded: https://lore.kernel.org/lkml/1415245982.3398.53.camel@decadent.org.uk/T/#u
+
+Enabling x32 in the standard amd64 kernel would increase its attack
+surface while provide no benefit to the vast majority of its users.
+No-one seems interested in regularly checking for vulnerabilities
+specific to x32 (at least no-one with a white hat).
+
+Still, adding another flavour just to turn on x32 seems wasteful. And
+the only differences on syscall entry are a few instructions that mask
+out the x32 flag and compare the syscall number.
+
+Use a static key to control whether x32 syscalls are really enabled, a
+Kconfig parameter to set its default value and a kernel parameter
+"syscall.x32" to change it at boot time.
+
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+---
+ Documentation/admin-guide/kernel-parameters.txt | 4 ++
+ arch/x86/Kconfig | 8 ++++
+ arch/x86/entry/common.c | 11 +++++-
+ arch/x86/entry/syscall_64.c | 41 ++++++++++++++++++++++++
+ arch/x86/include/asm/elf.h | 4 +-
+ arch/x86/include/asm/syscall.h | 13 +++++++
+ arch/x86/include/asm/unistd.h | 4 +-
+ 7 files changed, 80 insertions(+), 5 deletions(-)
+
+Index: linux/Documentation/admin-guide/kernel-parameters.txt
+===================================================================
+--- linux.orig/Documentation/admin-guide/kernel-parameters.txt
++++ linux/Documentation/admin-guide/kernel-parameters.txt
+@@ -4501,6 +4501,10 @@
+
+ switches= [HW,M68k]
+
++ syscall.x32= [KNL,x86_64] Enable/disable use of x32 syscalls on
++ an x86_64 kernel where CONFIG_X86_X32 is enabled.
++ Default depends on CONFIG_X86_X32_DISABLED.
++
+ sysfs.deprecated=0|1 [KNL]
+ Enable/disable old style sysfs layout for old udev
+ on older distributions. When this option is enabled
+Index: linux/arch/x86/Kconfig
+===================================================================
+--- linux.orig/arch/x86/Kconfig
++++ linux/arch/x86/Kconfig
+@@ -2884,6 +2884,14 @@ config COMPAT_32
+ select HAVE_UID16
+ select OLD_SIGSUSPEND3
+
++config X86_X32_DISABLED
++ bool "x32 ABI disabled by default"
++ depends on X86_X32
++ default n
++ help
++ Disable the x32 ABI unless explicitly enabled using the
++ kernel paramter "syscall.x32=y".
++
+ config COMPAT
+ def_bool y
+ depends on IA32_EMULATION || X86_X32
+Index: linux/arch/x86/entry/common.c
+===================================================================
+--- linux.orig/arch/x86/entry/common.c
++++ linux/arch/x86/entry/common.c
+@@ -287,12 +287,21 @@ __visible void do_syscall_64(unsigned lo
+ * table. The only functional difference is the x32 bit in
+ * regs->orig_ax, which changes the behavior of some syscalls.
+ */
+- nr &= __SYSCALL_MASK;
+- if (likely(nr < NR_syscalls)) {
++ if (x32_enabled) {
++ nr &= ~__X32_SYSCALL_BIT;
++ if (unlikely(nr >= NR_syscalls))
++ goto bad;
+ nr = array_index_nospec(nr, NR_syscalls);
++ goto good;
++ } else {
++ nr &= ~0U;
++ if (unlikely(nr >= NR_non_x32_syscalls))
++ goto bad;
++ nr = array_index_nospec(nr, NR_non_x32_syscalls);
++good:
+ regs->ax = sys_call_table[nr](regs);
+ }
+-
++bad:
+ syscall_return_slowpath(regs);
+ }
+ #endif
+Index: linux/arch/x86/entry/syscall_64.c
+===================================================================
+--- linux.orig/arch/x86/entry/syscall_64.c
++++ linux/arch/x86/entry/syscall_64.c
+@@ -4,6 +4,9 @@
+ #include <linux/linkage.h>
+ #include <linux/sys.h>
+ #include <linux/cache.h>
++#include <linux/moduleparam.h>
++#undef MODULE_PARAM_PREFIX
++#define MODULE_PARAM_PREFIX "syscall."
+ #include <asm/asm-offsets.h>
+ #include <asm/syscall.h>
+
+@@ -23,3 +26,50 @@ asmlinkage const sys_call_ptr_t sys_call
+ [0 ... __NR_syscall_max] = &sys_ni_syscall,
+ #include <asm/syscalls_64.h>
+ };
++
++#ifdef CONFIG_X86_X32_ABI
++
++/* Maybe enable x32 syscalls */
++
++#if defined(CONFIG_X86_X32_DISABLED)
++DEFINE_STATIC_KEY_FALSE(x32_enabled_skey);
++#else
++DEFINE_STATIC_KEY_TRUE(x32_enabled_skey);
++#endif
++
++static int __init x32_param_set(const char *val, const struct kernel_param *p)
++{
++ bool enabled;
++ int ret;
++
++ ret = kstrtobool(val, &enabled);
++ if (ret)
++ return ret;
++ if (IS_ENABLED(CONFIG_X86_X32_DISABLED)) {
++ if (enabled) {
++ static_key_enable(&x32_enabled_skey.key);
++ pr_info("Enabled x32 syscalls\n");
++ }
++ } else {
++ if (!enabled) {
++ static_key_disable(&x32_enabled_skey.key);
++ pr_info("Disabled x32 syscalls\n");
++ }
++ }
++ return 0;
++}
++
++static int x32_param_get(char *buffer, const struct kernel_param *p)
++{
++ return sprintf(buffer, "%c\n",
++ static_key_enabled(&x32_enabled_skey) ? 'Y' : 'N');
++}
++
++static const struct kernel_param_ops x32_param_ops = {
++ .set = x32_param_set,
++ .get = x32_param_get,
++};
++
++arch_param_cb(x32, &x32_param_ops, NULL, 0444);
++
++#endif
+Index: linux/arch/x86/include/asm/elf.h
+===================================================================
+--- linux.orig/arch/x86/include/asm/elf.h
++++ linux/arch/x86/include/asm/elf.h
+@@ -10,6 +10,7 @@
+ #include <asm/ptrace.h>
+ #include <asm/user.h>
+ #include <asm/auxvec.h>
++#include <asm/syscall.h>
+
+ typedef unsigned long elf_greg_t;
+
+@@ -163,7 +164,8 @@ do { \
+
+ #define compat_elf_check_arch(x) \
+ (elf_check_arch_ia32(x) || \
+- (IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64))
++ (IS_ENABLED(CONFIG_X86_X32_ABI) && x32_enabled && \
++ (x)->e_machine == EM_X86_64))
+
+ #if __USER32_DS != __USER_DS
+ # error "The following code assumes __USER32_DS == __USER_DS"
+Index: linux/arch/x86/include/asm/syscall.h
+===================================================================
+--- linux.orig/arch/x86/include/asm/syscall.h
++++ linux/arch/x86/include/asm/syscall.h
+@@ -16,6 +16,7 @@
+ #include <uapi/linux/audit.h>
+ #include <linux/sched.h>
+ #include <linux/err.h>
++#include <linux/jump_label.h>
+ #include <asm/asm-offsets.h> /* For NR_syscalls */
+ #include <asm/thread_info.h> /* for TS_COMPAT */
+ #include <asm/unistd.h>
+@@ -39,6 +40,18 @@ extern const sys_call_ptr_t sys_call_tab
+ extern const sys_call_ptr_t ia32_sys_call_table[];
+ #endif
+
++#if defined(CONFIG_X86_X32_ABI)
++#if defined(CONFIG_X86_X32_DISABLED)
++DECLARE_STATIC_KEY_FALSE(x32_enabled_skey);
++#define x32_enabled static_branch_unlikely(&x32_enabled_skey)
++#else
++DECLARE_STATIC_KEY_TRUE(x32_enabled_skey);
++#define x32_enabled static_branch_likely(&x32_enabled_skey)
++#endif
++#else
++#define x32_enabled 0
++#endif
++
+ /*
+ * Only the low 32 bits of orig_ax are meaningful, so we return int.
+ * This importantly ignores the high bits on 64-bit, so comparisons
+Index: linux/arch/x86/include/asm/unistd.h
+===================================================================
+--- linux.orig/arch/x86/include/asm/unistd.h
++++ linux/arch/x86/include/asm/unistd.h
+@@ -6,9 +6,9 @@
+
+
+ # ifdef CONFIG_X86_X32_ABI
+-# define __SYSCALL_MASK (~(__X32_SYSCALL_BIT))
++# define NR_non_x32_syscalls 512
+ # else
+-# define __SYSCALL_MASK (~0)
++# define NR_non_x32_syscalls NR_syscalls
+ # endif
+
+ # ifdef CONFIG_X86_32
diff --git a/debian/patches/features/x86/x86-memtest-WARN-if-bad-RAM-found.patch b/debian/patches/features/x86/x86-memtest-WARN-if-bad-RAM-found.patch
new file mode 100644
index 000000000..87b90de80
--- /dev/null
+++ b/debian/patches/features/x86/x86-memtest-WARN-if-bad-RAM-found.patch
@@ -0,0 +1,30 @@
+From: Ben Hutchings <ben@decadent.org.uk>
+Date: Mon, 5 Dec 2011 04:00:58 +0000
+Subject: x86: memtest: WARN if bad RAM found
+Bug-Debian: https://bugs.debian.org/613321
+Forwarded: http://thread.gmane.org/gmane.linux.kernel/1286471
+
+Since this is not a particularly thorough test, if we find any bad
+bits of RAM then there is a fair chance that there are other bad bits
+we fail to detect.
+
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+---
+ mm/memtest.c | 2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+Index: linux/mm/memtest.c
+===================================================================
+--- linux.orig/mm/memtest.c
++++ linux/mm/memtest.c
+@@ -27,6 +27,10 @@ static u64 patterns[] __initdata = {
+
+ static void __init reserve_bad_mem(u64 pattern, phys_addr_t start_bad, phys_addr_t end_bad)
+ {
++#ifdef CONFIG_X86
++ WARN_ONCE(1, "Bad RAM detected. Use memtest86+ to perform a thorough test\n"
++ "and the memmap= parameter to reserve the bad areas.");
++#endif
+ pr_info(" %016llx bad mem addr %pa - %pa reserved\n",
+ cpu_to_be64(pattern), &start_bad, &end_bad);
+ memblock_reserve(start_bad, end_bad - start_bad);