hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/compat_binfmt_elf.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * 32-bit compatibility support for ELF format executables and core dumps.
34 *
45 * Copyright (C) 2007 Red Hat, Inc. All rights reserved.
5
- *
6
- * This copyrighted material is made available to anyone wishing to use,
7
- * modify, copy, or redistribute it subject to the terms and conditions
8
- * of the GNU General Public License v.2.
96 *
107 * Red Hat Author: Roland McGrath.
118 *
....@@ -20,6 +17,8 @@
2017 #include <linux/elfcore-compat.h>
2118 #include <linux/time.h>
2219
20
+#define ELF_COMPAT 1
21
+
2322 /*
2423 * Rename the basic ELF layout types to refer to the 32-bit class of files.
2524 */
....@@ -31,18 +30,20 @@
3130 #undef elf_shdr
3231 #undef elf_note
3332 #undef elf_addr_t
33
+#undef ELF_GNU_PROPERTY_ALIGN
3434 #define elfhdr elf32_hdr
3535 #define elf_phdr elf32_phdr
3636 #define elf_shdr elf32_shdr
3737 #define elf_note elf32_note
3838 #define elf_addr_t Elf32_Addr
39
+#define ELF_GNU_PROPERTY_ALIGN ELF32_GNU_PROPERTY_ALIGN
3940
4041 /*
4142 * Some data types as stored in coredump.
4243 */
4344 #define user_long_t compat_long_t
4445 #define user_siginfo_t compat_siginfo_t
45
-#define copy_siginfo_to_user copy_siginfo_to_user32
46
+#define copy_siginfo_to_external copy_siginfo_to_external32
4647
4748 /*
4849 * The machine-dependent core note format types are defined in elfcore-compat.h,
....@@ -51,8 +52,8 @@
5152 #define elf_prstatus compat_elf_prstatus
5253 #define elf_prpsinfo compat_elf_prpsinfo
5354
54
-#undef ns_to_timeval
55
-#define ns_to_timeval ns_to_compat_timeval
55
+#undef ns_to_kernel_old_timeval
56
+#define ns_to_kernel_old_timeval ns_to_old_timeval32
5657
5758 /*
5859 * To use this file, asm/elf.h must define compat_elf_check_arch.
....@@ -116,6 +117,11 @@
116117 #define arch_setup_additional_pages compat_arch_setup_additional_pages
117118 #endif
118119
120
+#ifdef compat_elf_read_implies_exec
121
+#undef elf_read_implies_exec
122
+#define elf_read_implies_exec compat_elf_read_implies_exec
123
+#endif
124
+
119125 /*
120126 * Rename a few of the symbols that binfmt_elf.c will define.
121127 * These are all local so the names don't really matter, but it