Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2364830imm; Mon, 28 May 2018 06:48:12 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpts9bu2OVasYCiZNNlFruXgK911yXIjP9qqr2r5U/VrrQf1uurk2YuyTviBodNhcwubg1v X-Received: by 2002:a17:902:c5:: with SMTP id a63-v6mr13807481pla.149.1527515292814; Mon, 28 May 2018 06:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527515292; cv=none; d=google.com; s=arc-20160816; b=KcvJJpTBp21vXoAUhwMYCHK1Hd1ryl836I5eA6elQD+d+FMN//sa3NPfmBBIGaw2Ip QHCD/pwSVRKwYgJFg3CrNiqLy4R7EuD+g664oc6+KwJnRSrtZmJUzAPi89t5NMq222px O4hlbo7Kh0Mr2u9ySzpmX1ftAmsZyj2GbqlcaHQD0yhis4iDS+O9U0G9x3BGDUUrlTdg 7/uc+qJ6KRkqqXaLCNmHKVXDSmRJrPAFJuBP1gHUUh0aob37/lFctO3Mto+4kXiD8ur1 eqA02U/d0o20s57SlyO0UTE+7N4ZkUf3u6n7p8zZyD3AYRJuNBw8N6IkweWfHNGYodjX w+Sw== 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=e9NMTAMpPrB1vTSspjISfy094dbcKkGMFtchM2y/nGY=; b=HHHlnYXNVVikTKJ3s9jb/1k6e3s2Db9dzgzxwrd3GlIe9X9EGK86CTFceqmlce/2RF qKtgngNQudJrT7qr2ebbNaVQVy4qcO/kT/IiREtTPn/BLTVgn3Z+LQvh4HlPwleDpdnO Otz2JLDXEKwK61Zq8wSg5ozEfk3k12fGBDVtzEfg3BNFAfJCZ63oNbDIkDASl/DK0jGk +MagImp6CHR3uUtlGZUYGDh8Vr5GqP9eWIRPKdc+Mwg/JQatwBCqyKcCBCk0xq3LYuD7 aUApr+hVDU+8yYL5BMbpyYZXBzsKgsDPez38oWOm6xxMPDAFw339MhmzJAOvDDv0ToAr g2Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=URnCPcer; 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 z28-v6si5782028pge.483.2018.05.28.06.47.58; Mon, 28 May 2018 06:48:12 -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=URnCPcer; 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 S1165429AbeE1NpY (ORCPT + 99 others); Mon, 28 May 2018 09:45:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:34276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937572AbeE1KnI (ORCPT ); Mon, 28 May 2018 06:43:08 -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 0671020844; Mon, 28 May 2018 10:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504187; bh=7ltYwrFk1+w0w0b02FbjwHOSTt7lAqzb4bG2c1kmjPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=URnCPcerXnt8depj384UNZdA8nKvcDfH8nKKlmWuMepydZJZp0EsW4u0TrShDHx/R OxNUDYpJ12UfI2iC797DMHkmt9RxDjsk5QKbLOUml8y7d++j7nq/4FplgR19yBEPHO 1jtaYkGTqRTw60r4jRwm902kfHv7TFEm/psk1ZcU= 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.14 047/496] powerpc/64s: Enhance the information in cpu_show_meltdown() Date: Mon, 28 May 2018 11:57:12 +0200 Message-Id: <20180528100321.722247951@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@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.14-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"); }