From patchwork Thu Jan 24 16:32:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Morse X-Patchwork-Id: 10779489 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 17AF013B5 for ; Thu, 24 Jan 2019 16:33:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0244931B07 for ; Thu, 24 Jan 2019 16:33:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EAAF731AA8; Thu, 24 Jan 2019 16:33:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2CDA531B04 for ; Thu, 24 Jan 2019 16:33:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=R0yAO4YWpT2T6CtHqza93ih666N437Y73tcwv2jLmh0=; b=AwXcwda4G+Zz42 KAVsgymmC8SI32khXKmpLkTV8s/+7xn4mxXzvGV5YeF+ew27oVK5ZZYal37FjEdLzuL09jp3bCeKg mm/YWq7/OLG0F2OWzZ9dt1Jp1rmnRQkjBqKjI9AqxDSs0KKDMdwdZZn0t+igJt3DhK4MCIt2if7tP 6yS9capFZBDJwsZ17YosMzUv9PoDDEihOHlgv/14pPdC6e4o5ux6SwW08mz5Fwg1IkC0ErR9dyq30 +Edn0m3k9StCPtOAIyMm+vBFxfeQTf4RCevRfdF/TPuBvK5OcF4qHrF6jIpYOKy++4yIPZs0GYF3Y 9hXEE9uTnQ9v51XqykYw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gmhwL-0005xJ-2l; Thu, 24 Jan 2019 16:33:17 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gmhwI-0005ww-9P for linux-arm-kernel@lists.infradead.org; Thu, 24 Jan 2019 16:33:15 +0000 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 6F60FA78; Thu, 24 Jan 2019 08:33:13 -0800 (PST) Received: from eglon.cambridge.arm.com (eglon.cambridge.arm.com [10.1.196.105]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E8D133F237; Thu, 24 Jan 2019 08:33:11 -0800 (PST) From: James Morse To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 0/4] Fix some KVM/HYP interactions with kprobes Date: Thu, 24 Jan 2019 16:32:53 +0000 Message-Id: <20190124163257.233929-1-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190124_083314_333285_EF17EBFE X-CRM114-Status: GOOD ( 14.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Catalin Marinas , Will Deacon , Christoffer Dall , james.morse@arm.com, Masami Hiramatsu , kvmarm@lists.cs.columbia.edu Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi guys, When looking at Masami Hiramatsu's kprobe cleanup series, it occurred to me the 'no KVM' isn't just about the EL1/EL2 split on non-VHE systems, but whether KVM is prepared to handle stepping on a breakpoint. It's not. This labels all the VHE-only KVM functions that run during world switch with NOKPROBE_SYMBOL(), and always blacklists __hyp_text for kprobes to cover the common guest entry/exit code. I anticipate patch 1 going via the KVM tree to avoid conflicts. Patch 2 will conflict with [0]. I'm not sure what the best thing to do with the hyp-stub is. Patch 3 moves it to __hyp_text, and patch 4 covers the hibernate fallout from doing that. We don't have any other mmu-off but not idmap'd text. Probing the hyp-stub has to be done by address as the symbol names alias those in the __entry_text, which is blacklisted. (although this might depend on link order). I think anyone doing this is trying to shoot themselves in the foot. Know issues: * Other regions we should blacklist are the kexec and hibernate 'copy everything' code, as the vectors may have been overwritten by the time we step on the probe. cpu-suspend needs investigating... Thanks, James [0] lore.kernel.org/r/154753341900.31541.8135985235882849464.stgit@devbox James Morse (4): KVM: arm64: Forbid kprobing of the VHE world-switch code arm64: kprobe: Always blacklist the KVM world-switch code arm64: hyp-stub: Forbid kprobing of the hyp-stub arm64: hibernate: Clean the __hyp_text to PoC after resume arch/arm64/kernel/hibernate.c | 4 +++- arch/arm64/kernel/hyp-stub.S | 2 ++ arch/arm64/kernel/probes/kprobes.c | 6 +++--- arch/arm64/kvm/hyp/switch.c | 5 +++++ arch/arm64/kvm/hyp/sysreg-sr.c | 5 +++++ 5 files changed, 18 insertions(+), 4 deletions(-)