From nobody Sun Jul 07 11:41:44 2024 X-Original-To: dev-commits-src-all@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 4WH5202Tydz5PDpL; Sun, 07 Jul 2024 11:41:44 +0000 (UTC) (envelope-from git@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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WH52023VQz4Wmm; Sun, 7 Jul 2024 11:41:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720352504; 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; bh=MvcH2+FtdLtzB9SJ/w39BQhYYRNSZA3hK1rGOQmHLZI=; b=fW9DHy0IF298BYjaRy14ZGItPgz09EPCyvUQLT4VxdiReiCYBkb1XsZejPacc/LK8rYW1b oLBfkwdRfys3oNRgGQzBxVeBsxHm3XVlml512zwicXw9603+IMshNQBzVp4mC7NjCS7RfG zwHL9GLhBGLTLtb+9QhrPm2uwC8Pt1Icv9j1PFp4fzdYjnJkNkT6tbnfNxPm2Tyt2r2kwS OBTYKLaELGK+Fm/H24JOXYRWCPj5UH6HN6iSoihnWSdxqhRn/b+W04UU19cun9MyFmCpLK g1USm4jniLpo44lvZULhfP8wfAwM699A8gKEDYgjgfEtubEx0GdhNug+XZGebQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720352504; a=rsa-sha256; cv=none; b=pySIiRUd0Cs52KQ9TgDoastn8am5yCrW48eRC0wKuVjwZQbDpTvumcK581PzOCikb1GWKC XjcC38gcAuNVbsUcXaJUR4TQ/TD7yWLJ/lAd4texHjER851/a74wzUKrglVdillUKlI5W4 3BzvTgyojJ2v44UiNUEK4Q2/oJUbqgJJQ9bYP/PNam5z4RviSx++iVE/7Nd1YhzzUHrX7C UrYC/PJhT0Q7YqQvuoKIU/9oUbGHTsaj0CjJ3ruimFLBwQ4qAlKvq5fHnGooeaVAk+vulg fpVBYU+j51eNGhj8YC0J3uz4hmG0HS9SldKjsK9EhxSzo0TClRxSuRPmfqjdNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720352504; 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; bh=MvcH2+FtdLtzB9SJ/w39BQhYYRNSZA3hK1rGOQmHLZI=; b=XlBkgIwg52fgubv0xfm8tdBpon1pH2HbO8+qAw2unjnMFMyiFFlRtACFOV20fpYcAB7Awf dzTqNq1AfX8r0Nfia6Q/HW9Ub9ISsKS7cxgh54edR1EwO5jiE8H+tLj6Kem67jE4oluwqa Owi2moK/GeTsUj9uFKPK6eaXVgnLydKKDF4CAgCgvsMmKf0fn/GdxkNWsUK8pjLs9yiV0Y VyetYFl06GByH0oTtqY4tlBYVPeCfaZd4r51yITPSp/2Vq1EVEDJiNHdeDUbtviii3n+GV kFjobsCKdyuAJxwQAunA5AXJfdIziPVakRLjjYLgjq855EaZ/Uod21vZ6L8FnA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4WH5201ggdz1Llx; Sun, 7 Jul 2024 11:41:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 467Bfio6052338; Sun, 7 Jul 2024 11:41:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 467BfiP5052335; Sun, 7 Jul 2024 11:41:44 GMT (envelope-from git) Date: Sun, 7 Jul 2024 11:41:44 GMT Message-Id: <202407071141.467BfiP5052335@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 814bf1fddd27 - main - virtio_p9fs: fix panic on qemu/kvm List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 814bf1fddd27aea69740f9e7426302354285cad4 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=814bf1fddd27aea69740f9e7426302354285cad4 commit 814bf1fddd27aea69740f9e7426302354285cad4 Author: Danilo Egea Gondolfo AuthorDate: 2024-07-06 16:51:51 +0000 Commit: Warner Losh CommitDate: 2024-07-07 11:39:27 +0000 virtio_p9fs: fix panic on qemu/kvm When the module is loaded on a system running on qemu/kvm the "modern" virtio infrastructure is used and virtio_read_device_config() will end up calling vtpci_modern_read_dev_config(). This function cannot read values of arbitrary sizes and will panic if the p9fs mount tag size is not supported by it. Use virtio_read_device_config_array() instead. It was tested on both bhyve and qemu/kvm. PR: 280098 Co-authored-by: Mark Peek Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1320 --- sys/dev/virtio/p9fs/virtio_p9fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index aa174d3bd5ba..3600e0ea09c9 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -352,9 +352,9 @@ vt9p_attach(device_t dev) mount_tag = malloc(mount_tag_len + 1, M_P9FS_MNTTAG, M_WAITOK | M_ZERO); - virtio_read_device_config(dev, + virtio_read_device_config_array(dev, offsetof(struct virtio_9pnet_config, mount_tag), - mount_tag, mount_tag_len); + mount_tag, 1, mount_tag_len); device_printf(dev, "Mount tag: %s\n", mount_tag);