Skip to content

Commit 217eee7

Browse files
committed
Merge tag 'x86_urgent_for_v5.9_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Borislav Petkov: - A defconfig fix (Daniel Díaz) - Disable relocation relaxation for the compressed kernel when not built as -pie as in that case kernels built with clang and linked with LLD fail to boot due to the linker optimizing some instructions in non-PIE form; the gory details in the commit message (Arvind Sankar) - A fix for the "bad bp value" warning issued by the frame-pointer unwinder (Josh Poimboeuf) * tag 'x86_urgent_for_v5.9_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/unwind/fp: Fix FP unwinding in ret_from_fork x86/boot/compressed: Disable relocation relaxation x86/defconfigs: Explicitly unset CONFIG_64BIT in i386_defconfig
2 parents 4a123db + 6f9885a commit 217eee7

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

arch/x86/boot/compressed/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ KBUILD_CFLAGS += -Wno-pointer-sign
4343
KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
4444
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
4545
KBUILD_CFLAGS += -D__DISABLE_EXPORTS
46+
# Disable relocation relaxation in case the link is not PIE.
47+
KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no)
4648

4749
KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
4850
GCOV_PROFILE := n

arch/x86/configs/i386_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ CONFIG_CGROUP_CPUACCT=y
1919
CONFIG_BLK_DEV_INITRD=y
2020
# CONFIG_COMPAT_BRK is not set
2121
CONFIG_PROFILING=y
22+
# CONFIG_64BIT is not set
2223
CONFIG_SMP=y
2324
CONFIG_X86_GENERIC=y
2425
CONFIG_HPET_TIMER=y

arch/x86/include/asm/frame.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,26 @@
6060
#define FRAME_END "pop %" _ASM_BP "\n"
6161

6262
#ifdef CONFIG_X86_64
63+
6364
#define ENCODE_FRAME_POINTER \
6465
"lea 1(%rsp), %rbp\n\t"
66+
67+
static inline unsigned long encode_frame_pointer(struct pt_regs *regs)
68+
{
69+
return (unsigned long)regs + 1;
70+
}
71+
6572
#else /* !CONFIG_X86_64 */
73+
6674
#define ENCODE_FRAME_POINTER \
6775
"movl %esp, %ebp\n\t" \
6876
"andl $0x7fffffff, %ebp\n\t"
77+
78+
static inline unsigned long encode_frame_pointer(struct pt_regs *regs)
79+
{
80+
return (unsigned long)regs & 0x7fffffff;
81+
}
82+
6983
#endif /* CONFIG_X86_64 */
7084

7185
#endif /* __ASSEMBLY__ */
@@ -83,6 +97,11 @@
8397

8498
#define ENCODE_FRAME_POINTER
8599

100+
static inline unsigned long encode_frame_pointer(struct pt_regs *regs)
101+
{
102+
return 0;
103+
}
104+
86105
#endif
87106

88107
#define FRAME_BEGIN

arch/x86/kernel/process.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <asm/spec-ctrl.h>
4343
#include <asm/io_bitmap.h>
4444
#include <asm/proto.h>
45+
#include <asm/frame.h>
4546

4647
#include "process.h"
4748

@@ -133,7 +134,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg,
133134
fork_frame = container_of(childregs, struct fork_frame, regs);
134135
frame = &fork_frame->frame;
135136

136-
frame->bp = 0;
137+
frame->bp = encode_frame_pointer(childregs);
137138
frame->ret_addr = (unsigned long) ret_from_fork;
138139
p->thread.sp = (unsigned long) fork_frame;
139140
p->thread.io_bitmap = NULL;

0 commit comments

Comments
 (0)