~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/compat_binfmt_elf.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /fs/compat_binfmt_elf.c (Version linux-6.11.5) and /fs/compat_binfmt_elf.c (Version linux-4.17.19)


  1 // SPDX-License-Identifier: GPL-2.0-only       << 
  2 /*                                                  1 /*
  3  * 32-bit compatibility support for ELF format      2  * 32-bit compatibility support for ELF format executables and core dumps.
  4  *                                                  3  *
  5  * Copyright (C) 2007 Red Hat, Inc.  All right      4  * Copyright (C) 2007 Red Hat, Inc.  All rights reserved.
  6  *                                                  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.
                                                   >>   9  *
  7  * Red Hat Author: Roland McGrath.                 10  * Red Hat Author: Roland McGrath.
  8  *                                                 11  *
  9  * This file is used in a 64-bit kernel that w     12  * This file is used in a 64-bit kernel that wants to support 32-bit ELF.
 10  * asm/elf.h is responsible for defining the c     13  * asm/elf.h is responsible for defining the compat_* and COMPAT_* macros
 11  * used below, with definitions appropriate fo     14  * used below, with definitions appropriate for 32-bit ABI compatibility.
 12  *                                                 15  *
 13  * We use macros to rename the ABI types and m     16  * We use macros to rename the ABI types and machine-dependent
 14  * functions used in binfmt_elf.c to compat ve     17  * functions used in binfmt_elf.c to compat versions.
 15  */                                                18  */
 16                                                    19 
 17 #include <linux/elfcore-compat.h>                  20 #include <linux/elfcore-compat.h>
 18 #include <linux/time.h>                            21 #include <linux/time.h>
 19                                                    22 
 20 #define ELF_COMPAT      1                      << 
 21                                                << 
 22 /*                                                 23 /*
 23  * Rename the basic ELF layout types to refer      24  * Rename the basic ELF layout types to refer to the 32-bit class of files.
 24  */                                                25  */
 25 #undef  ELF_CLASS                                  26 #undef  ELF_CLASS
 26 #define ELF_CLASS       ELFCLASS32                 27 #define ELF_CLASS       ELFCLASS32
 27                                                    28 
 28 #undef  elfhdr                                     29 #undef  elfhdr
 29 #undef  elf_phdr                                   30 #undef  elf_phdr
 30 #undef  elf_shdr                                   31 #undef  elf_shdr
 31 #undef  elf_note                                   32 #undef  elf_note
 32 #undef  elf_addr_t                                 33 #undef  elf_addr_t
 33 #undef  ELF_GNU_PROPERTY_ALIGN                 << 
 34 #define elfhdr          elf32_hdr                  34 #define elfhdr          elf32_hdr
 35 #define elf_phdr        elf32_phdr                 35 #define elf_phdr        elf32_phdr
 36 #define elf_shdr        elf32_shdr                 36 #define elf_shdr        elf32_shdr
 37 #define elf_note        elf32_note                 37 #define elf_note        elf32_note
 38 #define elf_addr_t      Elf32_Addr                 38 #define elf_addr_t      Elf32_Addr
 39 #define ELF_GNU_PROPERTY_ALIGN  ELF32_GNU_PROP << 
 40                                                    39 
 41 /*                                                 40 /*
 42  * Some data types as stored in coredump.          41  * Some data types as stored in coredump.
 43  */                                                42  */
 44 #define user_long_t             compat_long_t      43 #define user_long_t             compat_long_t
 45 #define user_siginfo_t          compat_siginfo     44 #define user_siginfo_t          compat_siginfo_t
 46 #define copy_siginfo_to_external        copy_s !!  45 #define copy_siginfo_to_user    copy_siginfo_to_user32
 47                                                    46 
 48 /*                                                 47 /*
 49  * The machine-dependent core note format type     48  * The machine-dependent core note format types are defined in elfcore-compat.h,
 50  * which requires asm/elf.h to define compat_e     49  * which requires asm/elf.h to define compat_elf_gregset_t et al.
 51  */                                                50  */
 52 #define elf_prstatus    compat_elf_prstatus        51 #define elf_prstatus    compat_elf_prstatus
 53 #define elf_prstatus_common     compat_elf_prs << 
 54 #define elf_prpsinfo    compat_elf_prpsinfo        52 #define elf_prpsinfo    compat_elf_prpsinfo
 55                                                    53 
 56 #undef ns_to_kernel_old_timeval                !!  54 #undef ns_to_timeval
 57 #define ns_to_kernel_old_timeval ns_to_old_tim !!  55 #define ns_to_timeval ns_to_compat_timeval
 58                                                    56 
 59 /*                                                 57 /*
 60  * To use this file, asm/elf.h must define com     58  * To use this file, asm/elf.h must define compat_elf_check_arch.
 61  * The other following macros can be defined i     59  * The other following macros can be defined if the compat versions
 62  * differ from the native ones, or omitted whe     60  * differ from the native ones, or omitted when they match.
 63  */                                                61  */
 64                                                    62 
                                                   >>  63 #undef  ELF_ARCH
 65 #undef  elf_check_arch                             64 #undef  elf_check_arch
 66 #define elf_check_arch  compat_elf_check_arch      65 #define elf_check_arch  compat_elf_check_arch
 67                                                    66 
 68 #ifdef  COMPAT_ELF_PLATFORM                        67 #ifdef  COMPAT_ELF_PLATFORM
 69 #undef  ELF_PLATFORM                               68 #undef  ELF_PLATFORM
 70 #define ELF_PLATFORM            COMPAT_ELF_PLA     69 #define ELF_PLATFORM            COMPAT_ELF_PLATFORM
 71 #endif                                             70 #endif
 72                                                    71 
 73 #ifdef  COMPAT_ELF_HWCAP                           72 #ifdef  COMPAT_ELF_HWCAP
 74 #undef  ELF_HWCAP                                  73 #undef  ELF_HWCAP
 75 #define ELF_HWCAP               COMPAT_ELF_HWC     74 #define ELF_HWCAP               COMPAT_ELF_HWCAP
 76 #endif                                             75 #endif
 77                                                    76 
 78 #ifdef  COMPAT_ELF_HWCAP2                          77 #ifdef  COMPAT_ELF_HWCAP2
 79 #undef  ELF_HWCAP2                                 78 #undef  ELF_HWCAP2
 80 #define ELF_HWCAP2              COMPAT_ELF_HWC     79 #define ELF_HWCAP2              COMPAT_ELF_HWCAP2
 81 #endif                                             80 #endif
 82                                                    81 
 83 #ifdef  COMPAT_ARCH_DLINFO                         82 #ifdef  COMPAT_ARCH_DLINFO
 84 #undef  ARCH_DLINFO                                83 #undef  ARCH_DLINFO
 85 #define ARCH_DLINFO             COMPAT_ARCH_DL     84 #define ARCH_DLINFO             COMPAT_ARCH_DLINFO
 86 #endif                                             85 #endif
 87                                                    86 
 88 #ifdef  COMPAT_ELF_ET_DYN_BASE                     87 #ifdef  COMPAT_ELF_ET_DYN_BASE
 89 #undef  ELF_ET_DYN_BASE                            88 #undef  ELF_ET_DYN_BASE
 90 #define ELF_ET_DYN_BASE         COMPAT_ELF_ET_     89 #define ELF_ET_DYN_BASE         COMPAT_ELF_ET_DYN_BASE
 91 #endif                                             90 #endif
 92                                                    91 
                                                   >>  92 #ifdef COMPAT_ELF_EXEC_PAGESIZE
                                                   >>  93 #undef  ELF_EXEC_PAGESIZE
                                                   >>  94 #define ELF_EXEC_PAGESIZE       COMPAT_ELF_EXEC_PAGESIZE
                                                   >>  95 #endif
                                                   >>  96 
 93 #ifdef  COMPAT_ELF_PLAT_INIT                       97 #ifdef  COMPAT_ELF_PLAT_INIT
 94 #undef  ELF_PLAT_INIT                              98 #undef  ELF_PLAT_INIT
 95 #define ELF_PLAT_INIT           COMPAT_ELF_PLA     99 #define ELF_PLAT_INIT           COMPAT_ELF_PLAT_INIT
 96 #endif                                            100 #endif
 97                                                   101 
 98 #ifdef  COMPAT_SET_PERSONALITY                    102 #ifdef  COMPAT_SET_PERSONALITY
 99 #undef  SET_PERSONALITY                           103 #undef  SET_PERSONALITY
