[PATCH v6 08/14] aarch64: enable BTI at runtime
Szabolcs Nagy
szabolcs.nagy@arm.com
Mon Jul 13 13:14:08 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.
i will commit the attached fix tomorrow
unless there are comments on it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-aarch64-Respect-p_flags-when-protecting-code-with-PR.patch
Type: text/x-diff
Size: 1585 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200713/c15ee7ae/attachment.bin>
More information about the Libc-alpha
mailing list