Received: by 10.192.165.156 with SMTP id m28csp250260imm; Tue, 17 Apr 2018 09:30:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx49PXbb6IyRdiDXzt+w/2WKQfqVD2nlLx78fJWm1ir41qAZB4ZuaAMPx5L0X155cTEA4Nzbz X-Received: by 10.101.99.214 with SMTP id n22mr2349248pgv.152.1523982648547; Tue, 17 Apr 2018 09:30:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523982648; cv=none; d=google.com; s=arc-20160816; b=Xixfi6rCd6K4yun6VfdBBs4clnsLTiBM+BpkqqaZrGHklPMtxtWOh5pFlzLF74pxgt nEvvLuIyWZuqdnXfO7hDsZXIqggktz4CNPCqd0bEEnlUaoCJrvn8IrxwxOdPkJK9WM+1 /haZxapYLUI1tIJbuFZN1lKkW5m8UH/kb8UROSlXu01ay3JfCCnARB6074/AM8cxYQ4f 7YwqLIlgHso4bGTbBEChffU3iBzzWtsAcfmldFbep/tDAplHdf17k5ICarz/0mFPdaC4 onEiKHWkKDJ4XSrRc+IClbTDSL8b8tKMW3SlbXLQv9KXHQCiOFsh48KZAid+PW8G2ec4 9c7A== 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=1YMpjzGIBL7bFor4ij0UJvjPm8iCJaTEopJv542NfoU=; b=f5ZS3Q/604voixxBI2IcpwKGTajEOwNo6vWzAsT6SAQ6OAP0ugkAwOiNm7HjC5Hncy /iJypF4cPVT+ULWOhBooTSa5tYI0n4kYJn9im91R91C42wwUdOQJIL8g9s83OYzRmoj8 sywtWj7vkTCujdLd9PAjUp34DmdjRhic+1l6VvZirNQ+DEpCee0+pF4kzJrTf4z7MXDg zENggMtpZvTToWDTMCsjSfvVWYnBs79CfpccHVu9+4g8TNZYmmLsA/ifIpRSyYVZsz4H im7j5PDtIiFKC6hSiKz7LqWzfwU6eRRWIg3R95obHvfU5YSYnigiFT/DyW/GhocsDmOj vT7w== 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 y10si7655352pgr.672.2018.04.17.09.30.34; Tue, 17 Apr 2018 09:30: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; 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 S1755457AbeDQQId (ORCPT + 99 others); Tue, 17 Apr 2018 12:08:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35524 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755108AbeDQQIb (ORCPT ); Tue, 17 Apr 2018 12:08:31 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3B7B7E66; Tue, 17 Apr 2018 16:08:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Suzuki K Poulose , Marc Zyngier , James Morse , Catalin Marinas , Greg Hackmann , Mark Rutland Subject: [PATCH 4.9 19/66] arm64: cpufeature: __this_cpu_has_cap() shouldnt stop early Date: Tue, 17 Apr 2018 17:58:52 +0200 Message-Id: <20180417155646.684452470@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155645.868055442@linuxfoundation.org> References: <20180417155645.868055442@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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mark Rutland From: James Morse commit edf298cfce47ab7279d03b5203ae2ef3a58e49db 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: Mark Rutland [v4.9 backport] Tested-by: Greg Hackmann 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 @@ -1024,9 +1024,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;