Received: by 10.223.185.116 with SMTP id b49csp436242wrg; Fri, 16 Feb 2018 01:19:56 -0800 (PST) X-Google-Smtp-Source: AH8x226FjnOjGzohpMSRhtHz0U46Zl8JnjLqPDab8Jebh9KsZfWLQ4EdJW+nbWJwOts6v1gSmLbO X-Received: by 2002:a17:902:4283:: with SMTP id h3-v6mr5340755pld.175.1518772795927; Fri, 16 Feb 2018 01:19:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518772795; cv=none; d=google.com; s=arc-20160816; b=MH8Ajd+Q4r2tDonvSN/1jXOXmlOYPLCfOwjcWnYx5xm6riM9wBC9xMNixrJtcSDDaf glVnFELcdh+frtC0M7aBu/LPxaTfO7CBpCKWa/SN9vqMcUKBL8oarnQ8n3WNh7TktLfN IRKH8clQsGy49CNF+1A8i91Ai22pV0nx1T551pI/ksp5tdUlbKVJ8sk4JCbGDHsMOiVO H3vZs4tgf1+TmIIqQhVkyMKIgp/tG/y2s+DovLonVWE6OPq/9JPAEb7KGqem7gKe8q13 wwMy8fsQXig26L/k1AvNtzFnx6VMsXHJQJMBviZ4DxWgvSHtvLUMbCXVbOmAnd3s2Kgg bqhA== 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=KsDaiBCVbJ5HViVD/pr+8EO/fjhQ2MCQLCP28x/zlM4=; b=DYbM7SD9I9yWSMgatfmyFxsk28/a539GAOwhx6o2uO5MhJ+XRGMG8RNgKjTbHMHSUi Ng/tAd+f7ggwHW8p0uzRzrjfKWg4GMcNLpQz68ERvyKGbhAjCa663iFOHfmEfOqRfnf+ IP6SSWdddQ69Q41/HmKmZG8uwU1mf5tL/UbtjhAxMnBHgmoiOMJ7yPp714r6bTZjaZa1 Ao03d6TLqnVl53ak7QWjahTe+KZ8K92I9Bg7GOwuyZslRXahRh49bH9rsis8QKF4kj5B /GJ0h/7m8VtqDd03yKllXwcU9cjfAG8yGG0nCKlJOjyDrMEbn+fGWJD2l1KQwyJdk/qm afJA== 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 y38-v6si4647079plh.448.2018.02.16.01.19.41; Fri, 16 Feb 2018 01:19:55 -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 S1426190AbeBOQpR (ORCPT + 99 others); Thu, 15 Feb 2018 11:45:17 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:60318 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423868AbeBOPlH (ORCPT ); Thu, 15 Feb 2018 10:41:07 -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 9E3041146; Thu, 15 Feb 2018 15:41:06 +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 Subject: [PATCH 4.15 058/202] [Variant 2/Spectre-v2] arm64: cpufeature: __this_cpu_has_cap() shouldnt stop early Date: Thu, 15 Feb 2018 16:15:58 +0100 Message-Id: <20180215151716.313237101@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@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.15-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: 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 @@ -1173,9 +1173,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;