From patchwork Thu Jan 16 23:18:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E746C33CB3 for ; Thu, 16 Jan 2020 23:33:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5EDE92072B for ; Thu, 16 Jan 2020 23:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217588; bh=az2890KtbyrSb9tOHkx/aXxpV+On7IOFyMfHxl+d5eg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sAncAMCufsZcP41KgnN13Y0yCnWwrI0jTbnykaWQlAgEmwwCvAsJi4fNjVcQuKEHy P53qzu4/BnMDlFOwZ4uQ9kmxB+oiDUIupt2bHomSAzYQSXJA6v3+V7rK8YjTJViAIW Lj6mVc1D69y6n4gaDHkR0tJK7zehuEVzAMRCkWpY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404277AbgAPXdH (ORCPT ); Thu, 16 Jan 2020 18:33:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:43144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404273AbgAPXdG (ORCPT ); Thu, 16 Jan 2020 18:33:06 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 84D8D2073A; Thu, 16 Jan 2020 23:33:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217586; bh=az2890KtbyrSb9tOHkx/aXxpV+On7IOFyMfHxl+d5eg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wu37+i8BUcjryDR6Cuyvr+HuTecp9n4ycUODA3v2ZmEZYgqXm9skJf01k0lM8b/sF MDh3rlevxefRQ+9vPaWMO7pEFVRNB1Dzp7so9ITOt4zLRcUeAhFtmE4B9+MFgtcknM 6jEMQJietnHOs/LP1f4QY2GkeIO50wD7MDq45eSQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Jan Kiszka , Suzuki K Poulose , Catalin Marinas , Will Deacon , Juerg Haefliger Subject: [PATCH 4.14 32/71] arm64: add sentinel to kpti_safe_list Date: Fri, 17 Jan 2020 00:18:30 +0100 Message-Id: <20200116231714.206616625@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231709.377772748@linuxfoundation.org> References: <20200116231709.377772748@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mark Rutland commit 71c751f2a43fa03fae3cf5f0067ed3001a397013 upstream. We're missing a sentinel entry in kpti_safe_list. Thus is_midr_in_range_list() can walk past the end of kpti_safe_list. Depending on the contents of memory, this could erroneously match a CPU's MIDR, cause a data abort, or other bad outcomes. Add the sentinel entry to avoid this. Fixes: be5b299830c63ed7 ("arm64: capabilities: Add support for checks based on a list of MIDRs") Signed-off-by: Mark Rutland Reported-by: Jan Kiszka Tested-by: Jan Kiszka Reviewed-by: Suzuki K Poulose Cc: Catalin Marinas Cc: Suzuki K Poulose Cc: Will Deacon Signed-off-by: Will Deacon Signed-off-by: Juerg Haefliger Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/cpufeature.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -836,6 +836,7 @@ static bool unmap_kernel_at_el0(const st MIDR_ALL_VERSIONS(MIDR_CORTEX_A57), MIDR_ALL_VERSIONS(MIDR_CORTEX_A72), MIDR_ALL_VERSIONS(MIDR_CORTEX_A73), + { /* sentinel */ } }; char const *str = "kpti command line option"; bool meltdown_safe;