From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 11C6DCF6D3B for ; Wed, 2 Oct 2024 15:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wEAc2RAWQRgyOGkrtK+hXeUGOKjWMXazGBlHNjqjAxY=; b=lrqxg17uCT8weRniSpXbcAZdHh 4IGbKbJK/XJmhdFS8yi9MdB1YONZxBUxuSvEEf0GhZY6+zxaTymkZLQsxhwNry8fopGMLG+WBnFc0 1Cve68CZbesxBXxqeiYi0W9VaWeNkD+hyYnoFDmUzP9CbPwG8zwJyl1dKwXUyfRXrs39newItJ6FT ckqeaApJusBpF/RQP8Q5D6G0vpJ29sSLnSjIKW6QZsGVVo1YEnrv6n1XMV5jp4ljjt+PeEoFuoBCU BOcNepZwpnP5x9vtCkrEuV0XwB6AdvUyZ9A3x79slqwaI2qa2BCVVa/NlF5YmaOXtAH2z/xrAyrNF StxJ61aQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sw1Yt-00000006l6j-3JHK; Wed, 02 Oct 2024 15:46:47 +0000 Received: from out-179.mta1.migadu.com ([2001:41d0:203:375::b3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sw1XG-00000006kJY-3Qow for linux-arm-kernel@lists.infradead.org; Wed, 02 Oct 2024 15:45:18 +0000 Date: Wed, 2 Oct 2024 15:44:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1727883901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wEAc2RAWQRgyOGkrtK+hXeUGOKjWMXazGBlHNjqjAxY=; b=q8bSSi2P8Cw0ujL9ST61nvd/gqIWijgFSbaaZ0INnXV/5HM8EP0m0sHcjlHxdpCWefrmaq W/MfEY8alBRwsV7PMVEECMiCOYhMp5qbXshOkbrcAbTQnbPo2APWPzE173u8A1mByCfZMx MhnJ9IvBERVDfSkv+67X2Ldhmi9HdnE= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: James Clark Cc: kvmarm@lists.linux.dev, "linux-arm-kernel@lists.infradead.org" , will@kernel.org, tabba@google.com, maz@kernel.org Subject: Re: [bug report] KVM: arm64: BUG when reading kcore with kvm-arm.mode=protected Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241002_084507_422918_2F590FFD X-CRM114-Status: GOOD ( 12.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org +cc relevant folks Hi James, On Wed, Oct 02, 2024 at 02:23:32PM +0100, James Clark wrote: > Hi, > > I noticed this when running the Perf tests so I'm reporting it here (I don't > actually need kcore FWIW). I tested from 6.1 to 6.11 with the same results: Yeah, this is (somewhat) intended behavior. By reading kcore you wind up reading from memory that isn't in a visible state for the host (e.g. hyp text). Protected mode is very much a WIP, and is expected to be rough around the edges like this. Eventually the hypervisor will inject an abort into the host for disallowed memory accesses instead of tripping a BUG_ON(). We don't have that upstream right now. > # On the host: > $ cat /proc/cmdline > > BOOT_IMAGE=/boot/vmlinuz-6.11.0-rc6+ > root=UUID=090f43e8-dbb2-48e4-a9e2-efd6291fb21f ro earlycon=pl011,0x2A400000 > kpti=off vfio-pci.ids=10ee:9038 kvm-arm.mode=protected > > $ sudo dd if=/proc/kcore of=/dev/null > > # Wait a few seconds > > kvm [732]: nVHE hyp BUG at: arch/arm64/kvm/hyp/nvhe/mem_protect.c:540! > kvm [732]: nVHE call trace: > kvm [732]: [] __kvm_nvhe_$x.158+0x44/0x80 > kvm [732]: [] __kvm_nvhe_$x.90+0x34/0x124 > kvm [732]: [] __kvm_nvhe_$x.1+0x4c/0x84 > kvm [732]: [] __kvm_nvhe_$x.0+0x64/0x64 > kvm [732]: ---[ end nVHE call trace ]--- > kvm [732]: Hyp Offset: 0xfffeffff97e00000 > Kernel panic - not syncing: HYP panic: > PS:a04003c9 PC:00008000712c89c8 ESR:00000000f2000800 > FAR:ffff0000712bf000 HPFAR:0000000000f12bf0 PAR:0000000000000800 > VCPU:0000000000000000 > CPU: 1 PID: 732 Comm: dd Not tainted 6.4.0+ #54 > Call trace: > dump_backtrace+0x100/0x158 > show_stack+0x24/0x40 > dump_stack_lvl+0x60/0x80 > dump_stack+0x18/0x28 > panic+0x148/0x360 > nvhe_hyp_panic_handler+0x110/0x1a0 > _copy_to_iter+0xd8/0x520 > read_kcore_iter+0x54c/0x768 > proc_reg_read_iter+0xa0/0x118 > vfs_read+0x1b4/0x290 > ksys_read+0x80/0xf8 > __arm64_sys_read+0x28/0x40 > invoke_syscall+0x4c/0x120 > el0_svc_common+0xd0/0x120 > do_el0_svc+0x3c/0xb8 > el0_svc+0x44/0xb0 > el0t_64_sync_handler+0x84/0xf0 > el0t_64_sync+0x190/0x198 > SMP: stopping secondary CPUs > Kernel Offset: disabled > CPU features: 0x000000,4040180c,6400720b > Memory Limit: none > pstore: backend (efi_pstore) writing error (-5) > ---[ end Kernel panic - not syncing: HYP panic: > PS:a04003c9 PC:00008000712c89c8 ESR:00000000f2000800 > FAR:ffff0000712bf000 HPFAR:0000000000f12bf0 PAR:0000000000000800 > VCPU:0000000000000000 ]--- > > > -- Thanks, Oliver