[PATCH v6 08/14] aarch64: enable BTI at runtime
Szabolcs Nagy
szabolcs.nagy@arm.com
Mon Jul 13 08:32:01 GMT 2020
The 07/11/2020 08:58, Richard Henderson wrote:
> On 7/1/20 7:39 AM, Szabolcs Nagy wrote:
> > + unsigned prot = PROT_READ | PROT_EXEC | PROT_BTI;
> > +
> > + for (phdr = map->l_phdr; phdr < &map->l_phdr[map->l_phnum]; ++phdr)
> > + if (phdr->p_type == PT_LOAD && (phdr->p_flags & PF_X))
> > + {
> > + ElfW(Addr) start = phdr->p_vaddr + map->l_addr;
> > + ElfW(Addr) len = phdr->p_memsz;
> > + if (__mprotect ((void *) start, len, prot) < 0)
>
> Spend an extra cycle or two and honor the exact set of p_flags?
>
> If I construct an executable but non-readable PT_LOAD segment, that should be
> fine. RWX with BTI would undoubtedly be an unusual case, but perhaps not
> implausible in the context of a JIT with a statically allocated buffer.
hm makes sense, i'll fix it.
More information about the Libc-alpha
mailing list