ctl: Fix CTL GET EVENT STATUS NOTIFICATION valid bits
Linux as an initiator periodically sends the following to SCSI cdrom
devices: 4a 01 00 00 10 00 00 00 08 00
According to the ctl_cmd_entry for this command this is invalid which
leads to a lot of failed SCSI commands.
The mask in this commit is based off of an early draft of the mmc
standard, https://www.t10.org/ftp/t10/document.97/97-108r0.pdf,
as well as subsequent standards (mmc2 through mmc6).
This solves the issue with Linux initiators.
Signed-off-by: HP van Braam <hp at tmm.cx>
Reviewed by: imp, mav
Pull Request: https://github.com/freebsd/freebsd-src/pull/1201
libpfctl: allow access to the fd
pfctl_open() opens both /dev/pf and a netlink socket. Allow access to the /dev/
pf fd via pfctl_fd().
This means that libpfctl users no longer have to open /dev/pf themselves for any
calls that are not yet available in libpfctl.
Sponsored by: Rubicon Communications, LLC ("Netgate")
MFC after: 2 weeks
libpfctl: fix incorrect pcounters array size
The array is 2 x 2 x 2, not 2 x 2 x 3.
Sponsored by: Rubicon Communications, LLC ("Netgate")
MFC after: 2 weeks
pf: convert DIOCGETSTATUS to netlink
Introduce pfctl_get_status_h() because we need the pfctl_handle. In this variant
use netlink to obtain the information.
Sponsored by: Rubicon Communications, LLC ("Netgate")
package: fix dependency generation
A bug in release/packages/generate-ucl.sh causes package dependencies
(other than shlib depends) to not be generated correctly, meaning
packages are missing their dependencies.
generate-ucl.sh creates the UCL file by:
1. copying ${uclsource} (template.ucl) to ${uclfile}
2. appending dependencies to ${uclfile}
3. calling generate-ucl.lua on ${uclsource} to create ${uclfile}
This breaks because the dependencies added in step 2 are overwritten in
step 3.
Fix this by calling generate-ucl.lua with ${uclfile} as both the input
and output file, so anything we added to ${uclfile} is preserved.
Reviewed by: des, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1203
Add libxo support to du
Convert du to use libxo enabling structured output.
[[ minor style fixes by imp ]]
Signed-off-by: Nathan Huff <nhuff at acm.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1145
services.5: describe better
Use a more specific description for this man page, and add SDPX tag
while here.
Reviewed by: imp, meena
Signed-off-by: Alexander Ziaee <concussious at runbox.com>
Pull Request: https://github.com/freebsd/freebsd-src/pull/1194
arm64/vmm: Handle VM_EXITCODE_SUSPENDED
This is required for bhyve reboot to work. In particular, unless we
suspend vcpu threads here, vm_reinit() will fail with EBUSY.
The implementation is copied from amd64; in the not-too-distant future
the amd64 and arm64 copies of vmm.c and vmm_dev.c will be merged, so
for now it's useful to minimize diffs between amd64 and arm64.
Reviewed by: corvink, andrew
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D44934
bhyve: Fix handling of -r
Just make "restore_file" a global variable so that it can be set by the
MD option handler.
Reviewed by: corvink
Reported by: bdrewery
Fixes: 981f9f7495bb ("bhyve: Push option parsing down into bhyverun_machdep.c")
Differential Revision: https://reviews.freebsd.org/D44974
ng_hci: Add sockaddr validation to sendto()
ng_btsocket_hci_raw_send() wasn't verifying that the destination address
specified by sendto() is large enough to fill a struct sockaddr_hci.
Thus, when copying the socket address into an mbuf,
ng_btsocket_hci_raw_send() may read past the end of the input sockaddr
while copying.
In practice this is effectively harmless since
ng_btsocket_hci_raw_output() only uses the address to identify a
netgraph node.
Reported by: Oliver Sieber <oliver at secfault-security.com>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 7f7b4926a779845116913c85ecbb10527daeab02)
if_bridge: clean up INET/INET6 handling
The if_bridge contains several instances of:
if (AF_INET code ...
#ifdef INET6
AF_INET6 code ...
#endif
) {
...
Clean this up by adding a couple of macros at the top of the file that
are conditionally defined based on whether INET and/or INET6 are enabled,
which makes the code more readable and easier to maintain.
No functional change intended.
Reviewed by: zlei, markj
MFC after: 1 week
[3 lines not shown]
ng_hci: Add sockaddr validation to sendto()
ng_btsocket_hci_raw_send() wasn't verifying that the destination address
specified by sendto() is large enough to fill a struct sockaddr_hci.
Thus, when copying the socket address into an mbuf,
ng_btsocket_hci_raw_send() may read past the end of the input sockaddr
while copying.
In practice this is effectively harmless since
ng_btsocket_hci_raw_output() only uses the address to identify a
netgraph node.
Reported by: Oliver Sieber <oliver at secfault-security.com>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 7f7b4926a779845116913c85ecbb10527daeab02)
kdc: Add restart option
Add a new kdc_restart rc variable that manages kdc (or krb5kdc) under
daemon(8). This automatically restarts the kdc should it fail, i.e.
when it's configured to use LDAP as a backend and cannot connect to its
LDAP directory.
Set kdc_restart="YES" to auto restart kdc on abnormal termination.
Set kdc_restart_delay="N" to the number of seconds to delay before
restarting the kdc. The daemon(8) default seconds applies when not set.
Reported by: Lexi Winter <lexi.freebsd at le-fay.org>
PR: 278395
Differential Revision: https://reviews.freebsd.org/D44898
(cherry picked from commit 9e248b7f645cdf05615a49cc15295df49b54d659)
kdc: Add restart option
Add a new kdc_restart rc variable that manages kdc (or krb5kdc) under
daemon(8). This automatically restarts the kdc should it fail, i.e.
when it's configured to use LDAP as a backend and cannot connect to its
LDAP directory.
Set kdc_restart="YES" to auto restart kdc on abnormal termination.
Set kdc_restart_delay="N" to the number of seconds to delay before
restarting the kdc. The daemon(8) default seconds applies when not set.
Reported by: Lexi Winter <lexi.freebsd at le-fay.org>
PR: 278395
Differential Revision: https://reviews.freebsd.org/D44898
(cherry picked from commit 9e248b7f645cdf05615a49cc15295df49b54d659)
sound: Fix panic caused by sleeping-channel destruction during asynchronous detach
Currently we are force-destroying all channels unconditionally in
pcm_killchan(). However, since asynchronous audio device detach is
possible as of 44e128fe9d92, if we do not check whether the channel is
sleeping or not and forcefully kill it, we will get a panic from
cv_timedwait_sig() (called from chn_sleep()), because it will try to use
a freed lock/cv.
Modify pcm_killchan() (renamed to pcm_killchans() since that's a more
appropriate name now) to loop through the channel list and destroy only
the channels that are awake, otherwise wake up the sleeping thread and
try again. This loop is repeated until all channels are awakened and
destroyed.
To reduce code duplication, implement chn_shutdown() which wakes up the
channel and sets CHN_F_DEAD, and use it in pcm_unregister() and
pcm_killchans().
[8 lines not shown]
sound: Fix NULL dereference in dsp_clone() and mixer_clone()
If we only have a single soundcard attached and we detach it right
before entering [dsp|mixer]_clone(), there is a chance pcm_unregister()
will have returned already, meaning it will have set snd_unit to -1, and
thus devclass_get_softc() will return NULL here.
While here, 1) move the calls to dsp_destroy_dev() and mixer_uninit()
below the point where we unset SD_F_REGISTERED, and 2) follow what
mixer_clone() does and make sure we don't use a NULL d->dsp_dev in
dsp_clone().
Reported by: KASAN
Sponsored by: The FreeBSD Foundation
MFC after: 1 day
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44924
(cherry picked from commit 074d6fbebc160222cde6b726adcc7350881d7824)
sound: Remove obsolete chn_setvolume()
It is marked as obsolete and there are no consumers of it anymore.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D44853
(cherry picked from commit 17969e696325273e250a1dc73f43de76c0836aae)
sound: Wrap dsp_clone() and mixer_clone() with bus_topo_lock()
Make sure that the softc isn't freed in between the checks.
Sponsored by: The FreeBSD Foundation
MFC after; 1 day
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44991
(cherry picked from commit b18b990d8e7b15d25243d85ea22374dfdde8a18b)
adduser: Overhaul.
Most importantly:
* Make local variables local.
* Use `$()` instead of backticks.
* Avoid unsafe use of `-a` and `-o` operators in `test` expressions.
* Remove a hack intended to ease the transition from Perl 22 years ago.
MFC after: 1 week
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44863
(cherry picked from commit 170d0882903eb75b92cd10e9a1bcbe57a647ae7d)
adduser: A few more improvements.
MFC after: 1 week
Reviewed by: jrm
[20 lines not shown]
adduser(8): support creation of ZFS dataset
On systems utilizing ZFS, default to creating a ZFS dataset for a new
user's home directory if the parent directory resides on a ZFS dataset.
Add a flag that disables this behavior if the administrator explicitly
does not want it.
If run during installation from within a chroot, set mountpoint to legacy
after dataset creation and mount directly into the chroot. Then umount
and reset the mountpoint to inherit from parent.
Also support ZFS default encryption on user's home directory.
Feedback by: delphij
Reviewed by: imp, kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/881
(cherry picked from commit 215c0a5158f17f515f365fc28a9ff0b367be8fc9)
adduser: Overhaul.
Most importantly:
* Make local variables local.
* Use `$()` instead of backticks.
* Avoid unsafe use of `-a` and `-o` operators in `test` expressions.
* Remove a hack intended to ease the transition from Perl 22 years ago.
MFC after: 1 week
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44863
(cherry picked from commit 170d0882903eb75b92cd10e9a1bcbe57a647ae7d)
adduser: A few more improvements.
MFC after: 1 week
Reviewed by: jrm
[13 lines not shown]