Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2312051imc; Tue, 12 Mar 2019 11:08:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIm9iQrYHVZe5tM4qGPZ8k3o3RBRqr8YK4zpFWOiQ49oExUps7KK3QbH0IKvY80jL6Z+Gt X-Received: by 2002:a65:4608:: with SMTP id v8mr36941865pgq.9.1552414130914; Tue, 12 Mar 2019 11:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552414130; cv=none; d=google.com; s=arc-20160816; b=e9Q3u9jn3wJ94HdQ9Hpkr0Efvj+TFqQ2gOdS29GG7xpBksHIwkFWAGNV5LpwDcHKwP 3CYj1gZ/YPjLYJ9RQkTCECU/Nq3O1of2985dKvTgESmkoDLbSNb7PFmP1evPZduM5RZN hqol+CxbKSIJNE3zqSr7pBpYVm5m3/wtmNtFqFWP2hc/+lkvfiYiNNpDEhCtr8/ukHsa swwrTzmEN1wgJX0HbrfjaPlN6I5B4/6rNuho5Ts7a9dE7P/WHu6OJ1UGHf80m+nzYjyr 2Szfz+Us/JehvVo9sAqN9q/Y0kmq3XNPGB2//YtmsqEgUMaayBqjKHsLEdgxpkBWuPch PZyg== 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=UXXkD+/xxLP0LG9pAAk9OljTcouWGl+jF9rsIDs8x7c=; b=ik/YyeHRd0ZLL54WSy0iEI7Dig5slWlrQFvi3WapKuOevv7xHrTdJmI0MkqNwRjR8c I1ve/t3GnBHhRnxsZ1IPenk/XNj3WWZQEYpz3OM+QwiE8sOq13Yj7yKd+N6PHGlfCuZb NSxQo2bYobXqPyiHwg61tP8N7MAvtFpmxOCQx6xbnsllLZ5sS2XZZBYYoCnNagpkEuAj 5Cs7ryCwcqc0TF29thJ2dXbuKHpnaoFo6b7eRUl2MGhp8czUJDG70CJ3Lv8WHPJG+kNB A34EsmJsmkR/HgpNjtJxikB5ULzgkGAnUT8AiLhx+FAOkgaQObwVYcaBmVtWxMl70wdV T/Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Uuo4JBkM; 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 u1si8350672pfb.193.2019.03.12.11.08.32; Tue, 12 Mar 2019 11:08:50 -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=Uuo4JBkM; 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 S1727594AbfCLSHU (ORCPT + 99 others); Tue, 12 Mar 2019 14:07:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:47272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727418AbfCLRMW (ORCPT ); Tue, 12 Mar 2019 13:12:22 -0400 Received: from localhost (unknown [104.133.8.98]) (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 A4DB42087C; Tue, 12 Mar 2019 17:12:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552410741; bh=wbVI6Cyh/9RZKLO6EtuEg1Dci9uuDyuQI+/CYGaLCSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uuo4JBkMogRQA25KYVwFs+4RB2cVMQL+Z5qeozbuswz+xkxkeMcqprFPsFDJp3MBy +HQY8t2N77cMfDjWAuSKXd+wut3pduEEMoORpxe+N8kJZLAEvdTGg4wpQJ6LkpZyuu 0ZWZi0XjxdXKhUKtuXXccdZ8kuznNLTjw5p2GoDM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoffer Dall , James Morse , Masami Hiramatsu , Will Deacon , Sasha Levin Subject: [PATCH 4.20 058/171] arm64: kprobe: Always blacklist the KVM world-switch code Date: Tue, 12 Mar 2019 10:07:18 -0700 Message-Id: <20190312170353.157585139@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190312170347.868927101@linuxfoundation.org> References: <20190312170347.868927101@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit f2b3d8566d81deaca31f4e3163def0bea7746e11 ] On systems with VHE the kernel and KVM's world-switch code run at the same exception level. Code that is only used on a VHE system does not need to be annotated as __hyp_text as it can reside anywhere in the kernel text. __hyp_text was also used to prevent kprobes from patching breakpoint instructions into this region, as this code runs at a different exception level. While this is no longer true with VHE, KVM still switches VBAR_EL1, meaning a kprobe's breakpoint executed in the world-switch code will cause a hyp-panic. Move the __hyp_text check in the kprobes blacklist so it applies on VHE systems too, to cover the common code and guest enter/exit assembly. Fixes: 888b3c8720e0 ("arm64: Treat all entry code as non-kprobe-able") Reviewed-by: Christoffer Dall Signed-off-by: James Morse Acked-by: Masami Hiramatsu Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/kernel/probes/kprobes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c index 2a5b338b2542..f17afb99890c 100644 --- a/arch/arm64/kernel/probes/kprobes.c +++ b/arch/arm64/kernel/probes/kprobes.c @@ -478,13 +478,13 @@ bool arch_within_kprobe_blacklist(unsigned long addr) addr < (unsigned long)__entry_text_end) || (addr >= (unsigned long)__idmap_text_start && addr < (unsigned long)__idmap_text_end) || + (addr >= (unsigned long)__hyp_text_start && + addr < (unsigned long)__hyp_text_end) || !!search_exception_tables(addr)) return true; if (!is_kernel_in_hyp_mode()) { - if ((addr >= (unsigned long)__hyp_text_start && - addr < (unsigned long)__hyp_text_end) || - (addr >= (unsigned long)__hyp_idmap_text_start && + if ((addr >= (unsigned long)__hyp_idmap_text_start && addr < (unsigned long)__hyp_idmap_text_end)) return true; } -- 2.19.1