Re: [PATCH v2] binfmt_elf: Update READ_IMPLIES_EXEC logic for modern CPUs

From: Kees Cook
Date: Wed Apr 24 2019 - 16:54:41 EST


On Wed, Apr 24, 2019 at 1:51 PM Will Deacon <will.deacon@xxxxxxx> wrote:
> Don't you need to hack fs/compat_binfmt_elf.c to pick this up, or am I
> missing some trick? Should just be something like below.
>
> Will
>
> --->8
>
> diff --git a/fs/compat_binfmt_elf.c b/fs/compat_binfmt_elf.c
> index 15f6e96b3bd9..694bc3ee77eb 100644
> --- a/fs/compat_binfmt_elf.c
> +++ b/fs/compat_binfmt_elf.c
> @@ -116,6 +116,11 @@
> #define arch_setup_additional_pages compat_arch_setup_additional_pages
> #endif
>
> +#ifdef compat_elf_read_implies_exec
> +#undef elf_read_implies_exec
> +#define elf_read_implies_exec compat_elf_read_implies_exec
> +#endif
> +
> /*
> * Rename a few of the symbols that binfmt_elf.c will define.
> * These are all local so the names don't really matter, but it

Argh. I thought I already saw stuff like this somewhere, but I think I
must have been looking at some other compat silliness. I'll fix this
and split up the series...

--
Kees Cook