All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Kosina <jkosina@suse.com>
To: speck@linutronix.de
Subject: [MODERATED] Re: [PATCH 5/5] SSB extra 4
Date: Mon, 21 May 2018 11:56:13 +0200 (CEST)	[thread overview]
Message-ID: <nycvar.YFH.7.76.1805211154010.27054@cbobk.fhfr.pm> (raw)
In-Reply-To: =?utf-8?q?=3C690644befb780c7b700274574d270620a17e6ed8=2E15253?= =?utf-8?q?83411=2Egit=2Edave=2Ehansen=40intel=2Ecom=3E?=

On Thu, 3 May 2018, speck for Dave Hansen wrote:

> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index 0e17379..947ae8a 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -11,6 +11,7 @@
>  #include <linux/init.h>
>  #include <linux/utsname.h>
>  #include <linux/cpu.h>
> +#include <linux/filter.h>
>  #include <linux/module.h>
>  #include <linux/nospec.h>
>  #include <linux/prctl.h>
> @@ -148,10 +149,23 @@ EXPORT_SYMBOL_GPL(x86_get_default_spec_ctrl);
>  
>  static inline u64 intel_rds_mask(void)
>  {
> +	u64 mask;
> +
>  	if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
>  		return 0;
>  
> -	return rds_tif_to_spec_ctrl(current_thread_info()->flags);
> +	mask = rds_tif_to_spec_ctrl(current_thread_info()->flags);
> +
> +	/*
> +	 * BPF programs can be exploited to attack the kernel.
> +	 * Leave the RDS bit on when we recently ran one.  This
> +	 * bit gets cleared after a BFP program has not run on
> +	 * the CPU for a while.
> +	 */
> +	if (get_cpu_var(bpf_prog_ran))
> +		mask |= SPEC_CTRL_RDS;
> +
> +	return mask;

I know that different aproach is being taken for BPF mitigation, but in 
case anyone is basing his first wave of updates on this ...

This doesn't look right. intel_rds_mask() is being called whenever 
X86_FEATURE_IBRS is set && vendor is X86_VENDOR_INTEL.

There is no check whatsoever whether X86_FEATURE_RDS is set, and therefore 
on ucode / kernel combination that has X86_FEATURE_IBRS but doesn't have 
X86_FEATURE_RDS, the RDS bits gets set in the MSR value anyway.

-- 
Jiri Kosina
SUSE Labs

  parent reply	other threads:[~2018-05-21  9:56 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 22:29 [MODERATED] [PATCH 0/5] SSB extra 0 Dave Hansen
2018-05-03 22:29 ` [MODERATED] [PATCH 1/5] SSB extra 2 Dave Hansen
2018-05-03 22:29 ` [MODERATED] [PATCH 2/5] SSB extra 3 Dave Hansen
2018-05-03 22:29 ` [MODERATED] [PATCH 3/5] SSB extra 1 Dave Hansen
2018-05-03 22:29 ` [MODERATED] [PATCH 4/5] SSB extra 5 Dave Hansen
2018-05-03 22:29 ` [MODERATED] [PATCH 5/5] SSB extra 4 Dave Hansen
2018-05-03 23:27 ` [MODERATED] Re: [PATCH 0/5] SSB extra 0 Kees Cook
2018-05-04  1:37   ` Dave Hansen
2018-05-04 22:26     ` Kees Cook
2018-05-23  7:17       ` [MODERATED] cBPF affectedness (was Re: [PATCH 0/5] SSB extra 0) Jiri Kosina
2018-05-23 13:56         ` [MODERATED] " Alexei Starovoitov
2018-05-04  9:20 ` [MODERATED] Re: [PATCH 1/5] SSB extra 2 Peter Zijlstra
2018-05-04 14:04   ` Dave Hansen
2018-05-04 15:50     ` Peter Zijlstra
2018-05-04 15:54       ` Linus Torvalds
2018-05-04 13:33 ` [PATCH 3/5] SSB extra 1 Thomas Gleixner
2018-05-04 14:22   ` [MODERATED] " Dave Hansen
2018-05-04 14:26     ` Thomas Gleixner
2018-05-04 16:04       ` [MODERATED] " Andi Kleen
2018-05-04 16:09         ` Thomas Gleixner
2018-05-04 16:28           ` [MODERATED] " Andi Kleen
2018-05-04 16:32             ` Thomas Gleixner
2018-05-04 16:43               ` [MODERATED] " Dave Hansen
2018-05-04 18:39                 ` Thomas Gleixner
2018-05-06  8:32                   ` Thomas Gleixner
2018-05-06 21:48                     ` Thomas Gleixner
2018-05-06 22:40                       ` [MODERATED] " Dave Hansen
2018-05-07  6:19                         ` Thomas Gleixner
2018-05-04 17:01 ` [MODERATED] Re: [PATCH 4/5] SSB extra 5 Konrad Rzeszutek Wilk
2018-05-21  9:56 ` Jiri Kosina [this message]
2018-05-21 13:38   ` [PATCH 5/5] SSB extra 4 Thomas Gleixner

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=nycvar.YFH.7.76.1805211154010.27054@cbobk.fhfr.pm \
    --to=jkosina@suse.com \
    --cc=speck@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.