Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1036577pxx; Thu, 29 Oct 2020 23:30:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlOjJ6IkZTlR7SHR3pdmYZzTVlxFnEOgCqnBX1GNp/X6qQp+tz51Ma5oocKaUmvOTV4O/H X-Received: by 2002:a50:8a02:: with SMTP id i2mr749326edi.40.1604039423709; Thu, 29 Oct 2020 23:30:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604039423; cv=none; d=google.com; s=arc-20160816; b=elefz2MAmicqNdh9Apx4nKkAx8kEHlLA7Yl1s/2N6HGSNtIQe7MYzpFWP3z9p8fLrV saECQ1B0ciz2Q2V28nQzeFEhL0qsA2mqBd5JADQYSeIADdw+XBtVOOueWfFw0LOqgflG kGoHt3Zzf1YVWq9M/U3grsws1W0bsfvkpj/dAbnE41KgfwVe5R1s4pVLvYhehto3KJBl tiIFZzAtLGEtKFPJHUsOLjHSGygGKBJAPzD3tKAe/jESib/e70J0XtQ4jExW5dEDhRtG v8QvtW+NKvrw/851hqc6QJv3nXH8PDCbcDvlVZFUPlwLR7tFAUL/gDA6JIvVOTU5+FTt 563A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=bWMjUjDke7pBpB9uHk2we86RqTYCbGgwv7HBCqDmkBk=; b=pGEmrSi1hTL2bvq7HcmWJuaQweRGCGjjownXq2K3I4mRRTOgTON1KWnzPfhJn+mbhR 9ngL3Tg11v0+T1b/0Js3djYaYbRT9RgwEkMMI1AJ8HCxaxJ9pEx3VCVeTI8o1K+GdAIw jTEAB6rR77L4E96EsSp73U39J7cn2yqNKuIBNXx8WoWHe9Xjw0Xmzt4UptoWkxu5lzEz ljmoDqUz+j9IzrHR+nDpugwZ9x+kBcTcbRVuHLK80mqL5FGr9qB1F9NnbcYpbhdZpCji Z7hJJwQGGTxCx07OsE514XW2dAX9KC6f8Wkbd4NLRKbThgWNVLwu5qyDmUIRt0TmBLyS Mt1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BGIzhBaO; 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 m13si65633edi.66.2020.10.29.23.29.59; Thu, 29 Oct 2020 23:30:23 -0700 (PDT) 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=BGIzhBaO; 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 S1725839AbgJ3G2L (ORCPT + 99 others); Fri, 30 Oct 2020 02:28:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725770AbgJ3G2L (ORCPT ); Fri, 30 Oct 2020 02:28:11 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F8CFC0613D3 for ; Thu, 29 Oct 2020 23:28:10 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id z4so5281174ybk.15 for ; Thu, 29 Oct 2020 23:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=bWMjUjDke7pBpB9uHk2we86RqTYCbGgwv7HBCqDmkBk=; b=BGIzhBaOQzCy918fMVC4TFa10N0YhlADR/ixgTvZJMqd3+rJFhMvD8EirCJS6J3i9R AAD479c7ZJCnmD6A8FGxmfrSIMCARnD1WmwAdivVHYl9oWbcmwDX3X9Cwiwr1Mf3cy4F +gP+Z3Nn8DClAFt3hRzPQtyGtLNkIfR/iqz/vp1kXBWPGVPBexqPnlYHiFxEAsLXOSaP q7UQit63yJDiVv6sKfVUYDmp1gOtetgj1mpeTv0qdVCGrRdT0hl+QF4ekmkFIM6T38hi 3ukU+5A8Ng7JvYsYIkhow3forXhlR773Mt50lN42juLKtIqY1leNDQrCFQN3/3Fbd9C7 plKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=bWMjUjDke7pBpB9uHk2we86RqTYCbGgwv7HBCqDmkBk=; b=gDwPrzIr0gzY9de+OCdNAhkEc5hmw70E2e4maLsr/wNObW1SFtLxaDg28pC/FZVK6V jcjFe3Q2gXkIcM6NZR0XCU6KGJE82mXtdWcl4T5cNUKrRuyl3fg1tJV5w96srDt7TrRr uV5QcHlGOYiE+I5Dds6fna3HSPVHv/viZUdUk37CVHCpjLX42FkXVz09I/iMRERjfkZq unYLvV5ALWnAM0rQ0PrmESoKER5tdUg/HEGwUOX7cadH/0kOVibx1vF6ryTQMbkWXF+T cqVSCQGHcS6WM8pYzX46LkZHsZKshUuG9T7NGxlpG+8V2yDDppeZtU0uXXkzQq/UrWms QEmw== X-Gm-Message-State: AOAM5332rHvNsoD/o3k3zmWGeQShKYJ20GBgMZYx23rjuZWJdPdZSmWT upDjo6wRjbsP2DuDcpY1qWzWus0DsTm0 Sender: "amistry via sendgmr" X-Received: from nandos.syd.corp.google.com ([2401:fa00:9:14:725a:fff:fe46:72ab]) (user=amistry job=sendgmr) by 2002:a25:740e:: with SMTP id p14mr1380333ybc.401.1604039289538; Thu, 29 Oct 2020 23:28:09 -0700 (PDT) Date: Fri, 30 Oct 2020 17:27:54 +1100 Message-Id: <20201030172731.1.I7782b0cedb705384a634cfd8898eb7523562da99@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH] proc: Provide details on indirect branch speculation From: Anand K Mistry To: linux-fsdevel@vger.kernel.org Cc: asteinhauser@google.com, joelaf@google.com, tglx@linutronix.de, Anand K Mistry , Alexey Dobriyan , Alexey Gladkov , Andrew Morton , 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 Similar to speculation store bypass, show information about the indirect branch speculation mode of a task in /proc/$pid/status. Signed-off-by: Anand K Mistry --- Documentation/filesystems/proc.rst | 2 ++ fs/proc/array.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst index 533c79e8d2cd..710dd69614b9 100644 --- a/Documentation/filesystems/proc.rst +++ b/Documentation/filesystems/proc.rst @@ -210,6 +210,7 @@ read the file /proc/PID/status:: NoNewPrivs: 0 Seccomp: 0 Speculation_Store_Bypass: thread vulnerable + Speculation_Indirect_Branch: conditional enabled voluntary_ctxt_switches: 0 nonvoluntary_ctxt_switches: 1 @@ -292,6 +293,7 @@ It's slow but very precise. NoNewPrivs no_new_privs, like prctl(PR_GET_NO_NEW_PRIV, ...) Seccomp seccomp mode, like prctl(PR_GET_SECCOMP, ...) Speculation_Store_Bypass speculative store bypass mitigation status + Speculation_Indirect_Branch indirect branch speculation mode Cpus_allowed mask of CPUs on which this process may run Cpus_allowed_list Same as previous, but in "list format" Mems_allowed mask of memory nodes allowed to this process diff --git a/fs/proc/array.c b/fs/proc/array.c index 65ec2029fa80..ce4fa948c9dd 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -368,6 +368,34 @@ static inline void task_seccomp(struct seq_file *m, struct task_struct *p) seq_puts(m, "vulnerable"); break; } + + seq_puts(m, "\nSpeculation_Indirect_Branch:\t"); + switch (arch_prctl_spec_ctrl_get(p, PR_SPEC_INDIRECT_BRANCH)) { + case -EINVAL: + seq_puts(m, "unsupported"); + break; + case PR_SPEC_NOT_AFFECTED: + seq_puts(m, "not affected"); + break; + case PR_SPEC_PRCTL | PR_SPEC_FORCE_DISABLE: + seq_puts(m, "conditional force disabled"); + break; + case PR_SPEC_PRCTL | PR_SPEC_DISABLE: + seq_puts(m, "conditional disabled"); + break; + case PR_SPEC_PRCTL | PR_SPEC_ENABLE: + seq_puts(m, "conditional enabled"); + break; + case PR_SPEC_ENABLE: + seq_puts(m, "always enabled"); + break; + case PR_SPEC_DISABLE: + seq_puts(m, "always disabled"); + break; + default: + seq_puts(m, "unknown"); + break; + } seq_putc(m, '\n'); } -- 2.29.1.341.ge80a0c044ae-goog