Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1924324imm; Thu, 24 May 2018 03:01:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoR8HXDvUwFgehtTu4RDQRAJ4OEefK6SK4vlTsNUWDJ3VC6Ju4uo71Bf4wHLDa3wqy6XXpc X-Received: by 2002:a65:6205:: with SMTP id d5-v6mr5311806pgv.416.1527156108326; Thu, 24 May 2018 03:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527156108; cv=none; d=google.com; s=arc-20160816; b=s8n1UzH16R4MWpq5FyEjban/ScQoVIJa91PRC8vp6nWPFpiYIWm3AvQY9rqBk6O0k4 u9f++igvtjf3y3w+LT7fQAqdALMoslYbej+GOXd5ppYtkHAsuwj8vgcqMt6tvr6XLSdK nemhJ/5svb4qHPFYUbzLl2ac/q/IARTJLEucru8FykVxhanh9eVCikmejZ33iEixMh4E in0njjCoiOwLB3uP2nKcMcL9/2o6rOl+9VjmIHp9ZHDgFlEgqO8lZpzFczdiqG/ZAs2d Bx1BzcjkueAFUEoTVQzo9+/4o0eylGYu5Yzjiyj/upPpv4Q1w70gAUoOdSGaA6gfnjwA gnQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=lrKhTopdj8Izw1VpVoxdTcNUAPg5AiodjHcJNj7SZho=; b=GKh1VwBtGVHg1UWus18ovJBR7I8lfcAdQV3tMyZWGUEOaRyj5jmls8GEZa4ecWdV2V 4qU1LF2j8EWSaCK36wEue6NYx+CAPGoC2OYKgOwR9n9VFlvHNlgBIoAZ9M56oXcE13pB Q2Rk6/7ZkJ79kuBrp6BjeGWVDdadXcmPYt4o3wIG0BfIEVEOAtZ1yzhQ30NDJIrMdgSL k+RmAQVDTqxh1iXxp1DgapWkBQWiCY877wy5wGF70ACP5wzWSoiO3SGdRj6o3w6sh01+ 6mt7bCLd3crfz/W+MId3RdvuOiVLAeMSLCZkG8MS9rkVv0BX6cxPrnwNZ/DV/5nRLV4f Q0yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=16V8Dldh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12-v6si16464380pgn.215.2018.05.24.03.01.32; Thu, 24 May 2018 03:01:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=16V8Dldh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965599AbeEXKAn (ORCPT + 99 others); Thu, 24 May 2018 06:00:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:42998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030424AbeEXKAg (ORCPT ); Thu, 24 May 2018 06:00:36 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6C0E820870; Thu, 24 May 2018 10:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156035; bh=4zgzN+JCPW7AtPdIWiznv7c73mdCPoVbHGczbwrcjP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=16V8Dldhsf8zCvB2btJRDy5v8dNykZ7SEOMspRrF5z5E+T+yvOb9wfNbSaWzI3eO6 6gy/+vwzf5xoNDFbxd+0m9r9uQkaZqHBTuXyXx37/LJRsSmPAWMCN7G8ZOlbYExs61 19zj27qGecSqdrubq/Orn9Rck0hC3fB7+f8RgAY0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, greg@kroah.com Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman Subject: [PATCH 4.16 041/161] powerpc/64s: Enhance the information in cpu_show_meltdown() Date: Thu, 24 May 2018 11:37:46 +0200 Message-Id: <20180524093023.290395778@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Ellerman commit ff348355e9c72493947be337bb4fae4fc1a41eba upstream. Now that we have the security feature flags we can make the information displayed in the "meltdown" file more informative. Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/include/asm/security_features.h | 1 arch/powerpc/kernel/security.c | 30 +++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) --- a/arch/powerpc/include/asm/security_features.h +++ b/arch/powerpc/include/asm/security_features.h @@ -10,6 +10,7 @@ extern unsigned long powerpc_security_features; +extern bool rfi_flush; static inline void security_ftr_set(unsigned long feature) { --- a/arch/powerpc/kernel/security.c +++ b/arch/powerpc/kernel/security.c @@ -6,6 +6,7 @@ #include #include +#include #include @@ -19,8 +20,33 @@ unsigned long powerpc_security_features ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf) { - if (rfi_flush) - return sprintf(buf, "Mitigation: RFI Flush\n"); + bool thread_priv; + + thread_priv = security_ftr_enabled(SEC_FTR_L1D_THREAD_PRIV); + + if (rfi_flush || thread_priv) { + struct seq_buf s; + seq_buf_init(&s, buf, PAGE_SIZE - 1); + + seq_buf_printf(&s, "Mitigation: "); + + if (rfi_flush) + seq_buf_printf(&s, "RFI Flush"); + + if (rfi_flush && thread_priv) + seq_buf_printf(&s, ", "); + + if (thread_priv) + seq_buf_printf(&s, "L1D private per thread"); + + seq_buf_printf(&s, "\n"); + + return s.len; + } + + if (!security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV) && + !security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR)) + return sprintf(buf, "Not affected\n"); return sprintf(buf, "Vulnerable\n"); }