Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2535057yba; Mon, 6 May 2019 07:38:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZRVFZlpeVSlhlyYRcyFmH9KzDO1BOvMxswuHCQqFfcOgoLbRG+/z0or3J6RYsuqsDW0h6 X-Received: by 2002:a63:6988:: with SMTP id e130mr32763190pgc.150.1557153505400; Mon, 06 May 2019 07:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557153505; cv=none; d=google.com; s=arc-20160816; b=0ccdv7JIWS9IedZ5IAufHF2UlHrGAk09uk2P3BoyJ0MRJj1pb3C7BEYmKQ2uql/A56 lB3UnaV48jKHuRFU3/fnp3c6iNMzVVzSwTClkp0Use20a0pbDj6oiYZi/UiAMHtE7c1x WhTt92PA+YJs/YH/Gv0crpyi50rwL+xpayl+5D2tvfAcXtjl2B8s3FnG37eCOXK82YTw Y/T632JKuj7fwGRaa5hA/JniYUTG66PNQbdlt+xaTr8X2VKc7ku0gx/NncIXJhegU556 lvtCrHTbEhgChEEVlyT1y+dBUs5/tWeh8uCHwBDxRrz4/jiw+IX+sP8gg2QzdDOD+zmL rFXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Owh5tipVmodfaXnnVVeHYC8Gk37TbSWG1LAE0InXkLY=; b=j2Nal0dERiu2R3ApAB8laSA+8ON7N7UGwLO3h2xrc4BcmeMji1TCYQWa1gm3ul8cAo 052sJ1kdICq/9iJKKODvGRLWt+zuyHsGPdRXVVOqbnnb8Tg4qCiREhWnHanZvbIiscZh n/JScPSAbzooCn6usCjNt/i9vWrsz1GpkMAu8sLek+nVHUv0P0crHN3rtZpWDLrHHP4V 7l0SY1DvTj19qTrg504dRhLzcIBklGm9BYncm0zVjRZPO3nJcvDRRg6giiiL7a2SCxOQ aMbPzaK9X4d8TLNCPDxZzFKgp5TXjA3EE42vO+Dy6Q06gAXJLLXPkmRAgAbw77LTePOH 3wXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2pAuwVG0; 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 f11si15547949plb.234.2019.05.06.07.38.09; Mon, 06 May 2019 07:38:25 -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; dkim=pass header.i=@kernel.org header.s=default header.b=2pAuwVG0; 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 S1726628AbfEFOg1 (ORCPT + 99 others); Mon, 6 May 2019 10:36:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:56708 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727148AbfEFOgW (ORCPT ); Mon, 6 May 2019 10:36:22 -0400 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 ABC19214AE; Mon, 6 May 2019 14:36:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153381; bh=rHNcloRpi8MdqFrW1AsHD5SGdgV/ZC5FEWmrzJklROM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2pAuwVG0H3c4LHhTw/WdInxCAqJOJzb1RdmcrHN4XodGpIcaRISnxfFFMPGvg3P0B r4HgXRiBuvE8fNgyVYmhtIAlbkER8tPTbUsSi4vdvnwlFqkCtol4QiBB+GeM9BC/jX dCSjukyh3te87EDRexMnfWoNrnS8EoQHQj6+DzBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julien Thierry , Wei Li , Catalin Marinas , "Sasha Levin (Microsoft)" Subject: [PATCH 5.0 067/122] arm64: fix wrong check of on_sdei_stack in nmi context Date: Mon, 6 May 2019 16:32:05 +0200 Message-Id: <20190506143100.998182603@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 1c41860864c8ae0387ef7d44f0000e99cbb2e06d ] When doing unwind_frame() in the context of pseudo nmi (need enable CONFIG_ARM64_PSEUDO_NMI), reaching the bottom of the stack (fp == 0, pc != 0), function on_sdei_stack() will return true while the sdei acpi table is not inited in fact. This will cause a "NULL pointer dereference" oops when going on. Reviewed-by: Julien Thierry Signed-off-by: Wei Li Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin (Microsoft) --- arch/arm64/kernel/sdei.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/kernel/sdei.c b/arch/arm64/kernel/sdei.c index 5ba4465e44f0..ea94cf8f9dc6 100644 --- a/arch/arm64/kernel/sdei.c +++ b/arch/arm64/kernel/sdei.c @@ -94,6 +94,9 @@ static bool on_sdei_normal_stack(unsigned long sp, struct stack_info *info) unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_normal_ptr); unsigned long high = low + SDEI_STACK_SIZE; + if (!low) + return false; + if (sp < low || sp >= high) return false; @@ -111,6 +114,9 @@ static bool on_sdei_critical_stack(unsigned long sp, struct stack_info *info) unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_critical_ptr); unsigned long high = low + SDEI_STACK_SIZE; + if (!low) + return false; + if (sp < low || sp >= high) return false; -- 2.20.1