Skip to content

Commit 631aa74

Browse files
committed
Merge tag 'x86-misc-2022-12-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull misc x86 updates from Thomas Gleixner: "Updates for miscellaneous x86 areas: - Reserve a new boot loader type for barebox which is usally used on ARM and MIPS, but can also be utilized as EFI payload on x86 to provide watchdog-supervised boot up. - Consolidate the native and compat 32bit signal handling code and split the 64bit version out into a separate source file - Switch the ESPFIX random usage to get_random_long()" * tag 'x86-misc-2022-12-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/espfix: Use get_random_long() rather than archrandom x86/signal/64: Move 64-bit signal code to its own file x86/signal/32: Merge native and compat 32-bit signal code x86/signal: Add ABI prefixes to frame setup functions x86/signal: Merge get_sigframe() x86: Remove __USER32_DS signal/compat: Remove compat_sigset_t override x86/signal: Remove sigset_t parameter from frame setup functions x86/signal: Remove sig parameter from frame setup functions Documentation/x86/boot: Reserve type_of_loader=13 for barebox
2 parents 0a1d443 + 00ed1ea commit 631aa74

16 files changed

Lines changed: 495 additions & 721 deletions

File tree

Documentation/x86/boot.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ Protocol: 2.00+
455455
11 Minimal Linux Bootloader
456456
<http://sebastian-plotz.blogspot.de>
457457
12 OVMF UEFI virtualization stack
458+
13 barebox
458459
== =======================================
459460

460461
Please contact <hpa@zytor.com> if you need a bootloader ID value assigned.

arch/x86/entry/entry_64_compat.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ SYM_CODE_START(entry_SYSENTER_compat)
6161
movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
6262

6363
/* Construct struct pt_regs on stack */
64-
pushq $__USER32_DS /* pt_regs->ss */
64+
pushq $__USER_DS /* pt_regs->ss */
6565
pushq $0 /* pt_regs->sp = 0 (placeholder) */
6666

6767
/*
@@ -197,7 +197,7 @@ SYM_INNER_LABEL(entry_SYSCALL_compat_safe_stack, SYM_L_GLOBAL)
197197
ANNOTATE_NOENDBR
198198

199199
/* Construct struct pt_regs on stack */
200-
pushq $__USER32_DS /* pt_regs->ss */
200+
pushq $__USER_DS /* pt_regs->ss */
201201
pushq %r8 /* pt_regs->sp */
202202
pushq %r11 /* pt_regs->flags */
203203
pushq $__USER32_CS /* pt_regs->cs */

arch/x86/ia32/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@
33
# Makefile for the ia32 kernel emulation subsystem.
44
#
55

6-
obj-$(CONFIG_IA32_EMULATION) := ia32_signal.o
7-
86
audit-class-$(CONFIG_AUDIT) := audit.o
97
obj-$(CONFIG_IA32_EMULATION) += $(audit-class-y)

