Received: by 10.223.185.116 with SMTP id b49csp2562716wrg; Thu, 15 Feb 2018 13:42:36 -0800 (PST) X-Google-Smtp-Source: AH8x2247Il3p7FljgR1LvuYYZur6DC53INEBibRmm1pldNmOgwBtI2lOhuCdRv9fFwRVLaytZsxf X-Received: by 10.98.155.93 with SMTP id r90mr3649285pfd.132.1518730956388; Thu, 15 Feb 2018 13:42:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518730956; cv=none; d=google.com; s=arc-20160816; b=VlDBk/1E8IyPfvRQqFAuK8YNxaYfnI9e4C3UojIyQCV856ZnQcHHh2+60aHgiJKaKf dZlTxivspd8J1srm9dmEiMx3/jPJgqIW5rDjDRTe70lKlAgdlvN4yf0Mj9WkSivJZ3WR AlQ23RT2nRf/Y0zba6UNrBT190aClvS7gcAfpYpVmL0y5+Srxb2Ng0O620JEhdOIKilI /J63Rt8za0Zg//OZZbihq7BpwWI2kaL6/8+iPs/MntHnRd3y47tIGMZyTrLy9NoD+rYp SqZr9fBJUZdN+HdkWAdiRpWLAFAHqdp6hyh/mm1/V3lbvCS40u2u2And+76dGXXrcjJ+ bhbA== 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 :arc-authentication-results; bh=cxsQpi34M4re158VzqEL4GX9qNoH+0U2vYQeAxSSkzQ=; b=VYq6Ob1xky3LogYTD86Y4YlUvs4KAqE2C8VZn45Bv4wob73bF1i+B7z9HBrN8XqRan WW/fcyx3CMsxMkJd8zybaCnYos0b38ziWVvTYbih6oaq8Oj4SW2Z65Lz1kdeA8T3m2wB V1vrmWQ76+xcAxudkEWArwwPpYSCpqc8Dqq1HFPp3Z6U8TeqchVZmAKHJj7H+yX1aLjL gR1HJYALEZwFukSc6VeG4mZVDhYmu33NQzAG1BLUsSfsQI3SCcQjIkGOtJDE5CC+EjyA exT/gbP2dFKdGCvCY1esTZtPPmjUxoDjy+38j5pfpxCRe2EMfSw6HKGFn+BWxeD3CTUf zovA== ARC-Authentication-Results: i=1; mx.google.com; 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 g2si166639pgu.737.2018.02.15.13.42.21; Thu, 15 Feb 2018 13:42:36 -0800 (PST) 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; 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 S1164641AbeBOPcb (ORCPT + 99 others); Thu, 15 Feb 2018 10:32:31 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:56390 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164605AbeBOPcX (ORCPT ); Thu, 15 Feb 2018 10:32:23 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A2A1BF97; Thu, 15 Feb 2018 15:32:22 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suzuki K Poulose , Marc Zyngier , James Morse , Catalin Marinas , Will Deacon , Ard Biesheuvel Subject: [PATCH 4.14 065/195] [Variant 2/Spectre-v2] arm64: cpufeature: __this_cpu_has_cap() shouldnt stop early Date: Thu, 15 Feb 2018 16:15:56 +0100 Message-Id: <20180215151708.961123461@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151705.738773577@linuxfoundation.org> References: <20180215151705.738773577@linuxfoundation.org> User-Agent: quilt/0.65 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: James Morse Commit edf298cfce47 upstream. this_cpu_has_cap() tests caps->desc not caps->matches, so it stops walking the list when it finds a 'silent' feature, instead of walking to the end of the list. Prior to v4.6's 644c2ae198412 ("arm64: cpufeature: Test 'matches' pointer to find the end of the list") we always tested desc to find the end of a capability list. This was changed for dubious things like PAN_NOT_UAO. v4.7's e3661b128e53e ("arm64: Allow a capability to be checked on single CPU") added this_cpu_has_cap() using the old desc style test. CC: Suzuki K Poulose Reviewed-by: Suzuki K Poulose Acked-by: Marc Zyngier Signed-off-by: James Morse Signed-off-by: Catalin Marinas Signed-off-by: Will Deacon Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/cpufeature.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1102,9 +1102,8 @@ static bool __this_cpu_has_cap(const str if (WARN_ON(preemptible())) return false; - for (caps = cap_array; caps->desc; caps++) + for (caps = cap_array; caps->matches; caps++) if (caps->capability == cap && - caps->matches && caps->matches(caps, SCOPE_LOCAL_CPU)) return true; return false;