Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1924988imm; Thu, 24 May 2018 03:02:21 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoGBrH2kG5SPGL7mIVqjZDA18wLl+TK7UQ/Tx15qgKauaJu3t+h0IFzfMP+RJXd8y70QzEQ X-Received: by 2002:a63:7247:: with SMTP id c7-v6mr5307665pgn.68.1527156141036; Thu, 24 May 2018 03:02:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527156141; cv=none; d=google.com; s=arc-20160816; b=qB1WCUbHDdd3bXOWb7wMYTUvANo3T8457xzZ/NuqXBwmywo09JWeAAm5dIApEDYEIT Jd92uyAMLZOgHSlprYhbqgg9WhEziFPaP2nlSl+vyDo1zv2Ak1zqjgrHgjLn+LKHxX0p uyUW89noAuUxW3LJyx0SSOUNc2//GKkfNrpNNm1SXKWWZS0MzcVVs22/6xmUk72rnjJp oCu4LGmfrQeWChfYjzeKCxYvWTg0WfqXZnTPGmA7okrddv/g3cUtm2Le2E2BYjKng/fg XyRL6tDtCIGpHyJm4NuqN8umLFG/gaVxe5rWHYdy1dYLT3Zz1WNlspkEXDvxrDU09ZWJ MfAg== 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=LgWC/EUY+tAtYToAhkKKlIzupRkMHBvpsnmvIpTqKAs=; b=Dj3IbFPfsKNkwsw0UjyySSyOLb7QiMzWye4fUk/s4acZVmGGglVliGnNve77qaoqI7 6tpZ/2yumhk43ne5Pel+//eRUfBAxB1OKn+2hMRvNmnRB0Cavqpzd41seMoMfpAbi/lO yv2j0a6KicWAnLoUgQj0NMCjVCHujQa7qigZm+YTgBgFw2FKul/J4IdoH+VIqaJJpo8s tjoEJ2jaFRZrwWhok9cAh2hI/qFxdyJNunqS1S9iXtniyGYn7Pf0rpa9NTY0tcDKDcho KV/0usqyVMD0SiI5pw7AA7wcb2JW8XWGNJwF0ZBh+J9zRbmEgkrgmRNXaTl6d6MLj/yg fswA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uz9gzxe7; 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 j9-v6si20569640plk.587.2018.05.24.03.02.06; Thu, 24 May 2018 03:02:21 -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=uz9gzxe7; 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 S1030890AbeEXKBL (ORCPT + 99 others); Thu, 24 May 2018 06:01:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:44546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968502AbeEXKAx (ORCPT ); Thu, 24 May 2018 06:00:53 -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 5CADD20870; Thu, 24 May 2018 10:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156052; bh=+1cwFbH5W8Knlm2aDdAAtnd7b4ek44RSqieZS9cBViY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uz9gzxe7YEJkU2pcb5iYuhRFO1AN2SmCceVieDz+mjA9FMfJRVTo++aSa9QB3PZnN efQ3wU2dREv7PJOp1/qE5xDjEpywryjN2e52mA8CezXGYwetv4GgtYHyqEWjDog+hj BG0t3cjUMtdqGfcFnThBq+w8NEs43uJqbjk8vKO8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, greg@kroah.com Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauricio Faria de Oliveira , Michael Ellerman Subject: [PATCH 4.16 046/161] powerpc/pseries: Fix clearing of security feature flags Date: Thu, 24 May 2018 11:37:51 +0200 Message-Id: <20180524093023.906068189@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: Mauricio Faria de Oliveira commit 0f9bdfe3c77091e8704d2e510eb7c2c2c6cde524 upstream. The H_CPU_BEHAV_* flags should be checked for in the 'behaviour' field of 'struct h_cpu_char_result' -- 'character' is for H_CPU_CHAR_* flags. Found by playing around with QEMU's implementation of the hypercall: H_CPU_CHAR=0xf000000000000000 H_CPU_BEHAV=0x0000000000000000 This clears H_CPU_BEHAV_FAVOUR_SECURITY and H_CPU_BEHAV_L1D_FLUSH_PR so pseries_setup_rfi_flush() disables 'rfi_flush'; and it also clears H_CPU_CHAR_L1D_THREAD_PRIV flag. So there is no RFI flush mitigation at all for cpu_show_meltdown() to report; but currently it does: Original kernel: # cat /sys/devices/system/cpu/vulnerabilities/meltdown Mitigation: RFI Flush Patched kernel: # cat /sys/devices/system/cpu/vulnerabilities/meltdown Not affected H_CPU_CHAR=0x0000000000000000 H_CPU_BEHAV=0xf000000000000000 This sets H_CPU_BEHAV_BNDS_CHK_SPEC_BAR so cpu_show_spectre_v1() should report vulnerable; but currently it doesn't: Original kernel: # cat /sys/devices/system/cpu/vulnerabilities/spectre_v1 Not affected Patched kernel: # cat /sys/devices/system/cpu/vulnerabilities/spectre_v1 Vulnerable Brown-paper-bag-by: Michael Ellerman Fixes: f636c14790ea ("powerpc/pseries: Set or clear security feature flags") Signed-off-by: Mauricio Faria de Oliveira Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/pseries/setup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -484,13 +484,13 @@ static void init_cpu_char_feature_flags( * The features below are enabled by default, so we instead look to see * if firmware has *disabled* them, and clear them if so. */ - if (!(result->character & H_CPU_BEHAV_FAVOUR_SECURITY)) + if (!(result->behaviour & H_CPU_BEHAV_FAVOUR_SECURITY)) security_ftr_clear(SEC_FTR_FAVOUR_SECURITY); - if (!(result->character & H_CPU_BEHAV_L1D_FLUSH_PR)) + if (!(result->behaviour & H_CPU_BEHAV_L1D_FLUSH_PR)) security_ftr_clear(SEC_FTR_L1D_FLUSH_PR); - if (!(result->character & H_CPU_BEHAV_BNDS_CHK_SPEC_BAR)) + if (!(result->behaviour & H_CPU_BEHAV_BNDS_CHK_SPEC_BAR)) security_ftr_clear(SEC_FTR_BNDS_CHK_SPEC_BAR); }