Commit 66f79309 authored by David Woodhouse's avatar David Woodhouse Committed by Thomas Gleixner
Browse files

x86/retpoline: Avoid retpolines for built-in __init functions

There's no point in building init code with retpolines, since it runs before
any potentially hostile userspace does. And before the retpoline is actually
ALTERNATIVEd into place, for much of it.

Signed-off-by: default avatarDavid Woodhouse <>
Signed-off-by: default avatarThomas Gleixner <>
parent 085331df
......@@ -5,6 +5,13 @@
#include <linux/compiler.h>
#include <linux/types.h>
/* Built-in __init functions needn't be compiled with retpoline */
#if defined(RETPOLINE) && !defined(MODULE)
#define __noretpoline __attribute__((indirect_branch("keep")))
#define __noretpoline
/* These macros are used to mark some functions or
* initialized data (doesn't apply to uninitialized data)
* as `initialization' functions. The kernel can take this
......@@ -40,7 +47,7 @@
/* These are for everybody (although not all archs will actually
discard it in modules) */
#define __init __section(.init.text) __cold __latent_entropy
#define __init __section(.init.text) __cold __latent_entropy __noretpoline
#define __initdata __section(
#define __initconst __section(.init.rodata)
#define __exitdata __section(
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment