git: kernel - Fix devfs bitmap races for pty and other devices

Matthew Dillon dillon at
Thu Aug 22 08:36:23 PDT 2019

commit 1991e949fd5daddb34cbf77ff2b492cd33ac0570
Author: Matthew Dillon <dillon at>
Date:   Thu Aug 22 08:31:29 2019 -0700

    kernel - Fix devfs bitmap races for pty and other devices
    * Use an internal lock to protect the integrity of bitmap
      operations for devfs_clone_bitmap_*() functions, allowing
      devices to use the functions without having to lock themselves.
    * Devices which use devfs_clone_bitmap_chk() + devfs_clone_bitmap_set()
      sequences have to be more careful, either having their own covering
      lock or checking the return code from devfs_clone_bitmap_set() and
    * This fixes serious /dev/ptmx pty allocation races which become obvious
      when pty's are allocated concurrently at a high rate, such as by the
      dsynth code.

Summary of changes:
 sys/dev/disk/vn/vn.c         | 18 ++++++++----
 sys/dev/misc/snp/snp.c       | 10 +++++--
 sys/net/bpf.c                |  7 +++--
 sys/sys/devfs.h              |  2 +-
 sys/vfs/devfs/devfs_helper.c | 65 +++++++++++++++++++++++++++++++++++---------
 5 files changed, 78 insertions(+), 24 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list