100 #define SET_PERSONALITY         COMPAT_SET_PER    104 #define SET_PERSONALITY         COMPAT_SET_PERSONALITY
101 #endif                                            105 #endif
102                                                   106 
103 #ifdef  compat_start_thread                       107 #ifdef  compat_start_thread
104 #define COMPAT_START_THREAD(ex, regs, new_ip,  !! 108 #undef  start_thread
105         compat_start_thread(regs, new_ip, new_ !! 109 #define start_thread            compat_start_thread
106 #endif                                         << 
107                                                << 
108 #ifdef  COMPAT_START_THREAD                    << 
109 #undef  START_THREAD                           << 
110 #define START_THREAD            COMPAT_START_T << 
111 #endif                                         << 
112                                                << 
113 #ifdef compat_arch_setup_additional_pages      << 
114 #define COMPAT_ARCH_SETUP_ADDITIONAL_PAGES(bpr << 
115         compat_arch_setup_additional_pages(bpr << 
116 #endif                                            110 #endif
117                                                   111 
118 #ifdef  COMPAT_ARCH_SETUP_ADDITIONAL_PAGES     !! 112 #ifdef  compat_arch_setup_additional_pages
119 #undef  ARCH_HAS_SETUP_ADDITIONAL_PAGES           113 #undef  ARCH_HAS_SETUP_ADDITIONAL_PAGES
120 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1         114 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
121 #undef  ARCH_SETUP_ADDITIONAL_PAGES            !! 115 #undef  arch_setup_additional_pages
122 #define ARCH_SETUP_ADDITIONAL_PAGES COMPAT_ARC !! 116 #define arch_setup_additional_pages compat_arch_setup_additional_pages
123 #endif                                         << 
124                                                << 
125 #ifdef  compat_elf_read_implies_exec           << 
126 #undef  elf_read_implies_exec                  << 
127 #define elf_read_implies_exec compat_elf_read_ << 
128 #endif                                            117 #endif
129                                                   118 
130 /*                                                119 /*
131  * Rename a few of the symbols that binfmt_elf    120  * Rename a few of the symbols that binfmt_elf.c will define.
132  * These are all local so the names don't real    121  * These are all local so the names don't really matter, but it
133  * might make some debugging less confusing no    122  * might make some debugging less confusing not to duplicate them.
134  */                                               123  */
135 #define elf_format              compat_elf_for    124 #define elf_format              compat_elf_format
136 #define init_elf_binfmt         init_compat_el    125 #define init_elf_binfmt         init_compat_elf_binfmt
137 #define exit_elf_binfmt         exit_compat_el    126 #define exit_elf_binfmt         exit_compat_elf_binfmt
138 #define binfmt_elf_test_cases   compat_binfmt_ << 
139 #define binfmt_elf_test_suite   compat_binfmt_ << 
140                                                   127 
141 /*                                                128 /*
142  * We share all the actual code with the nativ    129  * We share all the actual code with the native (64-bit) version.
143  */                                               130  */
144 #include "binfmt_elf.c"                           131 #include "binfmt_elf.c"
145                                                   132 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php