From nobody Sat Aug 13 19:19:40 2022 X-Original-To: virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M4r2h6kSZz4YghV for ; Sat, 13 Aug 2022 19:19:40 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M4r2h5YTyz3qqy for ; Sat, 13 Aug 2022 19:19:40 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M4r2h4Y8qzMSN for ; Sat, 13 Aug 2022 19:19:40 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 27DJJehS032805 for ; Sat, 13 Aug 2022 19:19:40 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 27DJJe5e032804 for virtualization@FreeBSD.org; Sat, 13 Aug 2022 19:19:40 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: virtualization@FreeBSD.org Subject: [Bug 264177] bhyve: Guest can cause a crash in bhyve nvme emulation Date: Sat, 13 Aug 2022 19:19:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bhyve X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: needs-qa X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: chuck@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? maintainer-feedback+ mfc-stable13? mfc-stable12? X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660418380; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZAT1SO5dNARWSpmVmi9WIvxHDd6JNx+fp6Cv4oqpd94=; b=u3WsZR0t+GyyLv5VFOFgid0pILiy1xjqUV1yBor56LWMJy7hOtd2LnxZo1svIAuYA7LctM SV/sowagYl3vjxUVsEECMT/S5Ltr4Ef1oeD9zuBG2g35YFbrLgpXdMsZBnof2pyagvKVhC brkinHTYS3qxisEXd8tNjBOxLBcSFRV5Z+0S1IVczB7rWWAFkSZJ9/ut+32YkSql9XVkGA qgJsno21J8eKe+W4Tpe3wCM998avZyqW/a1vLDE9uRHEoOLVOCe8YcEAg5rIaSGzKLpFO2 /eWBKtX+MHu9gpxTiGNgmgqmcizDYvDldfR8rtQSe89n5Rmr7rxYMMgqpCNNOQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660418380; a=rsa-sha256; cv=none; b=OrSgxmTDSHDhiBZubSQdKnNvLd/6HnGPqS8zEY9PfVCPOSY9kPq7T+K/uZnHJyZRGaVu9c FAl25H/plOROG189HYHpCneBGcdLAKleMib7OrRjSgQQRMi5RvY9c+lnvrnBCMnzeCQOUL 1diPnDcFkYhetacVFO4UuqE/bgvAPIUzTz7XyKrbWNA7s4NZGNI2peV2SzGO4/1XLXrfPI 3nMKa0FUm/mbUiiqbPFrN2TZaQ8FIBZgBH1AQbhgD0Qun968U4ROMAWNyE/PmYyojNSuHM +mxq5HRniLEtkKkJ6MGYSpTfD0hm5SOt1za/efHKFFniKrbY+hIj9CBp8Hxwhg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264177 --- Comment #5 from commit-hook@FreeBSD.org --- A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D88951aaaee73b87121b0f121224fe188a= 5b5e6e3 commit 88951aaaee73b87121b0f121224fe188a5b5e6e3 Author: Chuck Tuffli AuthorDate: 2022-06-09 18:19:32 +0000 Commit: Chuck Tuffli CommitDate: 2022-08-13 19:16:02 +0000 bhyve nvme: Fix out-of-bound IOV array access Summary: NVMe operations indicate the memory region(s) associated with a command via physical region pages (PRPs). Since each PRP has a fixed size, contiguous memory regions larger than the PRP size require multiple PRP entries. Instead of issuing a blockif call for each PRP, the NVMe emulation concatenates multiple contiguous PRP entries into a single blockif request. The test for contiguous regions has a bug such that it mistakenly treats an initial PRP address of zero as a contiguous range and concatenates it with the previous. But because there is no previous IOV, the concatenation code corrupts the IO request structure and leads to a segmentation fault when the blockif request completes. Fix is to test for the existence of a previous range before trying to concatenate the current range with the previous one. While in the area, rename pci_nvme_append_iov_req()'s lba parameter to offset to match its usage. PR: 264177 Reported by: Robert Morris Reviewed by: jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35328 usr.sbin/bhyve/pci_nvme.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) --=20 You are receiving this mail because: You are on the CC list for the bug.=