Thread (98 messages) 98 messages, 13 authors, 2018-06-26

Re: [PATCH 06/10] x86/cet: Add arch_prctl functions for shadow stack

From: H.J. Lu <hidden>
Date: 2018-06-12 16:05:31
Also in: linux-arch, linux-mm, lkml

On Tue, Jun 12, 2018 at 9:01 AM, Andy Lutomirski [off-list ref] wrote:
On Tue, Jun 12, 2018 at 4:43 AM H.J. Lu [off-list ref] wrote:
quoted
On Tue, Jun 12, 2018 at 3:03 AM, Thomas Gleixner [off-list ref] wrote:
quoted
On Thu, 7 Jun 2018, H.J. Lu wrote:
quoted
On Thu, Jun 7, 2018 at 2:01 PM, Andy Lutomirski [off-list ref] wrote:
quoted
Why is the lockout necessary?  If user code enables CET and tries to
run code that doesn't support CET, it will crash.  I don't see why we
need special code in the kernel to prevent a user program from calling
arch_prctl() and crashing itself.  There are already plenty of ways to
do that :)
On CET enabled machine, not all programs nor shared libraries are
CET enabled.  But since ld.so is CET enabled, all programs start
as CET enabled.  ld.so will disable CET if a program or any of its shared
libraries aren't CET enabled.  ld.so will lock up CET once it is done CET
checking so that CET can't no longer be disabled afterwards.
That works for stuff which loads all libraries at start time, but what
happens if the program uses dlopen() later on? If CET is force locked and
the library is not CET enabled, it will fail.
That is to prevent disabling CET by dlopening a legacy shared library.
quoted
I don't see the point of trying to support CET by magic. It adds complexity
and you'll never be able to handle all corner cases correctly. dlopen() is
not even a corner case.
That is a price we pay for security.  To enable CET, especially shadow
shack, the program and all of shared libraries it uses should be CET
enabled.  Most of programs can be enabled with CET by compiling them
with -fcf-protection.
If you charge too high a price for security, people may turn it off.
I think we're going to need a mode where a program says "I want to use
the CET, but turn it off if I dlopen an unsupported library".  There
are programs that load binary-only plugins.
You can do

# export GLIBC_TUNABLES=glibc.tune.hwcaps=-SHSTK

which turns off shadow stack.


-- 
H.J.
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help