From nobody Tue May 31 13:42:17 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 E87741B465F7 for ; Tue, 31 May 2022 13:42:17 +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 4LCD3Y3RkXz3tlb for ; Tue, 31 May 2022 13:42:17 +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 56F564BAF for ; Tue, 31 May 2022 13:42:17 +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 24VDgHkW026286 for ; Tue, 31 May 2022 13:42:17 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 24VDgH4V026270 for virtualization@FreeBSD.org; Tue, 31 May 2022 13:42:17 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: virtualization@FreeBSD.org Subject: [Bug 264372] bhyve e82545_transmit() can use uninitialized iovb[] content Date: Tue, 31 May 2022 13:42:17 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bhyve X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: rtm@lcs.mit.edu X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: virtualization@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: 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=1654004537; 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=MLFZiiSDfvFM6vrcdmsiR1rDnWZ0WLD+h/zmhr56zxs=; b=hbgoKxfHQOynU9b03WOiykorQSOeg10opaa/mVU0FMOeoLuB4HcgPXmk2S2UN554ckzp3k C2iEjYeF7+NX/j+P3JCqso++f+0w+MqYWWx1UsCbtGleKS3PmNv6cqeVidCjmHHNsviwP/ gBC09XlGEdT7goGGXN76VdKQzOrqQiTw8ojuAfrIKyaRu6mgB9RuMWR7QwnwrnKuhRemGY aX45ZnIVRVHiccUSY2XoXyx+L15nX2aZegsgs1hIg7bVUik8/s8b/tLj2QnikU8sZlUJEL 8UbxqzWPfRWGYoA+Ej94uZ4c+Jum1U9LK1nk/VxpUXHYl7s8lvNHhiywZer7ow== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654004537; a=rsa-sha256; cv=none; b=Vmc+9M0nrIr//cSa47HtgCO/CDKbB9FKYsgIJfRaLVv5Qj3jdF9ozBOLCxzQGgyOc4C7fR BhicafCjsvZPCD7HIbx8CK0aOm1WuuNTpkKGqMAXSz7BuQN/qTKb8sspmgg9son0X3vYbV G5KmBO+mRwAisMqdcfmBeU1N/NziTL5Fdz821t+9sybaLdlw74lf7ttlHShCeon31j8c89 B9YguIybgZMpfYZP3DGnSWo9haWRRJEaGxS5a24j48QzPOyjmYUezOCTudra0h7r5RTM8E hyFSqsM1p5VB9s8puuLH4Kl/AiSJpOqRnDz0lxXquy8bHbdEtEOgtsiMGVZppg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264372 Bug ID: 264372 Summary: bhyve e82545_transmit() can use uninitialized iovb[] content Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bhyve Assignee: virtualization@FreeBSD.org Reporter: rtm@lcs.mit.edu A Bhyve guest can cause e82545_transmit() to follow a path in which iovb[] and thus *iov are not initialized, but the code executes memcpy(hdrp, iov->iov_base, now); The guest can do this by creating a transmit descriptor with the following content: buffer_addr =3D (anything) lower.data =3D 0x21f00000 =3D CMD_DEXT | TXD_MASK | CMD_EOP upper.data =3D 0x00000100 =3D POPTS_IXSM This causes the descriptor type to be 0x20f00000 (i.e. not TYP_L) and the data length to be zero. As a result of the zero length, iov->* are never assigned to. Because of the EOP and IXSM, ckinfo[0].ck* are set, causing hdrlen to be 2, which causes e82545_transmit() to execute the code to prepend a header, which causes the memcpy() shown above to execute. This sequence also depends on what's on the stack in iovb[] (i.e. *iov), but often when I run it, iov->iov_len is a huge number. Sometimes iov->iov_base is an illegal pointer, sometimes a valid pointer to somewhere. --=20 You are receiving this mail because: You are the assignee for the bug.=