Skip to content

Commit 8e0b986

Browse files
committed
s390: Remove compat support
There shouldn't be any 31 bit code around anymore that matters. Remove the compat layer support required to run 31 bit code. Reason for removal is code simplification and reduced test effort. Note that this comes without any deprecation warnings added to config options, or kernel messages, since most likely those would be ignored anyway. If it turns out there is still a reason to keep the compat layer this can be reverted at any time in the future. Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent 169ebcb commit 8e0b986

57 files changed

Lines changed: 30 additions & 2484 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

arch/s390/Kconfig

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -505,22 +505,6 @@ config COMMAND_LINE_SIZE
505505
This allows you to specify the maximum length of the kernel command
506506
line.
507507

508-
config COMPAT
509-
def_bool n
510-
prompt "Kernel support for 31 bit emulation"
511-
select ARCH_WANT_OLD_COMPAT_IPC
512-
select COMPAT_OLD_SIGACTION
513-
select HAVE_UID16
514-
depends on MULTIUSER
515-
depends on !CC_IS_CLANG && !LD_IS_LLD
516-
help
517-
Select this option if you want to enable your system kernel to
518-
handle system-calls from ELF binaries for 31 bit ESA. This option
519-
(and some other stuff like libraries and such) is needed for
520-
executing 31 bit applications.
521-
522-
If unsure say N.
523-
524508
config SMP
525509
def_bool y
526510

arch/s390/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,8 @@ ifeq ($(KBUILD_EXTMOD),)
149149
prepare: vdso_prepare
150150
vdso_prepare: prepare0
151151
$(Q)$(MAKE) $(build)=arch/s390/kernel/vdso64 include/generated/vdso64-offsets.h
152-
$(if $(CONFIG_COMPAT),$(Q)$(MAKE) \
153-
$(build)=arch/s390/kernel/vdso32 include/generated/vdso32-offsets.h)
154152

155153
vdso-install-y += arch/s390/kernel/vdso64/vdso64.so.dbg
156-
vdso-install-$(CONFIG_COMPAT) += arch/s390/kernel/vdso32/vdso32.so.dbg
157154

158155
endif
159156

arch/s390/boot/ipl_data.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
22

3-
#include <linux/compat.h>
43
#include <linux/ptrace.h>
54
#include <asm/cio.h>
65
#include <asm/asm-offsets.h>

arch/s390/configs/compat.config

Lines changed: 0 additions & 3 deletions
This file was deleted.

arch/s390/hypfs/hypfs_sprp.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
88
*/
99

