From: Kees Cook <keescook@chromium.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
Sami Tolvanen <samitolvanen@google.com>,
Joao Moreira <joao@overdrivepizza.com>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH 2/4] x86/ibt: Implement FineIBT
Date: Fri, 28 Oct 2022 10:41:44 -0700 [thread overview]
Message-ID: <202210281041.3BD97D9@keescook> (raw)
In-Reply-To: <20221027092842.634714496@infradead.org>
On Thu, Oct 27, 2022 at 11:28:14AM +0200, Peter Zijlstra wrote:
> Implement an alternative CFI scheme that merges both the fine-grained
> nature of kCFI but also takes full advantage of the coarse grained
> hardware CFI as provided by IBT.
>
> To contrast:
>
> kCFI is a pure software CFI scheme and relies on being able to read
> text -- specifically the instruction *before* the target symbol, and
> does the hash validation *before* doing the call (otherwise control
> flow is compromised already).
>
> FineIBT is a software and hardware hybrid scheme; by ensuring every
> branch target starts with a hash validation it is possible to place
> the hash validation after the branch. This has several advantages:
>
> o the (hash) load is avoided; no memop; no RX requirement.
>
> o IBT WAIT-FOR-ENDBR state is a speculation stop; by placing
> the hash validation in the immediate instruction after
> the branch target there is a minimal speculation window
> and the whole is a viable defence against SpectreBHB.
>
> o Kees feels obliged to mention it is slightly more vulnerable
> when the attacker can write code.
>
> Obviously this patch relies on kCFI, but additionally it also relies
> on the padding from the call-depth-tracking patches. It uses this
> padding to place the hash-validation while the call-sites are
> re-written to modify the indirect target to be 16 bytes in front of
> the original target, thus hitting this new preamble.
>
> Notably, there is no hardware that needs call-depth-tracking (Skylake)
> and supports IBT (Tigerlake and onwards).
>
> Suggested-by: Joao Moreira (Intel) <joao@overdrivepizza.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
next prev parent reply other threads:[~2022-10-28 17:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 9:28 [PATCH 0/4] x86/ibt: Implement FineIBT Peter Zijlstra
2022-10-27 9:28 ` [PATCH 1/4] objtool: Add --cfi to generate the .cfi_sites section Peter Zijlstra
2022-11-02 9:20 ` [tip: x86/core] " tip-bot2 for Peter Zijlstra
2022-10-27 9:28 ` [PATCH 2/4] x86/ibt: Implement FineIBT Peter Zijlstra
2022-10-27 10:11 ` Peter Zijlstra
2022-10-28 17:41 ` Kees Cook [this message]
2022-11-02 9:20 ` [tip: x86/core] " tip-bot2 for Peter Zijlstra
2022-10-27 9:28 ` [PATCH 3/4] x86/cfi: Boot time selection of CFI scheme Peter Zijlstra
2022-10-28 17:41 ` Kees Cook
2022-11-02 9:19 ` [tip: x86/core] " tip-bot2 for Peter Zijlstra
2022-10-27 9:28 ` [PATCH 4/4] x86/cfi: Add boot time hash randomization Peter Zijlstra
2022-10-28 17:42 ` Kees Cook
2022-11-02 9:19 ` [tip: x86/core] " tip-bot2 for Peter Zijlstra
2022-10-28 11:01 ` [PATCH 0/4] x86/ibt: Implement FineIBT David Laight
2022-10-28 12:03 ` Peter Zijlstra
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=202210281041.3BD97D9@keescook \
--to=keescook@chromium.org \
--cc=joao@overdrivepizza.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=peterz@infradead.org \
--cc=samitolvanen@google.com \
--cc=x86@kernel.org \
/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