Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933443AbeALKjC (ORCPT + 1 other); Fri, 12 Jan 2018 05:39:02 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:46483 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933244AbeALKi7 (ORCPT ); Fri, 12 Jan 2018 05:38:59 -0500 X-Google-Smtp-Source: ACJfBovFW6vLCPjRhJl0y+YETGZK8bmIayIeS7cvBiS/7kQMAIIUBJvDGira/Hg0LaLuO4LUyw/HFjARZuzpFKs29Xk= MIME-Version: 1.0 In-Reply-To: <151571799008.27429.12325141216769795517.stgit@dwillia2-desk3.amr.corp.intel.com> References: <151571798296.27429.7166552848688034184.stgit@dwillia2-desk3.amr.corp.intel.com> <151571799008.27429.12325141216769795517.stgit@dwillia2-desk3.amr.corp.intel.com> From: Geert Uytterhoeven Date: Fri, 12 Jan 2018 11:38:58 +0100 X-Google-Sender-Auth: fYQWkocXj6yQ0NA7ZCwmhmAehLM Message-ID: Subject: Re: [PATCH v2 01/19] Documentation: document array_ptr To: Dan Williams Cc: Linux Kernel Mailing List , Mark Rutland , Linux-Arch , kernel-hardening@lists.openwall.com, Peter Zijlstra , Jonathan Corbet , Will Deacon , Thomas Gleixner , "torvalds@linux-foundation.org" , Andrew Morton , Alan Cox Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi Dan, On Fri, Jan 12, 2018 at 1:46 AM, Dan Williams wrote: > From: Mark Rutland > > Document the rationale and usage of the new array_ptr() helper. > > Signed-off-by: Mark Rutland > Signed-off-by: Will Deacon > Cc: Dan Williams > Cc: Jonathan Corbet > Cc: Peter Zijlstra > Signed-off-by: Dan Williams Thanks for the update! > --- /dev/null > +++ b/Documentation/speculation.txt > @@ -0,0 +1,142 @@ > +This document explains potential effects of speculation, and how undesirable > +effects can be mitigated portably using common APIs. > + > +=========== > +Speculation > +=========== > + > +To improve performance and minimize average latencies, many contemporary CPUs > +employ speculative execution techniques such as branch prediction, performing > +work which may be discarded at a later stage. > + > +Typically speculative execution cannot be observed from architectural state, > +such as the contents of registers. However, in some cases it is possible to > +observe its impact on microarchitectural state, such as the presence or > +absence of data in caches. Such state may form side-channels which can be > +observed to extract secret information. > + > +For example, in the presence of branch prediction, it is possible for bounds > +checks to be ignored by code which is speculatively executed. Consider the > +following code: > + > + int load_array(int *array, unsigned int idx) { One more opening curly brace to move to the next line. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds