pfsync: fix incorrect unlock during destroy
During pfsync_clone_destroy() we clean up pending packets. This
may involve calling pfsync_undefer() or callout_drain(). We may not
hold the bucket lock during callout_drain(), but must hold it during
pfsync_undefer().
We incorrectly always released the lock, leading to assertion failures
during cleanup if there were pending deferred packets.
MFC after: 1 week
Sponsored by: Orange Business Services
pfctl: restore '-Tload -f pf.conf' functionality
Allow only tables to be loaded from a file, rather than everything (i.e.
including options, rules).
Add a test case for this.
PR: 291318
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
pf: use correct sized variables in pf_change_icmp()
We're updating 16-bits checksums here, so should use a 16-bit integer,
not a 32-bit one.
No functional change.
Sponsored by: Rubicon Communications, LLC ("Netgate")
ctfmerge: fix segfault when building on macOS
The barrier code was using semaphores which have been deprecated in
macOS and not working at all, causing a race condition. Since macOS
does not have pthread_barrier_*(), this change uses a condition
variable instead.
PR: 290958
Reported by: wosch
MFC after: 2 weeks
Reviewed by: imp, markj
Differential Revision: https://reviews.freebsd.org/D54018
hid: Make game controllers accessible to members of the game group
Their events have to be accessible by unprivileged users via e.g. libsdl.
MFC after: 1 month
psm: Fix three finger tap on elantech v4 touchpads
Fix an issue where a three finger tap would generate additional events
when fingers moved slightly during the tap.
Signed-off-by: Robert Wahlberg <freebsd at robertwahlberg.se>
Pull Request: https://github.com/freebsd/freebsd-src/pull/1792
Reviewed by: wulf
MFC after: 1 month
evdev: Allow setting of character device ownership and access mode
by device driver. That is required as game pad and joystick events have
to be accessible by ordinary users.
MFC after: 1 month
kexec: Change shutdown handler priority
The kexec shutdown handler should run after everything else, but before
the other platform shutdown handlers. With (SHUTDOWN_PRI_DEFAULT - 150)
priority it would run before anything else, including all the device
shutdown handlers. Change to (SHUTDOWN_PRI_LAST - 150) where it
belongs.
Sponsored by: Hewlett Packard Enterprise
ng_device: enable setting the device to non-blocking mode
Return success when FIONBIO or FIOASYNC ioctl are received in order to support
being set to non-blocking through fcntl(2). We return an error on FIOASYNC with
non-zero data argument since we do not support O_ASYNC.
Signed-off-by: Quentin Thébault <quentin.thebault at defenso.fr>
Reviewed by: imp, jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1827
(cherry picked from commit 9fadaee7ecce02ab11cfbb18ea63b9bf1fb11bfc)
krb5: Use sh to run mk_cmds
Otherwise etcupdate apparently can fail if its private object directory
under /var/db is in a filesystem mounted noexec. We shouldn't be
building this target at all, but for now, just apply this workaround.
PR: 291043
Reviewed by: ivy, cy, des
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D53861
(cherry picked from commit 673924122470463dfb9089e12b1b4496783a77b8)
file: Add a fdclose method
Consider a program that creates a unix socket pair, transmits both
sockets from one to the other using an SCM_RIGHTS message, and then
closes both sockets without externalizing the message. unp_gc() is
supposed to handle cleanup, but it is only triggered by uipc_detach(),
which runs when a unix socket is destroyed. Because the two sockets are
internalized, their refcounts are positive, so uipc_detach() isn't
called.
As a result, a userspace program can create an unbounded amount of
garbage without triggering reclaim. Let's trigger garbage collection
whenever a unix socket is close()d. To implement this, add new a
fdclose file op and protocol op, and implement them accordingly. Since
mqueuefs has a hack to hook into the file close path, convert it to use
the new op as well.
Now, userspace can't create garbage without triggering reclamation.
[5 lines not shown]
gdb: Fix some PEP 8 violations
Silence some warnings in my editor. No functional change intended.
MFC after: 1 week
(cherry picked from commit 32605b159f3fea3a5d4710055681650f3de9ea68)
ng_device: replace dependency on vnode.h with fcntl.h
Update to current convention of using fcntl.h O_* flags instead of vnode.h IO_*
ones, as explained in sys/fs/devfs/devfs_vnops.c.
Signed-off-by: Quentin Thébault <quentin.thebault at defenso.fr>
Reviewed by: imp, jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1827
(cherry picked from commit 593d432e5852a254eeef83a8b1762492bb08668e)
linker: Avoid invoking eventhandlers on incompletely loaded files
We do not invoke the kld_load eventhandler until after the file is fully
linked, so don't invoke the kld_unload_try or kld_unload event handlers
unless the file is fully linked either.
In my case, the dtrace SDT kld_unload_try handler was running before
relocations were processed against the file, and that caused problems
when sdt_kld_unload_probes() accesses elements of a linker set.
Move the kld_unload handler invocation earlier, to after sysuninits have
been run. This is a bit more consistent with the kld_load handler.
PR: 291238
Reviewed by: imp, emaste, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D53938
libc: Fix TESTSDIR for new stdbit tests
Otherwise the directory created by etc/mtree/BSD.tests.dist, which is
where these belong, and referred to by the generated Kyuafile for
/usr/tests/lib/libc (via stdbit's existence in TESTS_SUBDIRS), ends up
empty with no Kyuafile, which is an error for kyua.
Reported by: kp
Fixes: 2fb8cbc6ef1b ("libc/tests: add stdbit test framework and unit tests")