10-
#include <linux/compat.h>
1110
#include <linux/errno.h>
1211
#include <linux/gfp.h>
1312
#include <linux/string.h>
@@ -116,10 +115,7 @@ static long hypfs_sprp_ioctl(struct file *file, unsigned int cmd,
116115

117116
if (!capable(CAP_SYS_ADMIN))
118117
return -EACCES;
119-
if (is_compat_task())
120-
argp = compat_ptr(arg);
121-
else
122-
argp = (void __user *) arg;
118+
argp = (void __user *)arg;
123119
switch (cmd) {
124120
case HYPFS_DIAG304:
125121
return __hypfs_sprp_ioctl(argp);

arch/s390/include/asm/compat.h

Lines changed: 0 additions & 140 deletions
This file was deleted.

arch/s390/include/asm/elf.h

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,13 @@ enum {
162162
* ELF register definitions..
163163
*/
164164

165-
#include <linux/compat.h>
166-
167165
#include <asm/ptrace.h>
168166
#include <asm/syscall.h>
169167
#include <asm/user.h>
170168

171169
typedef s390_fp_regs elf_fpregset_t;
172170
typedef s390_regs elf_gregset_t;
173171

174-
typedef s390_fp_regs compat_elf_fpregset_t;
175-
typedef s390_compat_regs compat_elf_gregset_t;
176-
177172
#include <linux/sched/mm.h> /* for task_struct */
178173
#include <asm/mmu_context.h>
179174

@@ -183,10 +178,6 @@ typedef s390_compat_regs compat_elf_gregset_t;
183178
#define elf_check_arch(x) \
184179
(((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \
185180
&& (x)->e_ident[EI_CLASS] == ELF_CLASS)
186-
#define compat_elf_check_arch(x) \
187-
(((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \
188-
&& (x)->e_ident[EI_CLASS] == ELF_CLASS)
189-
#define compat_start_thread start_thread31
190181

191182
/* For SVR4/S390 the function pointer to be registered with `atexit` is
192183
passed in R14. */
@@ -203,9 +194,7 @@ typedef s390_compat_regs compat_elf_gregset_t;
203194
the loader. We need to make sure that it is out of the way of the program
204195
that it will "exec", and that there is sufficient room for the brk. 64-bit
205196
tasks are aligned to 4GB. */
206-
#define ELF_ET_DYN_BASE (is_compat_task() ? \
207-
(STACK_TOP / 3 * 2) : \
208-
(STACK_TOP / 3 * 2) & ~((1UL << 32) - 1))
197+
#define ELF_ET_DYN_BASE ((STACK_TOP / 3 * 2) & ~((1UL << 32) - 1))
209198

210199
/* This yields a mask that user programs can use to figure out what
211200
instruction set this CPU supports. */
@@ -224,43 +213,22 @@ extern unsigned long elf_hwcap;
224213
extern char elf_platform[];
225214
#define ELF_PLATFORM (elf_platform)
226215

227-
#ifndef CONFIG_COMPAT
228216
#define SET_PERSONALITY(ex) \
229217
do { \
230218
set_personality(PER_LINUX | \
231219
(current->personality & (~PER_MASK))); \
232220
current->thread.sys_call_table = sys_call_table; \
233221
} while (0)
234-
#else /* CONFIG_COMPAT */
235-
#define SET_PERSONALITY(ex) \
236-
do { \
237-
if (personality(current->personality) != PER_LINUX32) \
238-
set_personality(PER_LINUX | \
239-
(current->personality & ~PER_MASK)); \
240-
if ((ex).e_ident[EI_CLASS] == ELFCLASS32) { \
241-
set_thread_flag(TIF_31BIT); \
242-
current->thread.sys_call_table = \
243-
sys_call_table_emu; \
244-
} else { \
245-
clear_thread_flag(TIF_31BIT); \
246-
current->thread.sys_call_table = \
247-
sys_call_table; \
248-
} \
249-
} while (0)
250-
#endif /* CONFIG_COMPAT */
251222

252223
/*
253224
* Cache aliasing on the latest machines calls for a mapping granularity
254-
* of 512KB for the anonymous mapping base. For 64-bit processes use a
255-
* 512KB alignment and a randomization of up to 1GB. For 31-bit processes
256-
* the virtual address space is limited, use no alignment and limit the
257-
* randomization to 8MB.
258-
* For the additional randomization of the program break use 32MB for
259-
* 64-bit and 8MB for 31-bit.
225+
* of 512KB for the anonymous mapping base. Use a 512KB alignment and a
226+
* randomization of up to 1GB.
227+
* For the additional randomization of the program break use 32MB.
260228
*/
261-
#define BRK_RND_MASK (is_compat_task() ? 0x7ffUL : 0x1fffUL)
262-
#define MMAP_RND_MASK (is_compat_task() ? 0x7ffUL : 0x3ff80UL)
263-
#define MMAP_ALIGN_MASK (is_compat_task() ? 0 : 0x7fUL)
229+
#define BRK_RND_MASK (0x1fffUL)
230+
#define MMAP_RND_MASK (0x3ff80UL)
231+
#define MMAP_ALIGN_MASK (0x7fUL)
264232
#define STACK_RND_MASK MMAP_RND_MASK
265233

266234
/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */

arch/s390/include/asm/ftrace.h

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -105,28 +105,11 @@ static inline void arch_ftrace_set_direct_caller(struct ftrace_regs *fregs, unsi
105105
}
106106
#endif /* CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */
107107

108-
/*
109-
* Even though the system call numbers are identical for s390/s390x a
110-
* different system call table is used for compat tasks. This may lead
111-
* to e.g. incorrect or missing trace event sysfs files.
112-
* Therefore simply do not trace compat system calls at all.
113-
* See kernel/trace/trace_syscalls.c.
114-
*/
115-
#define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS
116-
static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
117-
{
118-
return is_compat_task();
119-
}
120-
121108
#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
122109
static inline bool arch_syscall_match_sym_name(const char *sym,
123110
const char *name)
124111
{
125-
/*
126-
* Skip __s390_ and __s390x_ prefix - due to compat wrappers
127-
* and aliasing some symbols of 64 bit system call functions
128-
* may get the __s390_ prefix instead of the __s390x_ prefix.
129-
*/
112+
/* Skip the __s390x_ prefix. */
130113
return !strcmp(sym + 7, name) || !strcmp(sym + 8, name);
131114
}
132115

arch/s390/include/asm/processor.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,12 @@ extern void execve_tail(void);
119119
unsigned long vdso_text_size(void);
120120
unsigned long vdso_size(void);
121121

122-
/*
123-
* User space process size: 2GB for 31 bit, 4TB or 8PT for 64 bit.
124-
*/
125-
126-
#define TASK_SIZE (test_thread_flag(TIF_31BIT) ? \
127-
_REGION3_SIZE : TASK_SIZE_MAX)
128-
#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_31BIT) ? \
129-
(_REGION3_SIZE >> 1) : (_REGION2_SIZE >> 1))
122+
#define TASK_SIZE (TASK_SIZE_MAX)
123+
#define TASK_UNMAPPED_BASE (_REGION2_SIZE >> 1)
130124
#define TASK_SIZE_MAX (-PAGE_SIZE)
131125

132126
#define VDSO_BASE (STACK_TOP + PAGE_SIZE)
133-
#define VDSO_LIMIT (test_thread_flag(TIF_31BIT) ? _REGION3_SIZE : _REGION2_SIZE)
127+
#define VDSO_LIMIT (_REGION2_SIZE)
134128
#define STACK_TOP (VDSO_LIMIT - vdso_size() - PAGE_SIZE)
135129
#define STACK_TOP_MAX (_REGION2_SIZE - vdso_size() - PAGE_SIZE)
136130

arch/s390/include/asm/seccomp.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,5 @@
1919
#define SECCOMP_ARCH_NATIVE AUDIT_ARCH_S390X
2020
#define SECCOMP_ARCH_NATIVE_NR NR_syscalls
2121
#define SECCOMP_ARCH_NATIVE_NAME "s390x"
22-
#ifdef CONFIG_COMPAT
23-
# define SECCOMP_ARCH_COMPAT AUDIT_ARCH_S390
24-
# define SECCOMP_ARCH_COMPAT_NR NR_syscalls
25-
# define SECCOMP_ARCH_COMPAT_NAME "s390"
26-
#endif
2722

2823
#endif /* _ASM_S390_SECCOMP_H */

0 commit comments

Comments
 (0)