Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp275175pxb; Wed, 4 Nov 2020 22:40:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzv6mhQlVV9plW6KypsBpR+U9MEUuepWr31BRdVkcMM6Gj+3rxdJ0o2ouICkCEzTgP3Fn5q X-Received: by 2002:aa7:d407:: with SMTP id z7mr1128738edq.234.1604558440710; Wed, 04 Nov 2020 22:40:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604558440; cv=none; d=google.com; s=arc-20160816; b=zsMpUiBKeZzYL28M/UUENDtregLSXBMp+nc+zcbFi7IEEv26QM3JePGA8/bp/qAD31 iIqjY0aNbAbJb7/Ve9aOXdX1bRajf0TkmeunGcTNvGiKxmelukLvaXH0mETCN9SDfQ4l WO3d/WgwbHpKDBukWXZNkgsWHM4I1+ozn7mqEZrhPbzZaZ0loLjIeo89V5N32aRs9TUm KqI2JgpA4T1eTEgypqlpGHLX1WO/Gk5MgMjk09MxzETNWS0iLSpb0J9ND5mOkjMHrb8g e5bX5wVMLu1B5w0jq72cOYgiIl52Gnzv0OZtQevGU2ihr+DA1+H1ySNDgPJgrhinp7Z1 cDWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=nlTE+5QXS18sXrL6D4KQC5d2Bo1EFlNxgmWgYZ7DFg0=; b=nSUv/o6NEaY/JNVtU3+i6IHq84jqF1cxghWIOnR3H34GHlh++n+S/ARr6okssSeR/d tE4nnZ63L9S3Gu8DVCAaX4nZAywYbgsewXm2fUSar2aIHInZtx7OIpqTKJuj6lWLxCeY 8+eZy9djVI+siTMgy/W0qL7953sj9wwqqWijraKp4nLSxnWwQlw9VdfP7xofXVOp3nEd pc5WIEp6N9AXZBnPcnjx9mT7cFe+rnUJTc0qFop+TIcanaA2+tUhj7jnYvzo8yZxgGpy vRQ/QC8q00XmGC9GshnZ/PjZ+w5sirqF2Ew/QcPNYfrRJV50hP436w0SV+Od3oHZG8Sh CURg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=es3AODzU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y21si400325eje.744.2020.11.04.22.40.17; Wed, 04 Nov 2020 22:40:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=es3AODzU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726609AbgKEF5V (ORCPT + 99 others); Thu, 5 Nov 2020 00:57:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726213AbgKEF5U (ORCPT ); Thu, 5 Nov 2020 00:57:20 -0500 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A903FC0613D2 for ; Wed, 4 Nov 2020 21:57:20 -0800 (PST) Received: by mail-io1-xd41.google.com with SMTP id p7so620605ioo.6 for ; Wed, 04 Nov 2020 21:57:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nlTE+5QXS18sXrL6D4KQC5d2Bo1EFlNxgmWgYZ7DFg0=; b=es3AODzU2iUwcMpdIoRei0G4xKF+9OIyQfwllwFlnnpZE/XGBckaMTNLqvyff3OMfh 7fL5m4b7S5cqyUKDD2Sz636oDz0+VI4byMjn+0Juv9bMu4gAGckOrRbgjEEti1efFylk dM6xxdr7/56jwpUQjHYKF8577HHYmC9h5DaNkOdYgnUXso32u9Zyd/bDyzT4FIXZYSpR MyoSgTWB2GokYpPKlN6T73/VFFo/o4HXWCd61mxB3RafmWXJo40GECeT0ySAtWFxpR70 PHoPq0QLbtHPOzkRAbufWD6odojj6Q9NWQAjeqILM2TRX8LZPXYPeAs7F9B8QGbV6DUq 1Mlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nlTE+5QXS18sXrL6D4KQC5d2Bo1EFlNxgmWgYZ7DFg0=; b=bT2zvXBAW96TTopJUcgS7VvE7PwCUBFPZUQLA/RIEPWUVUgUqOnGUFE7ghOaKu2+XG 9nTgyIlh5RNa1iTG5BBvUz34elmwVJ9QzUvJ3BdLgn23J1fcMnKYKwQm4SJkeLR1+ZSi X+xP3pq9TUxr/XNLNxWLAVhROr1gGwvikYm8vN40AJRrYlB7c/5niiPEXuc2orI2DiiO ty97Jlvjw7r4G5URBhiDBdmvFF9MFFXSbhSufpl2VIeiqTlcWxUmesXtc+ukJJYfT3JT spRh2KfH7pq7xBPsrav6KUsZp6ATZlUOv/4GYg8QhWXy4zERPOaSMVlRVhutmd7VbLnq UbDQ== X-Gm-Message-State: AOAM531GAWLe/IqN+uWCNrIu+fPWMVZsAsfYge4RxC/MX9j5ZRftHxvX 7pOFJTMQn0AWTzwmn9SrRbXGPRHQYH2/H+q+4cCDTQ== X-Received: by 2002:a02:c952:: with SMTP id u18mr817380jao.139.1604555839634; Wed, 04 Nov 2020 21:57:19 -0800 (PST) MIME-Version: 1.0 References: <20201030172731.1.I7782b0cedb705384a634cfd8898eb7523562da99@changeid> <20201031130546.d2b94345008e807f548dc068@linux-foundation.org> In-Reply-To: <20201031130546.d2b94345008e807f548dc068@linux-foundation.org> From: "Anand K. Mistry" Date: Thu, 5 Nov 2020 16:57:08 +1100 Message-ID: Subject: Re: [PATCH] proc: Provide details on indirect branch speculation To: Andrew Morton Cc: linux-fsdevel@vger.kernel.org, Anthony Steinhauser , Joel Fernandes , tglx@linutronix.de, Alexey Dobriyan , Alexey Gladkov , Jonathan Corbet , Kees Cook , Mauro Carvalho Chehab , Michal Hocko , Mike Rapoport , NeilBrown , Peter Zijlstra , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 1 Nov 2020 at 07:05, Andrew Morton wrote: > > On Fri, 30 Oct 2020 17:27:54 +1100 Anand K Mistry wrote: > > > Similar to speculation store bypass, show information about the indirect > > branch speculation mode of a task in /proc/$pid/status. > > Why is this considered useful? For testing/benchmarking, I needed to see whether IB (Indirect Branch) speculation (see Spectre-v2) is enabled on a task, to see whether an IBPB instruction should be executed on an address space switch. Unfortunately, this information isn't available anywhere else and currently the only way to get it is to hack the kernel to expose it (like this change). It also helped expose a bug with conditional IB speculation on certain CPUs. Another place this could be useful is to audit the system when using sanboxing. With this change, I can confirm that seccomp-enabled process have IB speculation force disabled as expected when the kernel command line parameter `spectre_v2_user=seccomp`. Since there's already a 'Speculation_Store_Bypass' field, I used that as precedence for adding this one. -- Anand K. Mistry Software Engineer Google Australia