[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55b44a39-ab19-363e-3703-9bf4e7d75f68@gmail.com>
Date: Thu, 22 Oct 2020 13:03:59 +0300
From: Topi Miettinen <toiwoton@...il.com>
To: Szabolcs Nagy <szabolcs.nagy@....com>
Cc: Florian Weimer <fweimer@...hat.com>,
Lennart Poettering <mzxreary@...inter.de>,
Mark Rutland <mark.rutland@....com>,
systemd-devel@...ts.freedesktop.org,
Kees Cook <keescook@...omium.org>,
Catalin Marinas <Catalin.Marinas@....com>,
Will Deacon <will.deacon@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Mark Brown <broonie@...nel.org>, libc-alpha@...rceware.org,
Dave Martin <dave.martin@....com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [systemd-devel] BTI interaction between seccomp filters in
systemd and glibc mprotect calls, causing service failures
On 22.10.2020 11.29, Szabolcs Nagy wrote:
> The 10/22/2020 11:17, Topi Miettinen via Libc-alpha wrote:
>> On 22.10.2020 10.54, Florian Weimer wrote:
>>> * Lennart Poettering:
>>>> Did you see Topi's comments on the systemd issue?
>>>>
>>>> https://github.com/systemd/systemd/issues/17368#issuecomment-710485532
>>>>
>>>> I think I agree with this: it's a bit weird to alter the bits after
>>>> the fact. Can't glibc set up everything right from the begining? That
>>>> would keep both concepts working.
>>>
>>> The dynamic loader has to process the LOAD segments to get to the ELF
>>> note that says to enable BTI. Maybe we could do a first pass and load
>>> only the segments that cover notes. But that requires lots of changes
>>> to generic code in the loader.
>>
>> What if the loader always enabled BTI for PROT_EXEC pages, but then when
>> discovering that this was a mistake, mprotect() the pages without BTI? Then
>> both BTI and MDWX would work and the penalty of not getting MDWX would fall
>> to non-BTI programs. What's the expected proportion of BTI enabled code vs.
>> disabled in the future, is it perhaps expected that a distro would enable
>> the flag globally so eventually only a few legacy programs might be
>> unprotected?
>
> i thought mprotect(PROT_EXEC) would get filtered
> with or without bti, is that not the case?
It would be filtered, but the idea is that with modern binaries this
would not happen since the pages would be mapped with mmap(,, PROT_EXEC
| PROT_BTI,,) which is OK for purposes MDWX. The loader would have to
use mprotect(PROT_EXEC) to get rid of PROT_BTI only for the legacy binaries.
-Topi
Powered by blists - more mailing lists