From patchwork Thu Apr 12 11:11:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 133206 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1571574ljb; Thu, 12 Apr 2018 04:12:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx48NdFi5fhvH30Z+HsMkwiY/QZM6hWMA4yTXIvJ+tunpRH8tHiamrax/VM/qyU+3fZuGt7bh X-Received: by 2002:a17:902:e5:: with SMTP id a92-v6mr557099pla.26.1523531552087; Thu, 12 Apr 2018 04:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523531552; cv=none; d=google.com; s=arc-20160816; b=HXy5X5QcHfBwIMS7xn4LppWDlo+z+EyGfUrPCaalqx7Xne61vvToWlhH8h9AYxjLZ5 dhfqblqPiDmS/CluJdq6Vji/tOy1wYgVbNv2kCTGOr9v5JFx2iZtlgWPlvvMzpugY2ZC lHqpq5ciVBatYGvl5VGmdWSPtdStZD8srRFWqKEl3WzeGAQbJU6TT5xLPuw0IePsy/jo 40WwrO9YjRj+uWRrcGKPGmFNZFBCO2uWnP7L16zS1tfFkm2R5DfNhsgYikIJbEbxYXCf q6HaceiCvnuxHjhmiOahtLdJXVO7r+fI6y9vVnhDUyV2cyfCZ3XedUPEdniddvpBKiPT ph3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=6oexXajndL1P+TLcx9kLK9Te+FZvRlrndqHIFBmTu8A=; b=VOiyBMGQBleP/+1Rm0TLBN6fC+nEwhgJsD44kACrz8R4vvsVupp2RTUzcUXOVVShKr xJJo9q6MJOw5hiVhX1Zi7h78OJR0tFiiRoefhSLlU7+fdW4hqMwBtk/8bXJVMEJOdnj3 8kiUp2qejgX4s0JKfdG3XFzSfw69/sG9a4AvIHSih0vdX29QY7GxyJVM4E8x0JweaxtG vKdHQIHmWYSyKYcLwbdXGp0ym0oNKU/5CfCJE/bYytOvJLK7m4Sc7Clg2/9aPBa5pQVD f312RjBgBkNGPOiGZqLoe2LHqY7VLRz8HZQNzjuF08XWircgVUDhyb35tH9vfT4nasUK ET3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 bg3-v6si3001807plb.118.2018.04.12.04.12.31; Thu, 12 Apr 2018 04:12:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752790AbeDLLMb (ORCPT + 11 others); Thu, 12 Apr 2018 07:12:31 -0400 Received: from foss.arm.com ([217.140.101.70]:59394 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752428AbeDLLMa (ORCPT ); Thu, 12 Apr 2018 07:12:30 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AED0580D; Thu, 12 Apr 2018 04:12:30 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 029EE3F24A; Thu, 12 Apr 2018 04:12:28 -0700 (PDT) From: Mark Rutland To: stable@vger.kernel.org Cc: mark.brown@linaro.org, ard.biesheuvel@linaro.org, marc.zyngier@arm.com, will.deacon@arm.com, catalin.marinas@arm.com, ghackmann@google.com, shankerd@codeaurora.org Subject: [PATCH v4.9.y 11/42] arm64: cpufeature: __this_cpu_has_cap() shouldn't stop early Date: Thu, 12 Apr 2018 12:11:07 +0100 Message-Id: <20180412111138.40990-12-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180412111138.40990-1-mark.rutland@arm.com> References: <20180412111138.40990-1-mark.rutland@arm.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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] --- arch/arm64/kernel/cpufeature.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.11.0 diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 5056fc597ae9..cf000fd694fa 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1024,9 +1024,8 @@ static bool __this_cpu_has_cap(const struct arm64_cpu_capabilities *cap_array, 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;