[PATCH v2] elf: Define DEFAULT_STACK_PERMS to (PF_R|PF_W)

Florian Weimer fweimer@redhat.com
Thu Jun 13 07:58:49 GMT 2024


* Andreas Schwab:

> On Jun 13 2024, H.J. Lu wrote:
>
>> Add stackperms.h to define DEFAULT_STACK_PERMS to (PF_R|PF_W) to disable
>> executable stack by default.
>
> This is not correct.  DEFAULT_STACK_PERMS needs to mirror the
> corresponding setting in the kernel.

I agree, but still sysdeps/generic/stackperms.h should use (PF_R|PF_W),
so that it's automatically correct for new ports.  It's just that
architectures that are different need to override that file.

Practically speaking, I think we can keep sysdeps/generic/stackinfo.h
and switch it to

#define _STACK_GROWS_DOWN 1
#define DEFAULT_STACK_PERMS (PF_R|PF_W)

New _STACK_GROWS_UP architectures are going to be the exception.  Then
we can delete a couple of overrides, like sysdeps/aarch64/stackinfo.h.
Beyond that, I don't think there is much space for simplification.

Thanks,
Florian



More information about the Libc-alpha mailing list