Bug 233038 - bhyve: fails with "device emulation initialization error: Bad file descriptor"
Summary: bhyve: fails with "device emulation initialization error: Bad file descriptor"
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs mailing list
Depends on:
Reported: 2018-11-06 19:21 UTC by Wes Maag
Modified: 2019-07-11 19:41 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Wes Maag 2018-11-06 19:21:28 UTC
After updating to r340179+755e0ab1085 I was unable to start my windows vm with a fbuf device. e.g -s 7,fbuf,tcp=,w=1024,h=768


getaddrinfo: hostname nor servname provided, or not known
device emulation initialization error: Bad file descriptor

after doing a little debugging; It looks as though bhyve is passing in freed pointers in the arguments to to rfb_init due to the change in base r340044

removing the added free in pci_fbuf.c, fixed the issue for me.
Comment 1 Wes Maag 2018-11-06 19:24:15 UTC
(In reply to Wes Maag from comment #0)

Hm, looks as though my revision was off by one should be base r340045
Comment 2 Mark Johnston freebsd_committer 2018-11-06 22:37:53 UTC
Indeed, r340045 is bogus.  Either the assignments to rfb_host and rfb_password should be strdup()ing the value, or the commit should simply be reverted.
Comment 3 commit-hook freebsd_committer 2018-11-07 04:20:46 UTC
A commit references this bug:

Author: araujo
Date: Wed Nov  7 04:20:29 UTC 2018
New revision: 340210
URL: https://svnweb.freebsd.org/changeset/base/340210

  Revert my bogus attempt to silence coverity on r340045, it created
  more bad side effects than good.

  PR:		233038
  Submitted by:	We Maag <jwmaag@gmail.com>

Comment 4 Marcelo Araujo freebsd_committer 2018-11-07 04:22:01 UTC
Thank you all and sorry the breakage!!! I have reverted the commit till I figure out a better way to fix the Coverity issue.

Comment 5 commit-hook freebsd_committer 2019-07-11 19:41:24 UTC
A commit references this bug:

Author: seanc
Date: Thu Jul 11 19:41:15 UTC 2019
New revision: 349918
URL: https://svnweb.freebsd.org/changeset/base/349918

  usr.sbin/bhyve: free leaked memory during option parsing

  Also update to use strsep(3) instead of strtok(3).

  Most of this commit inadvertently ended up in r349914.

  Coverity CID:	1357337
  Approved by:	markj
  PR:		233038
  Differential Revision:	https://reviews.freebsd.org/D20918