This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] [ELF] Allow the machine to override stack permissions via USE_DL_EXEC_STACK_OVERRIDE.


On Thu, 27 Jun 2019, Dragan Mladjenovic wrote:

> diff --git a/elf/dl-load.c b/elf/dl-load.c
> index 5abeb86..9155b74 100644
> --- a/elf/dl-load.c
> +++ b/elf/dl-load.c
> @@ -1242,6 +1242,16 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
>      /* Adjust the PT_PHDR value by the runtime load address.  */
>      l->l_phdr = (ElfW(Phdr) *) ((ElfW(Addr)) l->l_phdr + l->l_addr);
>  
> +#ifdef USE_DL_EXEC_STACK_OVERRIDE
> +  /* Program requests a non-executable stack, but architecture does
> +     not support it.  */
> +  if (__glibc_unlikely (_dl_exec_stack_override (&stack_flags) != 0))
> +    {
> +      errstring = N_("cannot override stack memory protections");
> +      goto call_lose_errno;
> +    }
> +#endif

This sort of #ifdef is not proper glibc style.  You should have a default 
trivial (inline?) definition of _dl_exec_stack_override and then have MIPS 
override the file with that function definition (without duplicating any 
architecture-independent code in the process).  If you have a default 
inline function definition, that means all this code gets checked for 
syntax when building for any architecture, not just for MIPS.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]