Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

a.out: Remove the a.out implementation

In commit 19e8b701e258 ("a.out: Stop building a.out/osf1 support on
alpha and m68k") the last users of a.out were disabled.

As nothing has turned up to cause this change to be reverted, let's
remove the code implementing a.out support as well.

There may be userspace users of the uapi bits left so the uapi
headers have been left untouched.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Arnd Bergmann <arnd@arndb.de> # arm defconfigs
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/871qrx3hq3.fsf@email.froward.int.ebiederm.org

authored by

Eric W. Biederman and committed by
Kees Cook
987f20a9 33a2d6bc

+1 -505
-1
MAINTAINERS
··· 7685 7685 L: linux-mm@kvack.org 7686 7686 S: Supported 7687 7687 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/execve 7688 - F: arch/alpha/kernel/binfmt_loader.c 7689 7688 F: fs/*binfmt_*.c 7690 7689 F: fs/exec.c 7691 7690 F: include/linux/binfmts.h
-16
arch/alpha/include/asm/a.out.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __ALPHA_A_OUT_H__ 3 - #define __ALPHA_A_OUT_H__ 4 - 5 - #include <uapi/asm/a.out.h> 6 - 7 - 8 - /* Assume that start addresses below 4G belong to a TASO application. 9 - Unfortunately, there is no proper bit in the exec header to check. 10 - Worse, we have to notice the start address before swapping to use 11 - /sbin/loader, which of course is _not_ a TASO application. */ 12 - #define SET_AOUT_PERSONALITY(BFPM, EX) \ 13 - set_personality (((BFPM->taso || EX.ah.entry < 0x100000000L \ 14 - ? ADDR_LIMIT_32BIT : 0) | PER_OSF4)) 15 - 16 - #endif /* __A_OUT_GNU_H__ */
-4
arch/alpha/kernel/Makefile
··· 47 47 # Misc support 48 48 obj-$(CONFIG_ALPHA_SRM) += srmcons.o 49 49 50 - ifdef CONFIG_BINFMT_AOUT 51 - obj-y += binfmt_loader.o 52 - endif 53 - 54 50 # Core logic support 55 51 obj-$(CONFIG_ALPHA_APECS) += core_apecs.o 56 52 obj-$(CONFIG_ALPHA_CIA) += core_cia.o
-46
arch/alpha/kernel/binfmt_loader.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #include <linux/init.h> 3 - #include <linux/fs.h> 4 - #include <linux/file.h> 5 - #include <linux/mm_types.h> 6 - #include <linux/binfmts.h> 7 - #include <linux/a.out.h> 8 - 9 - static int load_binary(struct linux_binprm *bprm) 10 - { 11 - struct exec *eh = (struct exec *)bprm->buf; 12 - unsigned long loader; 13 - struct file *file; 14 - int retval; 15 - 16 - if (eh->fh.f_magic != 0x183 || (eh->fh.f_flags & 0x3000) != 0x3000) 17 - return -ENOEXEC; 18 - 19 - if (bprm->loader) 20 - return -ENOEXEC; 21 - 22 - loader = bprm->vma->vm_end - sizeof(void *); 23 - 24 - file = open_exec("/sbin/loader"); 25 - retval = PTR_ERR(file); 26 - if (IS_ERR(file)) 27 - return retval; 28 - 29 - /* Remember if the application is TASO. */ 30 - bprm->taso = eh->ah.entry < 0x100000000UL; 31 - 32 - bprm->interpreter = file; 33 - bprm->loader = loader; 34 - return 0; 35 - } 36 - 37 - static struct linux_binfmt loader_format = { 38 - .load_binary = load_binary, 39 - }; 40 - 41 - static int __init init_loader_binfmt(void) 42 - { 43 - insert_binfmt(&loader_format); 44 - return 0; 45 - } 46 - arch_initcall(init_loader_binfmt);
-30
arch/alpha/kernel/osf_sys.c
··· 1278 1278 return addr; 1279 1279 } 1280 1280 1281 - #ifdef CONFIG_OSF4_COMPAT 1282 - /* Clear top 32 bits of iov_len in the user's buffer for 1283 - compatibility with old versions of OSF/1 where iov_len 1284 - was defined as int. */ 1285 - static int 1286 - osf_fix_iov_len(const struct iovec __user *iov, unsigned long count) 1287 - { 1288 - unsigned long i; 1289 - 1290 - for (i = 0 ; i < count ; i++) { 1291 - int __user *iov_len_high = (int __user *)&iov[i].iov_len + 1; 1292 - 1293 - if (put_user(0, iov_len_high)) 1294 - return -EFAULT; 1295 - } 1296 - return 0; 1297 - } 1298 - #endif 1299 - 1300 1281 SYSCALL_DEFINE3(osf_readv, unsigned long, fd, 1301 1282 const struct iovec __user *, vector, unsigned long, count) 1302 1283 { 1303 - #ifdef CONFIG_OSF4_COMPAT 1304 - if (unlikely(personality(current->personality) == PER_OSF4)) 1305 - if (osf_fix_iov_len(vector, count)) 1306 - return -EFAULT; 1307 - #endif 1308 - 1309 1284 return sys_readv(fd, vector, count); 1310 1285 } 1311 1286 1312 1287 SYSCALL_DEFINE3(osf_writev, unsigned long, fd, 1313 1288 const struct iovec __user *, vector, unsigned long, count) 1314 1289 { 1315 - #ifdef CONFIG_OSF4_COMPAT 1316 - if (unlikely(personality(current->personality) == PER_OSF4)) 1317 - if (osf_fix_iov_len(vector, count)) 1318 - return -EFAULT; 1319 - #endif 1320 1290 return sys_writev(fd, vector, count); 1321 1291 } 1322 1292
-1
arch/arm/configs/badge4_defconfig
··· 6 6 CONFIG_CMDLINE="init=/linuxrc root=/dev/mtdblock3" 7 7 CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 8 8 CONFIG_FPE_NWFPE=y 9 - CONFIG_BINFMT_AOUT=m 10 9 CONFIG_MODULES=y 11 10 CONFIG_MODVERSIONS=y 12 11 CONFIG_PARTITION_ADVANCED=y
-1
arch/arm/configs/corgi_defconfig
··· 16 16 CONFIG_UNUSED_BOARD_FILES=y 17 17 CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug" 18 18 CONFIG_FPE_NWFPE=y 19 - CONFIG_BINFMT_AOUT=m 20 19 CONFIG_MODULES=y 21 20 CONFIG_MODULE_UNLOAD=y 22 21 CONFIG_MODULE_FORCE_UNLOAD=y
-1
arch/arm/configs/ezx_defconfig
··· 25 25 CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m 26 26 CONFIG_CPU_IDLE=y 27 27 CONFIG_FPE_NWFPE=y 28 - CONFIG_BINFMT_AOUT=m 29 28 CONFIG_PM=y 30 29 CONFIG_APM_EMULATION=y 31 30 CONFIG_MODULES=y
-1
arch/arm/configs/footbridge_defconfig
··· 9 9 CONFIG_ARCH_NETWINDER=y 10 10 CONFIG_FPE_NWFPE=y 11 11 CONFIG_FPE_NWFPE_XP=y 12 - CONFIG_BINFMT_AOUT=y 13 12 CONFIG_MODULES=y 14 13 CONFIG_PARTITION_ADVANCED=y 15 14 CONFIG_ACORN_PARTITION=y
-1
arch/arm/configs/hackkit_defconfig
··· 7 7 CONFIG_CMDLINE="console=ttySA0,115200 root=/dev/ram0 initrd=0xc0400000,8M init=/rootshell" 8 8 CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 9 9 CONFIG_FPE_NWFPE=y 10 - CONFIG_BINFMT_AOUT=y 11 10 CONFIG_MODULES=y 12 11 CONFIG_NET=y 13 12 CONFIG_PACKET=y
-1
arch/arm/configs/iop32x_defconfig
··· 12 12 CONFIG_UNUSED_BOARD_FILES=y 13 13 CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp cachepolicy=writealloc" 14 14 CONFIG_FPE_NWFPE=y 15 - CONFIG_BINFMT_AOUT=y 16 15 CONFIG_MODULES=y 17 16 CONFIG_MODULE_UNLOAD=y 18 17 CONFIG_PARTITION_ADVANCED=y
-1
arch/arm/configs/jornada720_defconfig
··· 6 6 CONFIG_SA1100_JORNADA720_SSP=y 7 7 CONFIG_UNUSED_BOARD_FILES=y 8 8 CONFIG_FPE_NWFPE=y 9 - CONFIG_BINFMT_AOUT=y 10 9 CONFIG_PM=y 11 10 CONFIG_MODULES=y 12 11 CONFIG_NET=y
-1
arch/arm/configs/lart_defconfig
··· 8 8 CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 9 9 CONFIG_CPU_FREQ_GOV_USERSPACE=y 10 10 CONFIG_FPE_NWFPE=y 11 - CONFIG_BINFMT_AOUT=y 12 11 CONFIG_PM=y 13 12 CONFIG_MODULES=y 14 13 CONFIG_NET=y
-1
arch/arm/configs/neponset_defconfig
··· 9 9 CONFIG_ZBOOT_ROM=y 10 10 CONFIG_CMDLINE="console=ttySA0,38400n8 cpufreq=221200 rw root=/dev/mtdblock2 mtdparts=sa1100:512K(boot),1M(kernel),2560K(initrd),4M(root) load_ramdisk=1 prompt_ramdisk=0 mem=32M noinitrd initrd=0xc0800000,3M" 11 11 CONFIG_FPE_NWFPE=y 12 - CONFIG_BINFMT_AOUT=y 13 12 CONFIG_PM=y 14 13 CONFIG_MODULES=y 15 14 CONFIG_MODULE_UNLOAD=y
-1
arch/arm/configs/netwinder_defconfig
··· 5 5 CONFIG_DEPRECATED_PARAM_STRUCT=y 6 6 CONFIG_CMDLINE="root=0x801" 7 7 CONFIG_FPE_NWFPE=y 8 - CONFIG_BINFMT_AOUT=y 9 8 CONFIG_PARTITION_ADVANCED=y 10 9 CONFIG_NET=y 11 10 CONFIG_PACKET=y
-1
arch/arm/configs/rpc_defconfig
··· 7 7 CONFIG_ARCH_RPC=y 8 8 CONFIG_CPU_SA110=y 9 9 CONFIG_FPE_NWFPE=y 10 - CONFIG_BINFMT_AOUT=y 11 10 CONFIG_PARTITION_ADVANCED=y 12 11 CONFIG_BSD_DISKLABEL=y 13 12 CONFIG_SLAB=y
-1
arch/arm/configs/spitz_defconfig
··· 13 13 CONFIG_MACH_BORZOI=y 14 14 CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug" 15 15 CONFIG_FPE_NWFPE=y 16 - CONFIG_BINFMT_AOUT=m 17 16 CONFIG_MODULES=y 18 17 CONFIG_MODULE_UNLOAD=y 19 18 CONFIG_MODULE_FORCE_UNLOAD=y
-33
fs/Kconfig.binfmt
··· 142 142 help 143 143 Support FLAT format compressed binaries 144 144 145 - config HAVE_AOUT 146 - def_bool n 147 - 148 - config BINFMT_AOUT 149 - tristate "Kernel support for a.out and ECOFF binaries" 150 - depends on HAVE_AOUT 151 - help 152 - A.out (Assembler.OUTput) is a set of formats for libraries and 153 - executables used in the earliest versions of UNIX. Linux used 154 - the a.out formats QMAGIC and ZMAGIC until they were replaced 155 - with the ELF format. 156 - 157 - The conversion to ELF started in 1995. This option is primarily 158 - provided for historical interest and for the benefit of those 159 - who need to run binaries from that era. 160 - 161 - Most people should answer N here. If you think you may have 162 - occasional use for this format, enable module support above 163 - and answer M here to compile this support as a module called 164 - binfmt_aout. 165 - 166 - If any crucial components of your system (such as /sbin/init 167 - or /lib/ld.so) are still in a.out format, you will have to 168 - say Y here. 169 - 170 - config OSF4_COMPAT 171 - bool "OSF/1 v4 readv/writev compatibility" 172 - depends on ALPHA && BINFMT_AOUT 173 - help 174 - Say Y if you are using OSF/1 binaries (like Netscape and Acrobat) 175 - with v4 shared libraries freely available from Compaq. If you're 176 - going to use shared libraries from Tru64 version 5.0 or later, say N. 177 - 178 145 config BINFMT_MISC 179 146 tristate "Kernel support for MISC binaries" 180 147 help
-1
fs/Makefile
··· 38 38 obj-$(CONFIG_FS_ENCRYPTION) += crypto/ 39 39 obj-$(CONFIG_FS_VERITY) += verity/ 40 40 obj-$(CONFIG_FILE_LOCKING) += locks.o 41 - obj-$(CONFIG_BINFMT_AOUT) += binfmt_aout.o 42 41 obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o 43 42 obj-$(CONFIG_BINFMT_SCRIPT) += binfmt_script.o 44 43 obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o
-342
fs/binfmt_aout.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * linux/fs/binfmt_aout.c 4 - * 5 - * Copyright (C) 1991, 1992, 1996 Linus Torvalds 6 - */ 7 - 8 - #include <linux/module.h> 9 - 10 - #include <linux/time.h> 11 - #include <linux/kernel.h> 12 - #include <linux/mm.h> 13 - #include <linux/mman.h> 14 - #include <linux/a.out.h> 15 - #include <linux/errno.h> 16 - #include <linux/signal.h> 17 - #include <linux/string.h> 18 - #include <linux/fs.h> 19 - #include <linux/file.h> 20 - #include <linux/stat.h> 21 - #include <linux/fcntl.h> 22 - #include <linux/ptrace.h> 23 - #include <linux/user.h> 24 - #include <linux/binfmts.h> 25 - #include <linux/personality.h> 26 - #include <linux/init.h> 27 - #include <linux/coredump.h> 28 - #include <linux/slab.h> 29 - #include <linux/sched/task_stack.h> 30 - 31 - #include <linux/uaccess.h> 32 - #include <asm/cacheflush.h> 33 - 34 - static int load_aout_binary(struct linux_binprm *); 35 - static int load_aout_library(struct file*); 36 - 37 - static struct linux_binfmt aout_format = { 38 - .module = THIS_MODULE, 39 - .load_binary = load_aout_binary, 40 - .load_shlib = load_aout_library, 41 - }; 42 - 43 - #define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE) 44 - 45 - static int set_brk(unsigned long start, unsigned long end) 46 - { 47 - start = PAGE_ALIGN(start); 48 - end = PAGE_ALIGN(end); 49 - if (end > start) 50 - return vm_brk(start, end - start); 51 - return 0; 52 - } 53 - 54 - /* 55 - * create_aout_tables() parses the env- and arg-strings in new user 56 - * memory and creates the pointer tables from them, and puts their 57 - * addresses on the "stack", returning the new stack pointer value. 58 - */ 59 - static unsigned long __user *create_aout_tables(char __user *p, struct linux_binprm * bprm) 60 - { 61 - char __user * __user *argv; 62 - char __user * __user *envp; 63 - unsigned long __user *sp; 64 - int argc = bprm->argc; 65 - int envc = bprm->envc; 66 - 67 - sp = (void __user *)((-(unsigned long)sizeof(char *)) & (unsigned long) p); 68 - #ifdef __alpha__ 69 - /* whee.. test-programs are so much fun. */ 70 - put_user(0, --sp); 71 - put_user(0, --sp); 72 - if (bprm->loader) { 73 - put_user(0, --sp); 74 - put_user(1003, --sp); 75 - put_user(bprm->loader, --sp); 76 - put_user(1002, --sp); 77 - } 78 - put_user(bprm->exec, --sp); 79 - put_user(1001, --sp); 80 - #endif 81 - sp -= envc+1; 82 - envp = (char __user * __user *) sp; 83 - sp -= argc+1; 84 - argv = (char __user * __user *) sp; 85 - #ifndef __alpha__ 86 - put_user((unsigned long) envp,--sp); 87 - put_user((unsigned long) argv,--sp); 88 - #endif 89 - put_user(argc,--sp); 90 - current->mm->arg_start = (unsigned long) p; 91 - while (argc-->0) { 92 - char c; 93 - put_user(p,argv++); 94 - do { 95 - get_user(c,p++); 96 - } while (c); 97 - } 98 - put_user(NULL,argv); 99 - current->mm->arg_end = current->mm->env_start = (unsigned long) p; 100 - while (envc-->0) { 101 - char c; 102 - put_user(p,envp++); 103 - do { 104 - get_user(c,p++); 105 - } while (c); 106 - } 107 - put_user(NULL,envp); 108 - current->mm->env_end = (unsigned long) p; 109 - return sp; 110 - } 111 - 112 - /* 113 - * These are the functions used to load a.out style executables and shared 114 - * libraries. There is no binary dependent code anywhere else. 115 - */ 116 - 117 - static int load_aout_binary(struct linux_binprm * bprm) 118 - { 119 - struct pt_regs *regs = current_pt_regs(); 120 - struct exec ex; 121 - unsigned long error; 122 - unsigned long fd_offset; 123 - unsigned long rlim; 124 - int retval; 125 - 126 - ex = *((struct exec *) bprm->buf); /* exec-header */ 127 - if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC && 128 - N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) || 129 - N_TRSIZE(ex) || N_DRSIZE(ex) || 130 - i_size_read(file_inode(bprm->file)) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { 131 - return -ENOEXEC; 132 - } 133 - 134 - /* 135 - * Requires a mmap handler. This prevents people from using a.out 136 - * as part of an exploit attack against /proc-related vulnerabilities. 137 - */ 138 - if (!bprm->file->f_op->mmap) 139 - return -ENOEXEC; 140 - 141 - fd_offset = N_TXTOFF(ex); 142 - 143 - /* Check initial limits. This avoids letting people circumvent 144 - * size limits imposed on them by creating programs with large 145 - * arrays in the data or bss. 146 - */ 147 - rlim = rlimit(RLIMIT_DATA); 148 - if (rlim >= RLIM_INFINITY) 149 - rlim = ~0; 150 - if (ex.a_data + ex.a_bss > rlim) 151 - return -ENOMEM; 152 - 153 - /* Flush all traces of the currently running executable */ 154 - retval = begin_new_exec(bprm); 155 - if (retval) 156 - return retval; 157 - 158 - /* OK, This is the point of no return */ 159 - #ifdef __alpha__ 160 - SET_AOUT_PERSONALITY(bprm, ex); 161 - #else 162 - set_personality(PER_LINUX); 163 - #endif 164 - setup_new_exec(bprm); 165 - 166 - current->mm->end_code = ex.a_text + 167 - (current->mm->start_code = N_TXTADDR(ex)); 168 - current->mm->end_data = ex.a_data + 169 - (current->mm->start_data = N_DATADDR(ex)); 170 - current->mm->brk = ex.a_bss + 171 - (current->mm->start_brk = N_BSSADDR(ex)); 172 - 173 - retval = setup_arg_pages(bprm, STACK_TOP, EXSTACK_DEFAULT); 174 - if (retval < 0) 175 - return retval; 176 - 177 - 178 - if (N_MAGIC(ex) == OMAGIC) { 179 - unsigned long text_addr, map_size; 180 - loff_t pos; 181 - 182 - text_addr = N_TXTADDR(ex); 183 - 184 - #ifdef __alpha__ 185 - pos = fd_offset; 186 - map_size = ex.a_text+ex.a_data + PAGE_SIZE - 1; 187 - #else 188 - pos = 32; 189 - map_size = ex.a_text+ex.a_data; 190 - #endif 191 - error = vm_brk(text_addr & PAGE_MASK, map_size); 192 - if (error) 193 - return error; 194 - 195 - error = read_code(bprm->file, text_addr, pos, 196 - ex.a_text+ex.a_data); 197 - if ((signed long)error < 0) 198 - return error; 199 - } else { 200 - if ((ex.a_text & 0xfff || ex.a_data & 0xfff) && 201 - (N_MAGIC(ex) != NMAGIC) && printk_ratelimit()) 202 - { 203 - printk(KERN_NOTICE "executable not page aligned\n"); 204 - } 205 - 206 - if ((fd_offset & ~PAGE_MASK) != 0 && printk_ratelimit()) 207 - { 208 - printk(KERN_WARNING 209 - "fd_offset is not page aligned. Please convert program: %pD\n", 210 - bprm->file); 211 - } 212 - 213 - if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) { 214 - error = vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); 215 - if (error) 216 - return error; 217 - 218 - read_code(bprm->file, N_TXTADDR(ex), fd_offset, 219 - ex.a_text + ex.a_data); 220 - goto beyond_if; 221 - } 222 - 223 - error = vm_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, 224 - PROT_READ | PROT_EXEC, MAP_FIXED | MAP_PRIVATE, 225 - fd_offset); 226 - 227 - if (error != N_TXTADDR(ex)) 228 - return error; 229 - 230 - error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data, 231 - PROT_READ | PROT_WRITE | PROT_EXEC, 232 - MAP_FIXED | MAP_PRIVATE, 233 - fd_offset + ex.a_text); 234 - if (error != N_DATADDR(ex)) 235 - return error; 236 - } 237 - beyond_if: 238 - set_binfmt(&aout_format); 239 - 240 - retval = set_brk(current->mm->start_brk, current->mm->brk); 241 - if (retval < 0) 242 - return retval; 243 - 244 - current->mm->start_stack = 245 - (unsigned long) create_aout_tables((char __user *) bprm->p, bprm); 246 - #ifdef __alpha__ 247 - regs->gp = ex.a_gpvalue; 248 - #endif 249 - finalize_exec(bprm); 250 - start_thread(regs, ex.a_entry, current->mm->start_stack); 251 - return 0; 252 - } 253 - 254 - static int load_aout_library(struct file *file) 255 - { 256 - struct inode * inode; 257 - unsigned long bss, start_addr, len; 258 - unsigned long error; 259 - int retval; 260 - struct exec ex; 261 - loff_t pos = 0; 262 - 263 - inode = file_inode(file); 264 - 265 - retval = -ENOEXEC; 266 - error = kernel_read(file, &ex, sizeof(ex), &pos); 267 - if (error != sizeof(ex)) 268 - goto out; 269 - 270 - /* We come in here for the regular a.out style of shared libraries */ 271 - if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != QMAGIC) || N_TRSIZE(ex) || 272 - N_DRSIZE(ex) || ((ex.a_entry & 0xfff) && N_MAGIC(ex) == ZMAGIC) || 273 - i_size_read(inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { 274 - goto out; 275 - } 276 - 277 - /* 278 - * Requires a mmap handler. This prevents people from using a.out 279 - * as part of an exploit attack against /proc-related vulnerabilities. 280 - */ 281 - if (!file->f_op->mmap) 282 - goto out; 283 - 284 - if (N_FLAGS(ex)) 285 - goto out; 286 - 287 - /* For QMAGIC, the starting address is 0x20 into the page. We mask 288 - this off to get the starting address for the page */ 289 - 290 - start_addr = ex.a_entry & 0xfffff000; 291 - 292 - if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) { 293 - if (printk_ratelimit()) 294 - { 295 - printk(KERN_WARNING 296 - "N_TXTOFF is not page aligned. Please convert library: %pD\n", 297 - file); 298 - } 299 - retval = vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); 300 - if (retval) 301 - goto out; 302 - 303 - read_code(file, start_addr, N_TXTOFF(ex), 304 - ex.a_text + ex.a_data); 305 - retval = 0; 306 - goto out; 307 - } 308 - /* Now use mmap to map the library into memory. */ 309 - error = vm_mmap(file, start_addr, ex.a_text + ex.a_data, 310 - PROT_READ | PROT_WRITE | PROT_EXEC, 311 - MAP_FIXED | MAP_PRIVATE, 312 - N_TXTOFF(ex)); 313 - retval = error; 314 - if (error != start_addr) 315 - goto out; 316 - 317 - len = PAGE_ALIGN(ex.a_text + ex.a_data); 318 - bss = ex.a_text + ex.a_data + ex.a_bss; 319 - if (bss > len) { 320 - retval = vm_brk(start_addr + len, bss - len); 321 - if (retval) 322 - goto out; 323 - } 324 - retval = 0; 325 - out: 326 - return retval; 327 - } 328 - 329 - static int __init init_aout_binfmt(void) 330 - { 331 - register_binfmt(&aout_format); 332 - return 0; 333 - } 334 - 335 - static void __exit exit_aout_binfmt(void) 336 - { 337 - unregister_binfmt(&aout_format); 338 - } 339 - 340 - core_initcall(init_aout_binfmt); 341 - module_exit(exit_aout_binfmt); 342 - MODULE_LICENSE("GPL");
+1 -2
fs/exec.c
··· 957 957 } 958 958 EXPORT_SYMBOL(open_exec); 959 959 960 - #if defined(CONFIG_HAVE_AOUT) || defined(CONFIG_BINFMT_FLAT) || \ 961 - defined(CONFIG_BINFMT_ELF_FDPIC) 960 + #if defined(CONFIG_BINFMT_FLAT) || defined(CONFIG_BINFMT_ELF_FDPIC) 962 961 ssize_t read_code(struct file *file, unsigned long addr, loff_t pos, size_t len) 963 962 { 964 963 ssize_t res = vfs_read(file, (void __user *)addr, len, &pos);
-18
include/linux/a.out.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __A_OUT_GNU_H__ 3 - #define __A_OUT_GNU_H__ 4 - 5 - #include <uapi/linux/a.out.h> 6 - 7 - #ifndef __ASSEMBLY__ 8 - #ifdef linux 9 - #include <asm/page.h> 10 - #if defined(__i386__) || defined(__mc68000__) 11 - #else 12 - #ifndef SEGMENT_SIZE 13 - #define SEGMENT_SIZE PAGE_SIZE 14 - #endif 15 - #endif 16 - #endif 17 - #endif /*__ASSEMBLY__ */ 18 - #endif /* __A_OUT_GNU_H__ */