Re: [systemd-devel] BTI interaction between seccomp filters in systemd and glibc mprotect calls, causing service failures

From: Catalin Marinas
Date: Fri Oct 23 2020 - 05:04:58 EST


On Fri, Oct 23, 2020 at 07:13:17AM +0100, Szabolcs Nagy wrote:
> The 10/22/2020 10:31, Catalin Marinas wrote:
> > IIUC, the problem is with the main executable which is mapped by the
> > kernel without PROT_BTI. The dynamic loader wants to set PROT_BTI but
> > does not have the original file descriptor to be able to remap. Its only
> > choice is mprotect() and this fails because of the MDWX policy.
> >
> > Not sure whether the kernel has the right information but could it map
> > the main executable with PROT_BTI if the corresponding PT_GNU_PROPERTY
> > is found? The current ABI states it only sets PROT_BTI for the
> > interpreter who'd be responsible for setting the PROT_BTI on the main
> > executable. I can't tell whether it would break anything but it's worth
> > a try:
>
> i think it would work, but now i can't easily
> tell from the libc if i have to do the mprotect
> on the main exe or not.
>
> i guess i can just always mprotect and ignore
> the failure?

I replied to Keys before reading your email. So yeah, still issue
mprotect() but ignore the failure.

--
Catalin