Page MenuHomeFreeBSD

hv_kvp: Fix some bugs and nits
Needs ReviewPublic

Authored by markj on Mon, Oct 5, 10:06 PM.
Tags
None
Referenced Files
F175320919: D60387.diff
Fri, Oct 9, 10:55 PM
Unknown Object (File)
Fri, Oct 9, 3:41 AM
Unknown Object (File)
Fri, Oct 9, 3:38 AM
Unknown Object (File)
Fri, Oct 9, 1:33 AM
Unknown Object (File)
Wed, Oct 7, 7:06 AM
Unknown Object (File)
Wed, Oct 7, 6:38 AM
Unknown Object (File)
Tue, Oct 6, 8:17 AM
Unknown Object (File)
Tue, Oct 6, 2:43 AM
Subscribers

Details

Reviewers
whu
Group Reviewers
secteam
Summary
  • Use pending_mutex to synchronize several state flags. In particular, ensure that two threads can't race to open the device file at the same time.[1]
  • Fix an off-by-one in hv_kvp_dev_daemon_read() that would result in a one-byte OOB read if the caller supplied a large enough read buffer.[2]
  • Change the device permissions to 0600: hv_kvp_dev_daemon_read() returns an error until the owning process registers itself with a write, so there's no sense in providing read-only access.
  • Use bool instead of boolean_t.
  • Don't return negative error numbers to userspace.
  • Call seldrain() when closing the device.

Reported by: pixelpop [1][2]

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77743
Build 74626: arc lint + arc unit