cleanup stackprotector canary generation
Subsystems (14)
Jason A. Donenfeld
maintainercover cleanup stackprotector canary generation
Stack canary generation currently lives partially in random.h, where it doesn't belong, and is in general a bit overcomplicated. This small patchset fixes up both issues. I'll take these in my tree, unless somebody else prefers to do so.
Jason A. Donenfeld (2):
stackprotector: move CANARY_MASK and get_random_canary() into
stackprotector.h
stackprotector: actually use get_random_canary()
arch/arm/include/asm/stackprotector.h | 9 +-------- arch/arm64/include/asm/stackprotector.h | 9 +-------- arch/csky/include/asm/stackprotector.h | 10 +--------- arch/mips/include/asm/stackprotector.h | 9 +-------- arch/powerpc/include/asm/stackprotector.h | 10 +--------- arch/riscv/include/asm/stackprotector.h | 10 +--------- arch/sh/include/asm/stackprotector.h | 10 +--------- arch/x86/include/asm/stackprotector.h | 14 +------------- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/setup_percpu.c | 2 +- arch/x86/kernel/smpboot.c | 2 +- arch/x86/xen/enlighten_pv.c | 2 +- arch/xtensa/include/asm/stackprotector.h | 7 +------ include/linux/random.h | 19 ------------------- include/linux/stackprotector.h | 19 +++++++++++++++++++ kernel/fork.c | 2 +- 16 files changed, 33 insertions(+), 103 deletions(-)
Signature · 1 line
2.38.1
Jason A. Donenfeld
maintainerPATCH 1/2 stackprotector: move CANARY_MASK and get_random_canary() into stackprotector.h
This has nothing to do with random.c and everything to do with stack protectors. Yes, it uses randomness. But many things use randomness. random.h and random.c are concerned with the generation of randomness, not with each and every use. So move this function into the more specific stackprotector.h file where it belongs.
--- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/setup_percpu.c | 2 +- arch/x86/kernel/smpboot.c | 2 +- arch/x86/xen/enlighten_pv.c | 2 +- include/linux/random.h | 19 ------------------- include/linux/stackprotector.h | 19 +++++++++++++++++++ kernel/fork.c | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-)
arch/x86/kernel/cpu/common.c +1 -1
@@ -22,9 +22,9 @@#include <linux/io.h> #include <linux/syscore_ops.h> #include <linux/pgtable.h> +#include <linux/stackprotector.h> #include <asm/cmdline.h> -#include <asm/stackprotector.h> #include <asm/perf_event.h> #include <asm/mmu_context.h> #include <asm/doublefault.h>
arch/x86/kernel/setup_percpu.c +1 -1
@@ -11,6 +11,7 @@#include <linux/smp.h> #include <linux/topology.h> #include <linux/pfn.h> +#include <linux/stackprotector.h> #include <asm/sections.h> #include <asm/processor.h> #include <asm/desc.h>
@@ -21,7 +22,6 @@#include <asm/proto.h> #include <asm/cpumask.h> #include <asm/cpu.h> -#include <asm/stackprotector.h> DEFINE_PER_CPU_READ_MOSTLY (int, cpu_number);EXPORT_PER_CPU_SYMBOL (cpu_number);
arch/x86/kernel/smpboot.c +1 -1
@@ -56,6 +56,7 @@#include <linux/numa.h> #include <linux/pgtable.h> #include <linux/overflow.h> +#include <linux/stackprotector.h> #include <asm/acpi.h> #include <asm/desc.h>
@@ -80,7 +81,6 @@#include <asm/cpu_device_id.h> #include <asm/spec-ctrl.h> #include <asm/hw_irq.h> -#include <asm/stackprotector.h> #include <asm/sev.h> /* representing HT siblings of each logical CPU */
arch/x86/xen/enlighten_pv.c +1 -1
@@ -32,6 +32,7 @@#include <linux/edd.h> #include <linux/reboot.h> #include <linux/virtio_anchor.h> +#include <linux/stackprotector.h> #include <xen/xen.h> #include <xen/events.h>
@@ -64,7 +65,6 @@#include <asm/pgalloc.h> #include <asm/tlbflush.h> #include <asm/reboot.h> -#include <asm/stackprotector.h> #include <asm/hypervisor.h> #include <asm/mach_traps.h> #include <asm/mwait.h>
include/linux/random.h +0 -19
@@ -115,25 +115,6 @@ static inline u32 get_random_u32_between(u32 floor, u32 ceil)return floor +get_random_u32_below (ceil - floor); } -/* -* On 64-bit architectures, protect against non-terminated C string overflows -* by zeroing out the first byte of the canary; this leaves 56 bits of entropy. -*/ -#ifdef CONFIG_64BIT -# ifdef __LITTLE_ENDIAN -# define CANARY_MASK 0xffffffffffffff00UL -# else /* big endian, 64 bits: */ -# define CANARY_MASK 0x00ffffffffffffffUL -# endif -#else /* 32 bits: */ -# define CANARY_MASK 0xffffffffUL -#endif - -static inline unsigned long get_random_canary (void ) -{ -return get_random_long () &CANARY_MASK ; -} -void __init random_init_early (const char *command_line);void __init random_init (void );bool rng_is_initialized (void );
include/linux/stackprotector.h +19 -0
@@ -6,6 +6,25 @@#include <linux/sched.h> #include <linux/random.h> +/* +* On 64-bit architectures, protect against non-terminated C string overflows +* by zeroing out the first byte of the canary; this leaves 56 bits of entropy. +*/ +#ifdef CONFIG_64BIT +# ifdef __LITTLE_ENDIAN +# define CANARY_MASK 0xffffffffffffff00UL +# else /* big endian, 64 bits: */ +# define CANARY_MASK 0x00ffffffffffffffUL +# endif +#else /* 32 bits: */ +# define CANARY_MASK 0xffffffffUL +#endif + +static inline unsigned long get_random_canary (void ) +{ +return get_random_long () &CANARY_MASK ; +} +#if defined(CONFIG_STACKPROTECTOR ) || defined(CONFIG_ARM64_PTR_AUTH )# include <asm/stackprotector.h> #else
kernel/fork.c +1 -1
@@ -75,7 +75,6 @@#include <linux/freezer.h> #include <linux/delayacct.h> #include <linux/taskstats_kern.h> -#include <linux/random.h> #include <linux/tty.h> #include <linux/fs_struct.h> #include <linux/magic.h>
@@ -97,6 +96,7 @@#include <linux/scs.h> #include <linux/io_uring.h> #include <linux/bpf.h> +#include <linux/stackprotector.h> #include <asm/pgalloc.h> #include <linux/uaccess.h>
Signature · 1 line
2.38.1
Re: [PATCH v1 1/2] stackprotector: move CANARY_MASK and get_random_canary() into stackprotector.h
Quoted 7 lines · Jason A. Donenfeld
This has nothing to do with
random.cand everything to do with stack protectors. Yes, it uses randomness. But many things use randomness.random.handrandom.care concerned with the generation of randomness, not with each and every use. So move this function into the more specificstackprotector.hfile where it belongs.Signed-off-by Jason A. Donenfeld <[email protected]>
Quoted 9 lines
--- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/setup_percpu.c | 2 +- arch/x86/kernel/smpboot.c | 2 +- arch/x86/xen/enlighten_pv.c | 2 +- include/linux/random.h | 19 ------------------- include/linux/stackprotector.h | 19 +++++++++++++++++++ kernel/fork.c | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-)
Jason A. Donenfeld
maintainerPATCH 2/2 stackprotector: actually use get_random_canary()
In reply to Jason A. DonenfeldThe RNG always mixes in the Linux version extremely early in boot. It also always includes a cycle counter, not only during early boot, but each and every time it is invoked prior to being fully initialized. Together, this means that the use of additional xors inside of the various stackprotector.h files is superfluous and over-complicated. Instead, we can get exactly the same thing, but better, by just calling get_random_canary().
--- arch/arm/include/asm/stackprotector.h | 9 +-------- arch/arm64/include/asm/stackprotector.h | 9 +-------- arch/csky/include/asm/stackprotector.h | 10 +--------- arch/mips/include/asm/stackprotector.h | 9 +-------- arch/powerpc/include/asm/stackprotector.h | 10 +--------- arch/riscv/include/asm/stackprotector.h | 10 +--------- arch/sh/include/asm/stackprotector.h | 10 +--------- arch/x86/include/asm/stackprotector.h | 14 +------------- arch/xtensa/include/asm/stackprotector.h | 7 +------ 9 files changed, 9 insertions(+), 79 deletions(-)
arch/arm/include/asm/stackprotector.h +1 -8
@@ -15,9 +15,6 @@#ifndef _ASM_STACKPROTECTOR_H#define _ASM_STACKPROTECTOR_H 1 -#include <linux/random.h> -#include <linux/version.h> -#include <asm/thread_info.h> extern unsigned long __stack_chk_guard;
@@ -30,11 +27,7 @@ extern unsigned long __stack_chk_guard;*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; +unsigned long canary =get_random_canary (); current->stack_canary = canary;#ifndef CONFIG_STACKPROTECTOR_PER_TASK
arch/arm64/include/asm/stackprotector.h +1 -8
@@ -13,8 +13,6 @@#ifndef __ASM_STACKPROTECTOR_H#define __ASM_STACKPROTECTOR_H -#include <linux/random.h> -#include <linux/version.h> #include <asm/pointer_auth.h> extern unsigned long __stack_chk_guard;
@@ -28,12 +26,7 @@ extern unsigned long __stack_chk_guard; static __always_inline void boot_init_stack_canary(void) {#if defined(CONFIG_STACKPROTECTOR ) -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; - canary &=CANARY_MASK ; +unsigned long canary =get_random_canary (); current->stack_canary = canary;if (!IS_ENABLED (CONFIG_STACKPROTECTOR_PER_TASK ))
arch/csky/include/asm/stackprotector.h +1 -9
@@ -2,9 +2,6 @@#ifndef _ASM_STACKPROTECTOR_H#define _ASM_STACKPROTECTOR_H 1 -#include <linux/random.h> -#include <linux/version.h> -extern unsigned long __stack_chk_guard;/*
@@ -15,12 +12,7 @@ extern unsigned long __stack_chk_guard;*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; - canary &=CANARY_MASK ; +unsigned long canary =get_random_canary (); current->stack_canary = canary; __stack_chk_guard = current->stack_canary;
arch/mips/include/asm/stackprotector.h +1 -8
@@ -15,9 +15,6 @@#ifndef _ASM_STACKPROTECTOR_H#define _ASM_STACKPROTECTOR_H 1 -#include <linux/random.h> -#include <linux/version.h> -extern unsigned long __stack_chk_guard;/*
@@ -28,11 +25,7 @@ extern unsigned long __stack_chk_guard;*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; +unsigned long canary =get_random_canary (); current->stack_canary = canary; __stack_chk_guard = current->stack_canary;
arch/powerpc/include/asm/stackprotector.h +1 -9
@@ -7,8 +7,6 @@#ifndef _ASM_STACKPROTECTOR_H#define _ASM_STACKPROTECTOR_H -#include <linux/random.h> -#include <linux/version.h> #include <asm/reg.h> #include <asm/current.h> #include <asm/paca.h>
@@ -21,13 +19,7 @@*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ - canary =get_random_canary (); - canary ^=mftb (); - canary ^=LINUX_VERSION_CODE ; - canary &=CANARY_MASK ; +unsigned long canary =get_random_canary (); current->stack_canary = canary;#ifdef CONFIG_PPC64
arch/riscv/include/asm/stackprotector.h +1 -9
@@ -3,9 +3,6 @@#ifndef _ASM_RISCV_STACKPROTECTOR_H#define _ASM_RISCV_STACKPROTECTOR_H -#include <linux/random.h> -#include <linux/version.h> -extern unsigned long __stack_chk_guard;/*
@@ -16,12 +13,7 @@ extern unsigned long __stack_chk_guard;*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; - canary &=CANARY_MASK ; +unsigned long canary =get_random_canary (); current->stack_canary = canary;if (!IS_ENABLED (CONFIG_STACKPROTECTOR_PER_TASK ))
arch/sh/include/asm/stackprotector.h +1 -9
@@ -2,9 +2,6 @@#ifndef __ASM_SH_STACKPROTECTOR_H#define __ASM_SH_STACKPROTECTOR_H -#include <linux/random.h> -#include <linux/version.h> -extern unsigned long __stack_chk_guard;/*
@@ -15,12 +12,7 @@ extern unsigned long __stack_chk_guard;*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; - canary &=CANARY_MASK ; +unsigned long canary =get_random_canary (); current->stack_canary = canary; __stack_chk_guard = current->stack_canary;
arch/x86/include/asm/stackprotector.h +1 -13
@@ -34,7 +34,6 @@#include <asm/percpu.h> #include <asm/desc.h> -#include <linux/random.h> #include <linux/sched.h> /*
@@ -50,22 +49,11 @@*/ static __always_inline void boot_init_stack_canary(void) { -u64 canary; -u64 tsc; +unsigned long canary =get_random_canary ();#ifdef CONFIG_X86_64 BUILD_BUG_ON (offsetof(struct fixed_percpu_data , stack_canary) !=40 );#endif -/* -* We both use the random pool and the current TSC as a source -* of randomness. The TSC only matters for very early init, -* there it already has some randomness on most systems. Later -* on during the bootup the random pool has true entropy too. -*/ -get_random_bytes (&canary,sizeof (canary)); - tsc =rdtsc (); - canary += tsc + (tsc <<32UL ); - canary &=CANARY_MASK ; current->stack_canary = canary;#ifdef CONFIG_X86_64
arch/xtensa/include/asm/stackprotector.h +1 -6
@@ -14,7 +14,6 @@#ifndef _ASM_STACKPROTECTOR_H#define _ASM_STACKPROTECTOR_H 1 -#include <linux/random.h> #include <linux/version.h> extern unsigned long __stack_chk_guard;
@@ -27,11 +26,7 @@ extern unsigned long __stack_chk_guard;*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; +unsigned long canary =get_random_canary (); current->stack_canary = canary; __stack_chk_guard = current->stack_canary;
Signature · 1 line
2.38.1
Re: [PATCH v1 2/2] stackprotector: actually use get_random_canary()
Quoted 91 lines · Jason A. Donenfeld
The RNG always mixes in the Linux version extremely early in boot. It also always includes a cycle counter, not only during early boot, but each and every time it is invoked prior to being fully initialized. Together, this means that the use of additional xors inside of the various
stackprotector.hfiles is superfluous and over-complicated. Instead, we can get exactly the same thing, but better, by just callingget_random_canary().Signed-off-by Jason A. Donenfeld <[email protected]>--- arch/arm/include/asm/stackprotector.h | 9 +-------- arch/arm64/include/asm/stackprotector.h | 9 +-------- arch/csky/include/asm/stackprotector.h | 10 +--------- arch/mips/include/asm/stackprotector.h | 9 +-------- arch/powerpc/include/asm/stackprotector.h | 10 +--------- arch/riscv/include/asm/stackprotector.h | 10 +--------- arch/sh/include/asm/stackprotector.h | 10 +--------- arch/x86/include/asm/stackprotector.h | 14 +------------- arch/xtensa/include/asm/stackprotector.h | 7 +------ 9 files changed, 9 insertions(+), 79 deletions(-)arch/arm/include/asm/stackprotector.h +1
-8@@ -15,9 +15,6 @@#ifndef _ASM_STACKPROTECTOR_H#define _ASM_STACKPROTECTOR_H 1 -#include <linux/random.h> -#include <linux/version.h> -#include <asm/thread_info.h> extern unsigned long __stack_chk_guard;@@ -30,11 +27,7 @@ extern unsigned long __stack_chk_guard;*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; +unsigned long canary =get_random_canary (); current->stack_canary = canary;#ifndef CONFIG_STACKPROTECTOR_PER_TASK arch/arm64/include/asm/stackprotector.h +1
-8@@ -13,8 +13,6 @@#ifndef __ASM_STACKPROTECTOR_H#define __ASM_STACKPROTECTOR_H -#include <linux/random.h> -#include <linux/version.h> #include <asm/pointer_auth.h> extern unsigned long __stack_chk_guard;@@ -28,12 +26,7 @@ extern unsigned long __stack_chk_guard; static __always_inline void boot_init_stack_canary(void) {#if defined(CONFIG_STACKPROTECTOR ) -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; - canary &=CANARY_MASK ; +unsigned long canary =get_random_canary (); current->stack_canary = canary;if (!IS_ENABLED (CONFIG_STACKPROTECTOR_PER_TASK ))arch/csky/include/asm/stackprotector.h +0
-3@@ -2,9 +2,6 @@#ifndef _ASM_STACKPROTECTOR_H#define _ASM_STACKPROTECTOR_H 1 -#include <linux/random.h> -#include <linux/version.h> -extern unsigned long __stack_chk_guard;/*
arch/csky/include/asm/stackprotector.h extern unsigned long __stack_chk_guard; · line 15
Quoted 10 lines
arch/csky/include/asm/stackprotector.h +1
-6@@ -15,12 +12,7 @@ extern unsigned long __stack_chk_guard;*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; - canary &=CANARY_MASK ; +unsigned long canary =get_random_canary ();
Quoted 178 lines
arch/csky/include/asm/stackprotector.h +0
-0current->stack_canary = canary; __stack_chk_guard = current->stack_canary;arch/mips/include/asm/stackprotector.h +1
-8@@ -15,9 +15,6 @@#ifndef _ASM_STACKPROTECTOR_H#define _ASM_STACKPROTECTOR_H 1 -#include <linux/random.h> -#include <linux/version.h> -extern unsigned long __stack_chk_guard;/* @@ -28,11 +25,7 @@ extern unsigned long __stack_chk_guard;*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; +unsigned long canary =get_random_canary (); current->stack_canary = canary; __stack_chk_guard = current->stack_canary;arch/powerpc/include/asm/stackprotector.h +1
-9@@ -7,8 +7,6 @@#ifndef _ASM_STACKPROTECTOR_H#define _ASM_STACKPROTECTOR_H -#include <linux/random.h> -#include <linux/version.h> #include <asm/reg.h> #include <asm/current.h> #include <asm/paca.h> @@ -21,13 +19,7 @@*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ - canary =get_random_canary (); - canary ^=mftb (); - canary ^=LINUX_VERSION_CODE ; - canary &=CANARY_MASK ; +unsigned long canary =get_random_canary (); current->stack_canary = canary;#ifdef CONFIG_PPC64 arch/riscv/include/asm/stackprotector.h +1
-9@@ -3,9 +3,6 @@#ifndef _ASM_RISCV_STACKPROTECTOR_H#define _ASM_RISCV_STACKPROTECTOR_H -#include <linux/random.h> -#include <linux/version.h> -extern unsigned long __stack_chk_guard;/* @@ -16,12 +13,7 @@ extern unsigned long __stack_chk_guard;*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; - canary &=CANARY_MASK ; +unsigned long canary =get_random_canary (); current->stack_canary = canary;if (!IS_ENABLED (CONFIG_STACKPROTECTOR_PER_TASK ))arch/sh/include/asm/stackprotector.h +1
-9@@ -2,9 +2,6 @@#ifndef __ASM_SH_STACKPROTECTOR_H#define __ASM_SH_STACKPROTECTOR_H -#include <linux/random.h> -#include <linux/version.h> -extern unsigned long __stack_chk_guard;/* @@ -15,12 +12,7 @@ extern unsigned long __stack_chk_guard;*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; - canary &=CANARY_MASK ; +unsigned long canary =get_random_canary (); current->stack_canary = canary; __stack_chk_guard = current->stack_canary;arch/x86/include/asm/stackprotector.h +1
-13@@ -34,7 +34,6 @@#include <asm/percpu.h> #include <asm/desc.h> -#include <linux/random.h> #include <linux/sched.h> /* @@ -50,22 +49,11 @@*/ static __always_inline void boot_init_stack_canary(void) { -u64 canary; -u64 tsc; +unsigned long canary =get_random_canary ();#ifdef CONFIG_X86_64 BUILD_BUG_ON (offsetof(struct fixed_percpu_data , stack_canary) !=40 );#endif -/* -* We both use the random pool and the current TSC as a source -* of randomness. The TSC only matters for very early init, -* there it already has some randomness on most systems. Later -* on during the bootup the random pool has true entropy too. -*/ -get_random_bytes (&canary,sizeof (canary)); - tsc =rdtsc (); - canary += tsc + (tsc <<32UL ); - canary &=CANARY_MASK ; current->stack_canary = canary;#ifdef CONFIG_X86_64 arch/xtensa/include/asm/stackprotector.h +1
-7@@ -14,7 +14,6 @@#ifndef _ASM_STACKPROTECTOR_H#define _ASM_STACKPROTECTOR_H 1 -#include <linux/random.h> #include <linux/version.h> extern unsigned long __stack_chk_guard;@@ -27,11 +26,7 @@ extern unsigned long __stack_chk_guard;*/ static __always_inline void boot_init_stack_canary(void) { -unsigned long canary; - -/* Try to get a semi random initial value. */ -get_random_bytes (&canary,sizeof (canary)); - canary ^=LINUX_VERSION_CODE ; +unsigned long canary =get_random_canary (); current->stack_canary = canary; __stack_chk_guard = current->stack_canary; --2.38.1
Signature · 2 lines
Best Regards Guo Ren
Re: [PATCH v1 2/2] stackprotector: actually use get_random_canary()
In reply to Jason A. DonenfeldQuoted 8 lines · Jason A. Donenfeld
The RNG always mixes in the Linux version extremely early in boot. It also always includes a cycle counter, not only during early boot, but each and every time it is invoked prior to being fully initialized. Together, this means that the use of additional xors inside of the various
stackprotector.hfiles is superfluous and over-complicated. Instead, we can get exactly the same thing, but better, by just callingget_random_canary().
Quoted 4 lines
Signed-off-by Jason A. Donenfeld <[email protected]>--- arch/arm/include/asm/stackprotector.h | 9 +-------- arch/arm64/include/asm/stackprotector.h | 9 +--------
For arm64:
Quoted 28 lines · Jason A. Donenfeld
Stack canary generation currently lives partially in
random.h, where it doesn't belong, and is in general a bit overcomplicated. This small patchset fixes up both issues. I'll take these in my tree, unless somebody else prefers to do so.Cc Albert Ou <[email protected]>Cc Boris Ostrovsky <[email protected]>Cc Borislav Petkov <[email protected]>Cc Catalin Marinas <[email protected]>Cc Chris Zankel <[email protected]>Cc Christophe Leroy <[email protected]>Cc Dave Hansen <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Guo Ren <[email protected]>Cc H. Peter Anvin <[email protected]>Cc Ingo Molnar <[email protected]>Cc Juergen Gross <[email protected]>Cc Max Filippov <[email protected]>Cc Michael Ellerman <[email protected]>Cc Nicholas Piggin <[email protected]>Cc Palmer Dabbelt <[email protected]>Cc Paul Walmsley <[email protected]>Cc Rich Felker <[email protected]>Cc Russell King <[email protected]>Cc Thomas Bogendoerfer <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Will Deacon <[email protected]>Cc Yoshinori Sato <[email protected]>