[PATCH] LoongArch: Set defaults to exec stack 0.
WANG Xuerui
i.swmail@xen0n.name
Mon Jul 25 09:44:16 GMT 2022
On 2022/7/25 17:22, Xi Ruoyao wrote:
> On Mon, 2022-07-25 at 17:18 +0800, Huacai Chen wrote:
>> Hi, all,
>>
>> On Mon, Jul 25, 2022 at 5:17 PM WANG Xuerui <i.swmail@xen0n.name> wrote:
>>> On 2022/7/25 16:35, Andreas Schwab via Binutils wrote:
>>>> On Jul 25 2022, Xi Ruoyao wrote:
>>>>
>>>>> The doc of elf_backend_default_execstack says:
>>>>>
>>>>> /* True if an object file lacking a .note.GNU-stack section
>>>>> should be assumed to be requesting exec stack. At least one
>>>>> other file in the link needs to have a .note.GNU-stack section
>>>>> for a PT_GNU_STACK segment to be created. */
>>>>>
>>>>> So I think it only controls the default behavior of bfd library and is
>>>>> not related to the kernel?
>>>> The kernel always controls the ultimate decision.
>>>>
>>>> It also means that if no input file has a GNU-stack note, no
>>>> PT_GNU_STACK segment is created for the output, in which case the kernel
>>>> default (which is PF_X for loongarch) applies.
>>>>
>>>> The value of DEFAULT_STACK_PERMS in glibc must also agree with the
>>>> kernel.
>>>>
>>> Well, actually the kernel behavior seems to be overlooked during the
>>> upstreaming process. No sane architecture in 2022 should have executable
>>> stacks in the beginning.
> Hmm.. But how about LA32?
>
> "Non-eXecutable bit (NX), 1 bit. This bit is set when a fetch operation
> is not allowed on the address space where this page table entry is
> located. This control bit is only exist in LA64."
Good catch... In which case the predicate could look like "!cpu_has_nx".
But the kernel is LA64-only at present, the ILP32 ABIs are not fully
defined yet, and no LA32 cores are produced in large quantities, so just
unconditionally disabling the predicate should cause no harm either. I
think we'd go with the former approach then.
More information about the Binutils
mailing list