public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "keescook@chromium.org" <keescook@chromium.org>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"szabolcs.nagy@arm.com" <szabolcs.nagy@arm.com>,
	"hjl.tools@gmail.com" <hjl.tools@gmail.com>,
	"debug@rivosinc.com" <debug@rivosinc.com>,
	"kito.cheng@sifive.com" <kito.cheng@sifive.com>
Cc: "libc-alpha@sourceware.org" <libc-alpha@sourceware.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Shadow stack enabling from dynamic loader v/s kernel on exec
Date: Mon, 27 Nov 2023 17:41:16 +0000	[thread overview]
Message-ID: <d36b02fc0da364ea0d660e5e5ecac9df7e327f79.camel@intel.com> (raw)
In-Reply-To: <CAKC1njRkpaqbAFWrZpz75u4M-T8mniY2QHVZEENameqnHOOGPg@mail.gmail.com>

On Wed, 2023-11-22 at 16:19 -0800, Deepak Gupta wrote:
> I don't want to divert focus from patch specific comments on shadow
> stack patches that're being
> discussed in the mailing list. And that's starting this separate
> thread about enabling the shadow
> stack in the dynamic loader v/s kernel. I've put relevant folks in
> "To" and "kernel" and "libc" in CC.

Thanks. As we look at adding some final glibc support, I've wondered if
there might be enough topics to warrant an occasional meeting to
discuss stuff like this. I'd also like to discuss the shadow stack life
cycle issues (uncontext, etc), alt shadow stacks and all of the
compatibility last mile problems. Towards the goal of avoiding
unnecessary divergence on app developer expectations.

> This has many advantages
> - dynamic loaders (and static binary) are protected from loader
> specific ROP attack in a small window

Loaders can call the prctl() as the first step, so the loader is
protected. The x86 glibc patches did this at one point. So the prctl
supports enabling at pretty close to either point, "exec time" or later
in the loader process. Enabling before the first CALL (or unwound to
that point) leaves the shadow stack's balanced.

I think the main disadvantage are:
 - *Maybe* it requires duplication for the seccomp use case
 - Requires mapping, then unmapping shadow stack for cases of
incompatible DSO or disable via TUNABLE

It is probably worth noting, the old elf bit based enabling would
enable shadow stack if the *loader* DSO had the elf bit set. Then the
loader would check the elf bit of the execing binary, and disable
shadow stack if not supported. This means with shadow stack enabled
kernel and glibc, all legacy apps would be subjected to a map and unmap
of the shadow stack. It probably isn't the biggest deal, but it's nice
to avoid.

  parent reply	other threads:[~2023-11-27 17:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23  0:19 Shadow stack enabling from dynamic loader v/s kernel on exec Deepak Gupta
2023-11-25 11:35 ` Mark Brown
2023-11-27 17:32   ` Edgecombe, Rick P
2023-11-28 13:55     ` Mark Brown
2023-11-27 17:41 ` Edgecombe, Rick P [this message]
2023-11-28 12:51   ` Mark Brown
2023-11-28 20:29     ` Deepak Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d36b02fc0da364ea0d660e5e5ecac9df7e327f79.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=broonie@kernel.org \
    --cc=debug@rivosinc.com \
    --cc=hjl.tools@gmail.com \
    --cc=keescook@chromium.org \
    --cc=kito.cheng@sifive.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=szabolcs.nagy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox