[RFC PATCH V2 02/10] C-SKY: TLS support

Guo Ren ren_guo@c-sky.com
Fri Apr 27 01:55:00 GMT 2018


Thx Joseph,

On Thu, Apr 26, 2018 at 04:00:17PM +0000, Joseph Myers wrote:
> I believe the relevant kernel definitions to check, to make sure that the 
> kernel does not give execute permissions to stack pages by default, are 
> elf_read_implies_exec and VM_STACK_DEFAULT_FLAGS / VM_DATA_DEFAULT_FLAGS.
For c-sky kernel:
 - elf_read_implies_exec is return 0 which defined in include/linux/elf.h
 - VM_STACK_DEFAUT_FLAGS is the same with VM_DATA_DEFAULT_FAGS defined
   in include/linux/mm.h.
 - VM_DATA_DEFAULT_FLAGS is defined in csky/include/asm/page.h:
     #define VM_DATA_DEFAULT_FLAGS \
               (VM_READ    | VM_WRITE    | VM_EXEC | \
                VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)

And our hardware mmu tlb-entry do not have EXEC bit to protect the
page-non-exec.
So we put VM_EXEC as default in VM_DATA_DEFAULT_FLAGS.

Use generic elf_read_implies_exec seems wrong and we should "return 1",
isn't it?

Best Regards
 Guo Ren



More information about the Libc-alpha mailing list