[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180121103313.iiv7qejl7hlwbnqr@gmail.com>
Date: Sun, 21 Jan 2018 11:33:13 +0100
From: Ingo Molnar <mingo@...nel.org>
To: David Woodhouse <dwmw@...zon.co.uk>
Cc: arjan@...ux.intel.com, tglx@...utronix.de, karahmed@...zon.de,
x86@...nel.org, linux-kernel@...r.kernel.org,
tim.c.chen@...ux.intel.com, bp@...en8.de, peterz@...radead.org,
pbonzini@...hat.com, ak@...ux.intel.com,
torvalds@...ux-foundation.org, gregkh@...ux-foundation.org
Subject: Re: [PATCH v2 8/8] x86/mm: Only flush indirect branches when
switching into non dumpable process
* David Woodhouse <dwmw@...zon.co.uk> wrote:
> From: Andi Kleen <ak@...ux.intel.com>
>
> Flush indirect branches when switching into a process that marked
> itself non dumpable. This protects high value processes like gpg
> better, without having too high performance overhead.
>
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>
> Signed-off-by: David Woodhouse <dwmw@...zon.co.uk>
> Signed-off-by: KarimAllah Ahmed <karahmed@...zon.de>
> ---
> arch/x86/mm/tlb.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
> index 304de7d..f64e80c 100644
> --- a/arch/x86/mm/tlb.c
> +++ b/arch/x86/mm/tlb.c
> @@ -225,8 +225,19 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
> * Avoid user/user BTB poisoning by flushing the branch predictor
> * when switching between processes. This stops one process from
> * doing Spectre-v2 attacks on another.
> + *
> + * As an optimization: Flush indirect branches only when
> + * switching into processes that disable dumping.
> + *
> + * This will not flush when switching into kernel threads.
> + * But it would flush when switching into idle and back
> + *
> + * It might be useful to have a one-off cache here
> + * to also not flush the idle case, but we would need some
> + * kind of stable sequence number to remember the previous mm.
Punctuation and grammar is pretty inconsistent, please change it to something more
readable, like:
* As an optimization flush indirect branches only when
* switching into processes that disable dumping.
*
* This will not flush branches when switching into kernel
* threads, but it would flush them when switching to the
* idle thread and back.
*
* It might be useful to have a one-off cache here
* to also not flush the idle case, but we would need some
* kind of stable sequence number to remember the previous mm.
Thanks,
Ingo
Powered by blists - more mailing lists