arch/x86/include/asm/elf.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,6 @@ do { \
152152
(elf_check_arch_ia32(x) || \
153153
(IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64))
154154

155-
#if __USER32_DS != __USER_DS
156-
# error "The following code assumes __USER32_DS == __USER_DS"
157-
#endif
158-
159155
static inline void elf_common_init(struct thread_struct *t,
160156
struct pt_regs *regs, const u16 ds)
161157
{

arch/x86/include/asm/fpu/signal.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,9 @@
1313
#ifdef CONFIG_X86_64
1414
# include <uapi/asm/sigcontext.h>
1515
# include <asm/user32.h>
16-
struct ksignal;
17-
int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
18-
compat_sigset_t *set, struct pt_regs *regs);
19-
int ia32_setup_frame(int sig, struct ksignal *ksig,
20-
compat_sigset_t *set, struct pt_regs *regs);
2116
#else
2217
# define user_i387_ia32_struct user_i387_struct
2318
# define user32_fxsr_struct user_fxsr_struct
24-
# define ia32_setup_frame __setup_frame
25-
# define ia32_setup_rt_frame __setup_rt_frame
2619
#endif
2720

2821
extern void convert_from_fxsr(struct user_i387_ia32_struct *env,

arch/x86/include/asm/segment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
#define __KERNEL_DS (GDT_ENTRY_KERNEL_DS*8)
136136
#define __USER_DS (GDT_ENTRY_DEFAULT_USER_DS*8 + 3)
137137
#define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS*8 + 3)
138+
#define __USER32_CS __USER_CS
138139
#define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS*8)
139140

140141
/* segment for calling fn: */
@@ -210,7 +211,6 @@
210211
#define __KERNEL_DS (GDT_ENTRY_KERNEL_DS*8)
211212
#define __USER32_CS (GDT_ENTRY_DEFAULT_USER32_CS*8 + 3)
212213
#define __USER_DS (GDT_ENTRY_DEFAULT_USER_DS*8 + 3)
213-
#define __USER32_DS __USER_DS
214214
#define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS*8 + 3)
215215
#define __CPUNODE_SEG (GDT_ENTRY_CPUNODE*8 + 3)
216216

arch/x86/include/asm/sighandling.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,13 @@
1515

1616
void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
1717

18+
void __user *
19+
get_sigframe(struct ksignal *ksig, struct pt_regs *regs, size_t frame_size,
20+
void __user **fpstate);
21+
22+
int ia32_setup_frame(struct ksignal *ksig, struct pt_regs *regs);
23+
int ia32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs);
24+
int x64_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs);
25+
int x32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs);
26+
1827
#endif /* _ASM_X86_SIGHANDLING_H */

arch/x86/include/asm/signal.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ typedef struct {
2828
#define SA_IA32_ABI 0x02000000u
2929
#define SA_X32_ABI 0x01000000u
3030

31-
#ifndef CONFIG_COMPAT
32-
#define compat_sigset_t compat_sigset_t
33-
typedef sigset_t compat_sigset_t;
34-
#endif
35-
3631
#endif /* __ASSEMBLY__ */
3732
#include <uapi/asm/signal.h>
3833
#ifndef __ASSEMBLY__

arch/x86/kernel/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ obj-y += head_$(BITS).o
4444
obj-y += head$(BITS).o
4545
obj-y += ebda.o
4646
obj-y += platform-quirks.o
47-
obj-y += process_$(BITS).o signal.o
47+
obj-y += process_$(BITS).o signal.o signal_$(BITS).o
4848
obj-$(CONFIG_COMPAT) += signal_compat.o
4949
obj-y += traps.o idt.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
5050
obj-y += time.o ioport.o dumpstack.o nmi.o
@@ -54,7 +54,7 @@ obj-$(CONFIG_JUMP_LABEL) += jump_label.o
5454
obj-$(CONFIG_IRQ_WORK) += irq_work.o
5555
obj-y += probe_roms.o
5656
obj-$(CONFIG_X86_32) += sys_ia32.o
57-
obj-$(CONFIG_IA32_EMULATION) += sys_ia32.o
57+
obj-$(CONFIG_IA32_EMULATION) += sys_ia32.o signal_32.o
5858
obj-$(CONFIG_X86_64) += sys_x86_64.o
5959
obj-$(CONFIG_X86_ESPFIX64) += espfix_64.o
6060
obj-$(CONFIG_SYSFS) += ksysfs.o

arch/x86/kernel/espfix_64.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,7 @@ static inline unsigned long espfix_base_addr(unsigned int cpu)
9494

9595
static void init_espfix_random(void)
9696
{
97-
unsigned long rand;
98-
99-
/*
100-
* This is run before the entropy pools are initialized,
101-
* but this is hopefully better than nothing.
102-
*/
103-
if (!arch_get_random_longs(&rand, 1)) {
104-
/* The constant is an arbitrary large prime */
105-
rand = rdtsc();
106-
rand *= 0xc345c6b72fd16123UL;
107-
}
97+
unsigned long rand = get_random_long();
10898

10999
slot_random = rand % ESPFIX_STACKS_PER_PAGE;
110100
page_random = (rand / ESPFIX_STACKS_PER_PAGE)

0 commit comments

Comments
 (0)