[PATCH] LoongArch: Set defaults to exec stack 0.

Xi Ruoyao xry111@xry111.site
Mon Jul 25 09:22:50 GMT 2022


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."
> 

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University


More information about the Binutils mailing list