From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1944) id D6E403850416; Wed, 12 Oct 2022 14:16:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6E403850416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665584200; bh=btz8eLvP8rfYf4JQvWOCXG9263f0J4saUIKqkd83Wkg=; h=From:To:Subject:Date:From; b=vPFGDRefZcVT+A/CxU1fErB1a4hWJjjN9qm7iti5/LSHOyuULyllH9Pdx5xkFt2eH WfFF1YwIDgPSh7LCHfTUaFq5ymOgfnREXM2iAez6FCjjY+LuipQyNsbvUsqeNbz9i1 Cyqe5w9dUCN4EHUv0Vhlnd5uzr9p4cNk+4P9Drdc= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Szabolcs Nagy To: glibc-cvs@sourceware.org Subject: [glibc/arm/morello/main] cheri: elf: make l_entry a capability X-Act-Checkin: glibc X-Git-Author: Szabolcs Nagy X-Git-Refname: refs/heads/arm/morello/main X-Git-Oldrev: 456f4dd6e5311b020cda926e6da4f3a820516339 X-Git-Newrev: a3085f72f8b450631ca0d9f8fe80482f079295ef Message-Id: <20221012141640.D6E403850416@sourceware.org> Date: Wed, 12 Oct 2022 14:16:40 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a3085f72f8b450631ca0d9f8fe80482f079295ef commit a3085f72f8b450631ca0d9f8fe80482f079295ef Author: Szabolcs Nagy Date: Tue Sep 6 08:40:52 2022 +0100 cheri: elf: make l_entry a capability Previously the entry address was fixed up to be a capability before using it so l_entry could be ElfW(Addr), but the code is simpler and more consistent if l_entry is a capability throughout: The AT_ENTRY auxv entry is specified to be a capability and a number if internal l_entry usage is simpler if it is elfptr_t. Diff: --- elf/rtld.c | 6 +++--- include/link.h | 2 +- sysdeps/generic/ldsodefs.h | 4 ++-- sysdeps/unix/sysv/linux/dl-sysdep.c | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/elf/rtld.c b/elf/rtld.c index f419dcc95c..3a1f32ea7c 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -384,7 +384,7 @@ extern struct rtld_global_ro _rtld_local_ro static void dl_main (const ElfW(Phdr) *phdr, ElfW(Word) phnum, - ElfW(Addr) *user_entry, ElfW(auxv_t) *auxv); + elfptr_t *user_entry, ElfW(auxv_t) *auxv); /* These two variables cannot be moved into .data.rel.ro. */ static struct libname_list _dl_rtld_libname; @@ -453,7 +453,7 @@ static elfptr_t __attribute__ ((noinline)) _dl_start_final (void *arg, struct dl_start_final_info *info) #endif { - ElfW(Addr) start_addr; + elfptr_t start_addr; /* Do not use an initializer for these members because it would intefere with __rtld_static_init. */ @@ -1357,7 +1357,7 @@ _dl_start_args_adjust (int skip_args) static void dl_main (const ElfW(Phdr) *phdr, ElfW(Word) phnum, - ElfW(Addr) *user_entry, + elfptr_t *user_entry, ElfW(auxv_t) *auxv) { struct link_map *main_map; diff --git a/include/link.h b/include/link.h index e70d3b2d75..6dd8e712c4 100644 --- a/include/link.h +++ b/include/link.h @@ -134,7 +134,7 @@ struct link_map ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM]; const ElfW(Phdr) *l_phdr; /* Pointer to program header table in core. */ - ElfW(Addr) l_entry; /* Entry point location. */ + elfptr_t l_entry; /* Entry point location. */ ElfW(Half) l_phnum; /* Number of program header entries. */ ElfW(Half) l_ldnum; /* Number of dynamic segment entries. */ diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 050a3032de..d3fdf9f4e0 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -1131,10 +1131,10 @@ extern void *_dl_sysdep_read_whole_file (const char *file, size_t *sizep, After this, file access calls and getenv must work. This is responsible for setting __libc_enable_secure if we need to be secure (e.g. setuid), and for setting _dl_argc and _dl_argv, and then calling _dl_main. */ -extern ElfW(Addr) _dl_sysdep_start (void **start_argptr, +extern elfptr_t _dl_sysdep_start (void **start_argptr, void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phnum, - ElfW(Addr) *user_entry, + elfptr_t *user_entry, ElfW(auxv_t) *auxv)) attribute_hidden; diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c index 9e15c5bf69..b77d7fbb0e 100644 --- a/sysdeps/unix/sysv/linux/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/dl-sysdep.c @@ -67,7 +67,7 @@ struct dl_main_arguments { const ElfW(Phdr) *phdr; ElfW(Word) phnum; - ElfW(Addr) user_entry; + elfptr_t user_entry; }; /* Separate function, so that dl_main can be called without the large @@ -95,10 +95,10 @@ _dl_sysdep_parse_arguments (void **start_argptr, args->user_entry = auxv_values[AT_ENTRY]; } -ElfW(Addr) +elfptr_t _dl_sysdep_start (void **start_argptr, void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phnum, - ElfW(Addr) *user_entry, ElfW(auxv_t) *auxv)) + elfptr_t *user_entry, ElfW(auxv_t) *auxv)) { __libc_stack_end = DL_STACK_END (start_argptr);