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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28B9FC43334 for ; Fri, 17 Jun 2022 08:50:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 99BAE4B297; Fri, 17 Jun 2022 04:50:53 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pY4Rq8eIv6+B; Fri, 17 Jun 2022 04:50:52 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 599564B249; Fri, 17 Jun 2022 04:50:52 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 1B8054B1A2 for ; Fri, 17 Jun 2022 04:50:51 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 116Ymm2LmZUF for ; Fri, 17 Jun 2022 04:50:49 -0400 (EDT) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id B58B64B133 for ; Fri, 17 Jun 2022 04:50:49 -0400 (EDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2159CB827CB; Fri, 17 Jun 2022 08:50:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDFD8C3411B; Fri, 17 Jun 2022 08:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655455846; bh=c/802ysll8Uki8K7DNXXeYK+6Hshm0ZRzMFKDT/R5y0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=l34oNkGtiMK10v/6Eb56qZkXkJYA9qFULLpSaVeXUwh77j4GpjR8jNUa1rSyqA6Cs j9BhdySQZ6r1wg5g0HnThfGCOsSoA7lm+5/GlsOA6IKEV/bVhJnMjeKV69XHUasWup 52u5ShSQSjAbQJ8kF1oktqnmI0gmCmAZ9VA+Fbt80XTxNHYdqyAi2blnuObrMOWRRF mvazN7SxrJQLe1g7S6+pKVx5XW4qYoi3kzbXbfernlFx0/nVJprWzuSRMOC0z9CdEv 9bMq8/ek4bi2KSoiEbYSFConEq/8vXB67YSZ9fQGuc978KJGJkitHEgcyrCbzIPuwu UAu9QFZK3Le2Q== Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o27gi-001FiI-VG; Fri, 17 Jun 2022 09:50:45 +0100 MIME-Version: 1.0 Date: Fri, 17 Jun 2022 09:50:44 +0100 From: Marc Zyngier To: Quentin Perret Subject: Re: [PATCH] KVM: arm64: Prevent kmemleak from accessing pKVM memory In-Reply-To: References: <20220616161135.3997786-1-qperret@google.com> <165545408679.771055.5076080259874437048.b4-ty@kernel.org> User-Agent: Roundcube Webmail/1.4.13 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: qperret@google.com, rppt@kernel.org, suzuki.poulose@arm.com, alexandru.elisei@arm.com, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, james.morse@arm.com, will@kernel.org, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: kernel-team@android.com, Will Deacon , Catalin Marinas , linux-kernel@vger.kernel.org, Mike Rapoport , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On 2022-06-17 09:45, Quentin Perret wrote: > On Friday 17 Jun 2022 at 11:38:14 (+0300), Mike Rapoport wrote: >> On Fri, Jun 17, 2022 at 09:21:31AM +0100, Marc Zyngier wrote: >> > On Thu, 16 Jun 2022 16:11:34 +0000, Quentin Perret wrote: >> > > Commit a7259df76702 ("memblock: make memblock_find_in_range method >> > > private") changed the API using which memory is reserved for the pKVM >> > > hypervisor. However, it seems that memblock_phys_alloc() differs >> > > from the original API in terms of kmemleak semantics -- the old one >> > > excluded the reserved regions from kmemleak scans when the new one >> > > doesn't seem to. Unfortunately, when protected KVM is enabled, all >> > > kernel accesses to pKVM-private memory result in a fatal exception, >> > > which can now happen because of kmemleak scans: >> > > >> > > [...] >> > >> > Applied to fixes, thanks! >> > >> > [1/1] KVM: arm64: Prevent kmemleak from accessing pKVM memory >> > commit: 9e5afa8a537f742bccc2cd91bc0bef4b6483ee98 >> >> I'd really like to update the changelog to this: >> >> Commit a7259df76702 ("memblock: make memblock_find_in_range method >> private") changed the API using which memory is reserved for the pKVM >> hypervisor. However, memblock_phys_alloc() differs from the original >> API in >> terms of kmemleak semantics -- the old one didn't report the reserved >> regions to kmemleak while the new one does. Unfortunately, when >> protected >> KVM is enabled, all kernel accesses to pKVM-private memory result in a >> fatal exception, which can now happen because of kmemleak scans: >> >> $ echo scan > /sys/kernel/debug/kmemleak >> [ 34.991354] kvm [304]: nVHE hyp BUG at: [] >> __kvm_nvhe_handle_host_mem_abort+0x270/0x290! >> ... >> >> Fix this by explicitly excluding the hypervisor's memory pool from >> kmemleak like we already do for the hyp BSS. > > Looks good to me, thanks. Now updated. Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 48166CCA479 for ; Fri, 17 Jun 2022 08:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:Cc:To:From :Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3BoopRa2b7QsEF7s3JkM/pN4C2mb0m552vIbJH8bfHY=; b=UEnbJAQ6zAAfUHJ9oc0yq9sfqO gQFr2Xi7moNvFEuK9H6Z5O1g6Z98eRgw1b4vXsl1usUJO7Ik55onrlNfP3UlJVhyJ9gfODFEt04Ui 3HNKtb8RWy1VPDhsLXw25AL9sj0gg4TkmWgyCe7+3GNyf07+bEonZZlZ+nO68OifUO4p93MMGi9Ae 6VVBOx7DKSiAtsgl+cVs7RoO3t1vX/ICN3i1uviMwFlRdNby0jHGqJK6Mqy/BPltQwEJoYt6Z+NLq e6J9YlGAY6IxGbcdnvHQiMAGefkTG5brerlhlw0fq8u09xVMpjrqJDh6erf/U2czXcrEpgYlGDIoW QdX/CYwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o27lz-006Vrr-U9; Fri, 17 Jun 2022 08:56:12 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o27gn-006TN9-Dg for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 08:50:51 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2159CB827CB; Fri, 17 Jun 2022 08:50:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDFD8C3411B; Fri, 17 Jun 2022 08:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655455846; bh=c/802ysll8Uki8K7DNXXeYK+6Hshm0ZRzMFKDT/R5y0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=l34oNkGtiMK10v/6Eb56qZkXkJYA9qFULLpSaVeXUwh77j4GpjR8jNUa1rSyqA6Cs j9BhdySQZ6r1wg5g0HnThfGCOsSoA7lm+5/GlsOA6IKEV/bVhJnMjeKV69XHUasWup 52u5ShSQSjAbQJ8kF1oktqnmI0gmCmAZ9VA+Fbt80XTxNHYdqyAi2blnuObrMOWRRF mvazN7SxrJQLe1g7S6+pKVx5XW4qYoi3kzbXbfernlFx0/nVJprWzuSRMOC0z9CdEv 9bMq8/ek4bi2KSoiEbYSFConEq/8vXB67YSZ9fQGuc978KJGJkitHEgcyrCbzIPuwu UAu9QFZK3Le2Q== Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o27gi-001FiI-VG; Fri, 17 Jun 2022 09:50:45 +0100 MIME-Version: 1.0 Date: Fri, 17 Jun 2022 09:50:44 +0100 From: Marc Zyngier To: Quentin Perret Cc: Mike Rapoport , Suzuki K Poulose , Alexandru Elisei , linux-arm-kernel@lists.infradead.org, Catalin Marinas , kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, James Morse , Will Deacon , kernel-team@android.com Subject: Re: [PATCH] KVM: arm64: Prevent kmemleak from accessing pKVM memory In-Reply-To: References: <20220616161135.3997786-1-qperret@google.com> <165545408679.771055.5076080259874437048.b4-ty@kernel.org> User-Agent: Roundcube Webmail/1.4.13 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: qperret@google.com, rppt@kernel.org, suzuki.poulose@arm.com, alexandru.elisei@arm.com, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, james.morse@arm.com, will@kernel.org, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_015049_792990_5309DA69 X-CRM114-Status: GOOD ( 18.32 ) 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: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-06-17 09:45, Quentin Perret wrote: > On Friday 17 Jun 2022 at 11:38:14 (+0300), Mike Rapoport wrote: >> On Fri, Jun 17, 2022 at 09:21:31AM +0100, Marc Zyngier wrote: >> > On Thu, 16 Jun 2022 16:11:34 +0000, Quentin Perret wrote: >> > > Commit a7259df76702 ("memblock: make memblock_find_in_range method >> > > private") changed the API using which memory is reserved for the pKVM >> > > hypervisor. However, it seems that memblock_phys_alloc() differs >> > > from the original API in terms of kmemleak semantics -- the old one >> > > excluded the reserved regions from kmemleak scans when the new one >> > > doesn't seem to. Unfortunately, when protected KVM is enabled, all >> > > kernel accesses to pKVM-private memory result in a fatal exception, >> > > which can now happen because of kmemleak scans: >> > > >> > > [...] >> > >> > Applied to fixes, thanks! >> > >> > [1/1] KVM: arm64: Prevent kmemleak from accessing pKVM memory >> > commit: 9e5afa8a537f742bccc2cd91bc0bef4b6483ee98 >> >> I'd really like to update the changelog to this: >> >> Commit a7259df76702 ("memblock: make memblock_find_in_range method >> private") changed the API using which memory is reserved for the pKVM >> hypervisor. However, memblock_phys_alloc() differs from the original >> API in >> terms of kmemleak semantics -- the old one didn't report the reserved >> regions to kmemleak while the new one does. Unfortunately, when >> protected >> KVM is enabled, all kernel accesses to pKVM-private memory result in a >> fatal exception, which can now happen because of kmemleak scans: >> >> $ echo scan > /sys/kernel/debug/kmemleak >> [ 34.991354] kvm [304]: nVHE hyp BUG at: [] >> __kvm_nvhe_handle_host_mem_abort+0x270/0x290! >> ... >> >> Fix this by explicitly excluding the hypervisor's memory pool from >> kmemleak like we already do for the hyp BSS. > > Looks good to me, thanks. Now updated. Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74BDDC433EF for ; Fri, 17 Jun 2022 08:50:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381325AbiFQIuw (ORCPT ); Fri, 17 Jun 2022 04:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381316AbiFQIuu (ORCPT ); Fri, 17 Jun 2022 04:50:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C799D694B0 for ; Fri, 17 Jun 2022 01:50:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 34FF3B827CC for ; Fri, 17 Jun 2022 08:50:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDFD8C3411B; Fri, 17 Jun 2022 08:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655455846; bh=c/802ysll8Uki8K7DNXXeYK+6Hshm0ZRzMFKDT/R5y0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=l34oNkGtiMK10v/6Eb56qZkXkJYA9qFULLpSaVeXUwh77j4GpjR8jNUa1rSyqA6Cs j9BhdySQZ6r1wg5g0HnThfGCOsSoA7lm+5/GlsOA6IKEV/bVhJnMjeKV69XHUasWup 52u5ShSQSjAbQJ8kF1oktqnmI0gmCmAZ9VA+Fbt80XTxNHYdqyAi2blnuObrMOWRRF mvazN7SxrJQLe1g7S6+pKVx5XW4qYoi3kzbXbfernlFx0/nVJprWzuSRMOC0z9CdEv 9bMq8/ek4bi2KSoiEbYSFConEq/8vXB67YSZ9fQGuc978KJGJkitHEgcyrCbzIPuwu UAu9QFZK3Le2Q== Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o27gi-001FiI-VG; Fri, 17 Jun 2022 09:50:45 +0100 MIME-Version: 1.0 Date: Fri, 17 Jun 2022 09:50:44 +0100 From: Marc Zyngier To: Quentin Perret Cc: Mike Rapoport , Suzuki K Poulose , Alexandru Elisei , linux-arm-kernel@lists.infradead.org, Catalin Marinas , kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, James Morse , Will Deacon , kernel-team@android.com Subject: Re: [PATCH] KVM: arm64: Prevent kmemleak from accessing pKVM memory In-Reply-To: References: <20220616161135.3997786-1-qperret@google.com> <165545408679.771055.5076080259874437048.b4-ty@kernel.org> User-Agent: Roundcube Webmail/1.4.13 Message-ID: X-Sender: maz@kernel.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: qperret@google.com, rppt@kernel.org, suzuki.poulose@arm.com, alexandru.elisei@arm.com, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, james.morse@arm.com, will@kernel.org, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-06-17 09:45, Quentin Perret wrote: > On Friday 17 Jun 2022 at 11:38:14 (+0300), Mike Rapoport wrote: >> On Fri, Jun 17, 2022 at 09:21:31AM +0100, Marc Zyngier wrote: >> > On Thu, 16 Jun 2022 16:11:34 +0000, Quentin Perret wrote: >> > > Commit a7259df76702 ("memblock: make memblock_find_in_range method >> > > private") changed the API using which memory is reserved for the pKVM >> > > hypervisor. However, it seems that memblock_phys_alloc() differs >> > > from the original API in terms of kmemleak semantics -- the old one >> > > excluded the reserved regions from kmemleak scans when the new one >> > > doesn't seem to. Unfortunately, when protected KVM is enabled, all >> > > kernel accesses to pKVM-private memory result in a fatal exception, >> > > which can now happen because of kmemleak scans: >> > > >> > > [...] >> > >> > Applied to fixes, thanks! >> > >> > [1/1] KVM: arm64: Prevent kmemleak from accessing pKVM memory >> > commit: 9e5afa8a537f742bccc2cd91bc0bef4b6483ee98 >> >> I'd really like to update the changelog to this: >> >> Commit a7259df76702 ("memblock: make memblock_find_in_range method >> private") changed the API using which memory is reserved for the pKVM >> hypervisor. However, memblock_phys_alloc() differs from the original >> API in >> terms of kmemleak semantics -- the old one didn't report the reserved >> regions to kmemleak while the new one does. Unfortunately, when >> protected >> KVM is enabled, all kernel accesses to pKVM-private memory result in a >> fatal exception, which can now happen because of kmemleak scans: >> >> $ echo scan > /sys/kernel/debug/kmemleak >> [ 34.991354] kvm [304]: nVHE hyp BUG at: [] >> __kvm_nvhe_handle_host_mem_abort+0x270/0x290! >> ... >> >> Fix this by explicitly excluding the hypervisor's memory pool from >> kmemleak like we already do for the hyp BSS. > > Looks good to me, thanks. Now updated. Thanks, M. -- Jazz is not dead. It just smells funny...