From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D08B428E7; Tue, 7 Feb 2023 12:55:58 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7DCD0106F; Tue, 7 Feb 2023 04:56:40 -0800 (PST) Received: from [10.57.75.57] (unknown [10.57.75.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9E9DD3F71E; Tue, 7 Feb 2023 04:55:55 -0800 (PST) Message-ID: Date: Tue, 7 Feb 2023 12:55:54 +0000 Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [RFC PATCH 06/28] arm64: RME: ioctls to create and configure realms To: Jean-Philippe Brucker , Steven Price Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev References: <20230127112248.136810-1-suzuki.poulose@arm.com> <20230127112932.38045-1-steven.price@arm.com> <20230127112932.38045-7-steven.price@arm.com> From: Suzuki K Poulose In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 07/02/2023 12:25, Jean-Philippe Brucker wrote: > On Fri, Jan 27, 2023 at 11:29:10AM +0000, Steven Price wrote: >> +static int kvm_rme_config_realm(struct kvm *kvm, struct kvm_enable_cap *cap) >> +{ >> + struct kvm_cap_arm_rme_config_item cfg; >> + struct realm *realm = &kvm->arch.realm; >> + int r = 0; >> + >> + if (kvm_realm_state(kvm) != REALM_STATE_NONE) >> + return -EBUSY; > > This should also check kvm_is_realm() (otherwise we dereference a NULL > realm). Correct, I think this should be done way up in the stack at : kvm_vm_ioctl_enable_cap() for KVM_CAP_ARM_RME. > > I was wondering about fuzzing the API to find more of this kind of issue, > but don't know anything about it. Is there a recommended way to fuzz KVM? Not sure either. kselftests is one possible way to drive these test at least for unit-testing the new ABIs. This is something we plan to add. Thanks for catching this. Suzuki > Thanks, > Jean > 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 18518C636CC for ; Tue, 7 Feb 2023 12:56:57 +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:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=n+0J63+vXycBT3IBUZgoy63EUHiU5VNRBSUf8rF3VNE=; b=DvUvy0fc8HOhMH SLpcRBDK9KbqnHyKFKn3Q3nPbbhK6sJXP6JB6KlUOndoXhW8zVeeiug00XWH8bh3iIQfLSklNfWC4 jBq4gwhSzzgPsrSByl70IGggFqCCX5/eA4wkd8hx6ar1mrT/C3S/ZK31mWBod0qzIOkVy0dqDztbL CY6x00qFjOOz8pDOO3MZMzQDehGkuv1E9b/FqFJyXQpoXFEalCBHN0fWHjF6CFqRKKu6PvUCpZC6D X1KVlVGuSfEhNlstuLgUChvz9YI7j/ArIQNVlCxqHO6m61WpqMEHttneEAqQiIlG2jmiRzqnzL8j4 w6vQWAqDyAe+pUyn9uUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPNW1-00CAtf-In; Tue, 07 Feb 2023 12:56:05 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPNVy-00CAru-6r for linux-arm-kernel@lists.infradead.org; Tue, 07 Feb 2023 12:56:03 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7DCD0106F; Tue, 7 Feb 2023 04:56:40 -0800 (PST) Received: from [10.57.75.57] (unknown [10.57.75.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9E9DD3F71E; Tue, 7 Feb 2023 04:55:55 -0800 (PST) Message-ID: Date: Tue, 7 Feb 2023 12:55:54 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [RFC PATCH 06/28] arm64: RME: ioctls to create and configure realms To: Jean-Philippe Brucker , Steven Price Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev References: <20230127112248.136810-1-suzuki.poulose@arm.com> <20230127112932.38045-1-steven.price@arm.com> <20230127112932.38045-7-steven.price@arm.com> From: Suzuki K Poulose In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230207_045602_327106_A0A3CA6C X-CRM114-Status: GOOD ( 14.12 ) 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 07/02/2023 12:25, Jean-Philippe Brucker wrote: > On Fri, Jan 27, 2023 at 11:29:10AM +0000, Steven Price wrote: >> +static int kvm_rme_config_realm(struct kvm *kvm, struct kvm_enable_cap *cap) >> +{ >> + struct kvm_cap_arm_rme_config_item cfg; >> + struct realm *realm = &kvm->arch.realm; >> + int r = 0; >> + >> + if (kvm_realm_state(kvm) != REALM_STATE_NONE) >> + return -EBUSY; > > This should also check kvm_is_realm() (otherwise we dereference a NULL > realm). Correct, I think this should be done way up in the stack at : kvm_vm_ioctl_enable_cap() for KVM_CAP_ARM_RME. > > I was wondering about fuzzing the API to find more of this kind of issue, > but don't know anything about it. Is there a recommended way to fuzz KVM? Not sure either. kselftests is one possible way to drive these test at least for unit-testing the new ABIs. This is something we plan to add. Thanks for catching this. Suzuki > Thanks, > Jean > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel