From nobody Sun Oct 23 18:51:16 2022 X-Original-To: dev-commits-src-main@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 4MwS383w0Tz4fyBP; Sun, 23 Oct 2022 18:51:16 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MwS383SLbz41gP; Sun, 23 Oct 2022 18:51:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666551076; 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=WlS0hYG3PzHnktjEzPbdd4G8C7h8DSEVvgHur/VMxFw=; b=LMxyjZSnXZuw7jYKocBLNLl3uxO3qWo5wHKmQ0F4EfIvV+KopIyRCHSyl0g6VjAS/HCUIU b+XDB7yqlpBnUSB7MJ/2Thd0Xx2d/7mvhFSoNtcU/lpVpdxKOdhE9ZooQc23w0HEUnmdyv VQ8ty9NnVVx+aFxxCHOBdhXAgGYVKBjA8G3WchtXCFLtPVryV1+/FviyC/TzCAOvVRV2AL 40ffWWlDbSaO0RDzCBuX/D7VzmqhhYEjLul4vl31Tt8luUhHpYRnGOSssve70qFA3aDjRA Rob/scqVCoeDNFYOB4hp2BADIx86oNEQTZU81wQx6SnZLahKi/48x56JijHRjA== 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 4MwS382WYFz102C; Sun, 23 Oct 2022 18:51:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29NIpG7N046974; Sun, 23 Oct 2022 18:51:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29NIpGbG046973; Sun, 23 Oct 2022 18:51:16 GMT (envelope-from git) Date: Sun, 23 Oct 2022 18:51:16 GMT Message-Id: <202210231851.29NIpGbG046973@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 3b5e5ce87bc8 - main - bhyve: Handle snapshots of unconfigured virtio-net devices List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b5e5ce87bc885f35100d77b31ac81d3f98342bf Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666551076; 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=WlS0hYG3PzHnktjEzPbdd4G8C7h8DSEVvgHur/VMxFw=; b=HoYE0pdF1JFvW72vXNBi3SL7R1apmZtkQodnm9KGMY8D6ro3SmfK0g7Zbe50go+IeDjp5r 5CdgbDK1t39SglTYtv6DpxDLeXAUgmX7fa42AKTLup5DnPaYshfZ3Z5v8GzrCn+UN0vvz1 IFhWjgLZiVsSKKBY+ba9n15numQXVae5r3KCWpN2mzlvfyfGjoYEWIrIqeg6vk6pKJ1Lz0 +FSxUSrgCA6XLb/LmgSlrn3xal19qcqgaT0t8M0vf8CLxg1oEfg9kggKhS5XKCSp+3jj+i Gh8hhULr/d5AfwtU63KWJ/2zlPYK2XTnZFUjfOyk9utSc+ED3+H7QfgCg0XyjA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666551076; a=rsa-sha256; cv=none; b=X7FkQjxJeWgnWOvN0qeHeq4vaowNtsmAG4j6fz4RElPjMajhQC61qyccowT6+u8kCf4jWD 6er4XTfMBMKCu/cTV0dx07bF25O4PUqBLjw+N5V/9mDSYWmORPY9V6FsJ+Zph64CDBLkOe ogoxESUghBuIcd9a5J/UE808+yDQtl5MJ7TKYa4psb27zsb2O+qCldeWR3Sa+0kY5yWKYE +XNDQKGr7wq3GuqIlaeO30Y+N9X89BVuOScloBOhaQ5vq5ImQkSrXet/8CvxurLbD3eHoa hzilLO25iXbgaY+K/EkXzx8XGhVQxpL3gKK8MWMW9NaNqmVTrJHwGyR0W8dRmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3b5e5ce87bc885f35100d77b31ac81d3f98342bf commit 3b5e5ce87bc885f35100d77b31ac81d3f98342bf Author: Vitaliy Gusev AuthorDate: 2022-10-23 18:47:56 +0000 Commit: Mark Johnston CommitDate: 2022-10-23 18:50:43 +0000 bhyve: Handle snapshots of unconfigured virtio-net devices In case of device reset or not configured - features_negotiated is not set, calling calling pci_vtnet_neg_features is wrong and resume gets "Segmentation fault". Reviewed by: markj Sponsored by: vStack MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D36244 --- usr.sbin/bhyve/pci_virtio_net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_virtio_net.c b/usr.sbin/bhyve/pci_virtio_net.c index 43e559b650c1..85fa09ca194b 100644 --- a/usr.sbin/bhyve/pci_virtio_net.c +++ b/usr.sbin/bhyve/pci_virtio_net.c @@ -786,9 +786,11 @@ pci_vtnet_snapshot(void *vsc, struct vm_snapshot_meta *meta) */ SNAPSHOT_VAR_OR_LEAVE(sc->vsc_features, meta, ret, done); + SNAPSHOT_VAR_OR_LEAVE(sc->features_negotiated, meta, ret, done); /* Force reapply negociated features at restore time */ - if (meta->op == VM_SNAPSHOT_RESTORE) { + if (meta->op == VM_SNAPSHOT_RESTORE && + sc->features_negotiated) { pci_vtnet_neg_features(sc, sc->vsc_features); netbe_rx_enable(sc->vsc_be); }