From nobody Fri Jun 03 15:01:27 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 ABDF81B553E1 for ; Fri, 3 Jun 2022 15:01:28 +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 4LF5gX1nbWz3NlT for ; Fri, 3 Jun 2022 15:01:28 +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 1EABA30F5 for ; Fri, 3 Jun 2022 15:01:28 +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 253F1RbP017881 for ; Fri, 3 Jun 2022 15:01:27 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 253F1RT4017880 for virtualization@FreeBSD.org; Fri, 3 Jun 2022 15:01:27 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 264435] bhyve hda_write() can index (and jump) beyond end of array Date: Fri, 03 Jun 2022 15:01:27 +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=1654268488; 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=Hv2+7wi8yOEQnWMFuiEjORXHftm6DAovtkbh274MJko=; b=RcXioCvIN8FdVG1iz8cTz2Z5hY0lG8rOJJW1CA8J9E5e4vTSwn+dI2v0XC+93UEJ0uPW81 q9R4mo/De94E/BqwpWKPQ9mh+MvcYKrg47Yra65WQbmAjM0u+h2Rmlxd1iilnK42zqb5o6 CdOTcSdkfSz332qR1b3cLkBiakPWdweHnkSC6qi6Qz6jkC6PvPxayKhwrZ2V6gG7XYfmbv SxlupIYveAXnWiuWdoZHX+3WId0W4DoR4AG5zxtIGIBaxpxORDRMefWe5HXFfdN8ko3end /mzK2V61Z6syYDH889BfiSS1aSHn0SZN6Oj90iwX3TtaBxsVy6kYesfSTSFGXg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654268488; a=rsa-sha256; cv=none; b=lwEFwDJZJrWHTXq/pC4t8CuOupKwPFU3ypLBGYDazbRuNufS0byi3YyUG/ku/PEMw1dnfl FQCXRO1s/01p/ll47l9v4nD+mblJNkDVWz6uAvwYCC2CG+KzDTjrHlhqeWIF3f7WmfYLsI GCqUMClfBmjolcBxPv+GNJBL8x+bRREiOUF4JEMMBEjuzwYQAuvOsqRwsWz1BpIF/gVfc6 keweMwG+SRcQwrj+wF7vSMZoTXU2Q1sYeTdplOLgO8zM2PFAnPmiPbAQMMdln/j8eo8TQy get9YCHRfi5+nPAKEIefM2AsTWOGjVWNc641VaA7p+VEvPZuFLX+a0wb3LC0nw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264435 Bug ID: 264435 Summary: bhyve hda_write() can index (and jump) beyond end of array Product: Base System Version: Unspecified Hardware: amd64 OS: Any Status: New Severity: Affects Some People Priority: --- Component: bhyve Assignee: virtualization@FreeBSD.org Reporter: rtm@lcs.mit.edu In this from Bhyve's pci_hda.c: static int hda_write(struct hda_softc *sc, uint32_t offset, uint8_t size, uint32_t val= ue) { uint32_t old =3D hda_get_reg_by_offset(sc, offset); ...; hda_set_reg_handler set_reg_handler =3D hda_set_reg_table[offset]; ...; if (set_reg_handler) set_reg_handler(sc, offset, old); hda_set_reg_table[] has 385 entries. The guest gets to specify offset, and it can be up to 8580 (HDA_LAST_OFFSET, enforced in hda_get_reg_by_offset). So a malicious guest has a bunch of options for where the call to set_reg_handler() can end up. You can demo this by adding HDAC_WRITE_4(&sc->mem, 0x4a4, 0x0); at the start of hdac_reset() in /sys/dev/sound/pci/hda/hdac.c and booting the resulting guest kernel on Bhyve. --=20 You are receiving this mail because: You are the assignee for the bug.=