|
|
Log in / Subscribe / Register

Avoid speculative indirect calls in kernel

From:  Andi Kleen <andi-AT-firstfloor.org>
To:  tglx-AT-linuxtronix.de
Subject:  Avoid speculative indirect calls in kernel
Date:  Wed, 3 Jan 2018 15:09:23 -0800
Message-ID:  <20180103230934.15788-1-andi@firstfloor.org>
Cc:  torvalds-AT-linux-foundation.org, gregkh-AT-linux-foundation.org, dwmw-AT-amazon.co.uk, tim.c.chen-AT-linux.intel.com, linux-kernel-AT-vger.kernel.org, dave.hansen-AT-intel.com

This is a fix for Variant 2 in 
https://googleprojectzero.blogspot.com/2018/01/reading-pr...

Any speculative indirect calls in the kernel can be tricked 
to execute any kernel code, which may allow side channel
attacks that can leak arbitrary kernel data.

So we want to avoid speculative indirect calls in the kernel.

There's a special code sequence called a retpoline that can
do indirect calls without speculation. We use a new compiler
option -mindirect-branch=thunk-extern (gcc patch will be released
separately) to recompile the kernel with this new sequence.

We also patch all the assembler code in the kernel to use
the new sequence.

The patches were originally from David Woodhouse and Tim Chen,
but then reworked and enhanced by me.

No performance numbers at this point. 32bit is only boot tested.

Git tree available in 
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc spec/retpoline-415-1

v1: Initial post.


Copyright © 2018, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds