FreeBSD/src 86fbb05sys/cam/ctl ctl_cmd_table.c

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
DeltaFile
+1-1sys/cam/ctl/ctl_cmd_table.c
+1-11 files

FreeBSD/src 044243fcontrib/pf/authpf authpf.c, contrib/pf/ftp-proxy filter.c

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
DeltaFile
+10-15contrib/pf/tftp-proxy/filter.c
+10-13contrib/pf/ftp-proxy/filter.c
+9-11contrib/pf/authpf/authpf.c
+6-0lib/libpfctl/libpfctl.c
+1-0lib/libpfctl/libpfctl.h
+36-395 files

FreeBSD/src a3f7176lib/libpfctl libpfctl.c libpfctl.h

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
DeltaFile
+1-1lib/libpfctl/libpfctl.c
+1-1lib/libpfctl/libpfctl.h
+2-22 files

FreeBSD/src 5824df8lib/libpfctl libpfctl.c, sys/netlink netlink_snl.h netlink_message_writer.h

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")
DeltaFile
+147-0lib/libpfctl/libpfctl.c
+113-1sys/netpfil/pf/pf_nl.c
+18-17usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
+29-0sys/netpfil/pf/pf_nl.h
+11-0sys/netlink/netlink_snl.h
+6-0sys/netlink/netlink_message_writer.h
+324-184 files not shown
+329-2210 files

FreeBSD/src e05b650release/packages generate-ucl.sh

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
DeltaFile
+1-1release/packages/generate-ucl.sh
+1-11 files

FreeBSD/src 2ef5a86release/packages generate-ucl.sh

package: FreeBSD-periodic should depend on FreeBSD-cron

Reported by: des
Reviewed by: imp, des
Pull Request: https://github.com/freebsd/freebsd-src/pull/1204
DeltaFile
+3-0release/packages/generate-ucl.sh
+3-01 files

FreeBSD/src b2b8fa1usr.bin/du du.c du.1

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
DeltaFile
+37-20usr.bin/du/du.c
+11-1usr.bin/du/du.1
+1-1usr.bin/du/Makefile
+49-223 files

FreeBSD/src 702766dshare/man/man5 services.5

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
DeltaFile
+5-2share/man/man5/services.5
+5-21 files

FreeBSD/src 1ee7a8fsys/arm64/vmm vmm.c

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
DeltaFile
+53-0sys/arm64/vmm/vmm.c
+53-01 files

FreeBSD/src 390e449usr.sbin/bhyve bhyverun.c bhyverun.h

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
DeltaFile
+4-3usr.sbin/bhyve/bhyverun.c
+4-0usr.sbin/bhyve/bhyverun.h
+8-32 files

FreeBSD/src 28fcfebsys/netgraph/bluetooth/socket ng_btsocket_hci_raw.c

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)
DeltaFile
+11-0sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c
+11-01 files

FreeBSD/src 2f95e4asys/net if_bridge.c

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]
DeltaFile
+31-34sys/net/if_bridge.c
+31-341 files

FreeBSD/src 59e7c57tests/atf_python/sys Makefile, tests/atf_python/sys/net Makefile

tests: move atf_python/sys/ into the tests package

Reviewed by:    markj
MFC after:      1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1174

(cherry picked from commit e1e636193db45630c7881246d25902e57c43d24e)
DeltaFile
+1-0tests/atf_python/sys/Makefile
+1-0tests/atf_python/sys/net/Makefile
+1-0tests/atf_python/sys/netlink/Makefile
+1-0tests/atf_python/sys/netpfil/Makefile
+1-0tests/atf_python/sys/netpfil/ipfw/Makefile
+5-05 files

FreeBSD/src 6f028e9sys/netgraph/bluetooth/socket ng_btsocket_hci_raw.c

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)
DeltaFile
+11-0sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c
+11-01 files

FreeBSD/src e750111libexec/rc rc.conf, libexec/rc/rc.d kdc

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)
DeltaFile
+27-2libexec/rc/rc.d/kdc
+2-0libexec/rc/rc.conf
+29-22 files

FreeBSD/src a161f24crypto/heimdal/lib/hdb hdb-ldap.c

heimdal: Fix compiling hdb ldap as a module

Fix build when WITH_OPENLDAP defined.

PR:             278430
Obtained from:  Upstream c1c7da7f79

(cherry picked from commit a0d7d68a2dd818ce84e37e1ff20c8849cda6d853)
DeltaFile
+6-3crypto/heimdal/lib/hdb/hdb-ldap.c
+6-31 files

FreeBSD/src abc4b30libexec/rc rc.conf, libexec/rc/rc.d kdc

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)
DeltaFile
+27-2libexec/rc/rc.d/kdc
+2-0libexec/rc/rc.conf
+29-22 files

FreeBSD/src 8640bd6crypto/heimdal/lib/hdb hdb-ldap.c

heimdal: Fix compiling hdb ldap as a module

Fix build when WITH_OPENLDAP defined.

PR:             278430
Obtained from:  Upstream c1c7da7f79

(cherry picked from commit a0d7d68a2dd818ce84e37e1ff20c8849cda6d853)
DeltaFile
+6-3crypto/heimdal/lib/hdb/hdb-ldap.c
+6-31 files

FreeBSD/src a2b09fcsys/dev/sound/pcm sound.c

sound: Add missing space in dev.pcm.X.mode description

Sponsored by:   The FreeBSD Foundation
MFC after:      1 day
Reviewed by:    markj, emaste
Differential Revision:  https://reviews.freebsd.org/D44990

(cherry picked from commit e56c8996fc437488686e7cdef18258f16c5ea74e)
DeltaFile
+2-2sys/dev/sound/pcm/sound.c
+2-21 files

FreeBSD/src 33e0f0csys/dev/sound/pcm channel.c

sound: Assert that we do not enter chn_sleep() with CHN_F_SLEEPING

Sponsored by:   The FreeBSD Foundation
MFC after:      1 day
Reviewed by:    markj, emaste
Differential Revision:  https://reviews.freebsd.org/D44959

(cherry picked from commit fa284525499d75955525839074bf5968d0923e6b)
DeltaFile
+2-0sys/dev/sound/pcm/channel.c
+2-01 files

FreeBSD/src d8d7907sys/dev/sound/pcm sound.c channel.c

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]
DeltaFile
+43-21sys/dev/sound/pcm/sound.c
+9-0sys/dev/sound/pcm/channel.c
+1-0sys/dev/sound/pcm/channel.h
+53-213 files

FreeBSD/src cc72812sys/dev/sound/pcm dsp.c sound.c

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)
DeltaFile
+10-4sys/dev/sound/pcm/dsp.c
+3-4sys/dev/sound/pcm/sound.c
+2-1sys/dev/sound/pcm/mixer.c
+15-93 files

FreeBSD/src ac31606sys/dev/sound/pcm channel.c channel.h

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)
DeltaFile
+0-13sys/dev/sound/pcm/channel.c
+0-1sys/dev/sound/pcm/channel.h
+0-142 files

FreeBSD/src 9847c24sys/dev/sound/pcm mixer.c dsp.c

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)
DeltaFile
+2-0sys/dev/sound/pcm/mixer.c
+2-0sys/dev/sound/pcm/dsp.c
+4-02 files

FreeBSD/src b7a5690usr.sbin/adduser adduser.sh

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]
DeltaFile
+101-142usr.sbin/adduser/adduser.sh
+101-1421 files

FreeBSD/src edff88ausr.sbin/adduser adduser.sh

adduser: Really fix a syntax error

Fixes:          5cafc38f1129
Differential Revision:  https://reviews.freebsd.org/D44871

(cherry picked from commit 9e8618276fada5c68cc64676fba2ae2abd0544f5)
DeltaFile
+2-1usr.sbin/adduser/adduser.sh
+2-11 files

FreeBSD/src 9e86182usr.sbin/adduser adduser.sh

adduser: Really fix a syntax error

Fixes:          5cafc38f1129
Differential Revision:  https://reviews.freebsd.org/D44871
DeltaFile
+2-1usr.sbin/adduser/adduser.sh
+2-11 files

FreeBSD/src 72fc364usr.sbin/adduser adduser.sh adduser.8

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)
DeltaFile
+149-12usr.sbin/adduser/adduser.sh
+8-2usr.sbin/adduser/adduser.8
+2-0usr.sbin/adduser/adduser.conf.5
+159-143 files

FreeBSD/src 1da8405usr.sbin/adduser adduser.sh

add defaults for adduser.sh (OK? [yes] & additional user [no])

Event:          Kitchener-Waterloo Hackathon 202305
Differential Revision:  https://reviews.freebsd.org/D40157

(cherry picked from commit 9efad6f9e1084e97dd6e2599562e7db0bd31a4ab)
DeltaFile
+11-3usr.sbin/adduser/adduser.sh
+11-31 files

FreeBSD/src 4f4905busr.sbin/adduser adduser.sh

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]
DeltaFile
+103-145usr.sbin/adduser/adduser.sh
+103-1451 files