FreeBSD/src 287a91f — sys/dev/mpr mpr.c, sys/dev/mps mps.c

mpr(4)/mps(4): Fix build on 32-bit platforms

bus_addr_t is 32-bit on armv7, so >> 32 triggers -Wshift-count-overflow.
Widen it to uint64_t before shifting, as the other high-address writes
in the same files.

Fixes:          866760ff8338 ("mps(4): add support for hostboot")
Sponsored by:   The FreeBSD Foundation
DeltaFile
+1-1sys/dev/mps/mps.c
+1-1sys/dev/mpr/mpr.c
+2-22 files

FreeBSD/src 8204036 — sys/dev/sound/pcm sound.c feeder_eq.c

sound: Hold the topology lock across the remaining registration checks

sysctl_dev_pcm_bitperfect(), sysctl_dev_pcm_eq() and
sysctl_dev_pcm_eq_preamp() check PCM_REGISTERED() and then busy the
device with nothing held in between, so pcm_unregister() can run and
destroy the sx before PCM_ACQUIRE() takes it. These sysctls are
registered in the device's newbus context, so they outlive
pcm_unregister().

Hold the topology lock across the check and the busy, as the other
handlers do.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61224
DeltaFile
+20-4sys/dev/sound/pcm/feeder_eq.c
+10-2sys/dev/sound/pcm/sound.c
+30-62 files

FreeBSD/src 406358d — sys/dev/sound/pcm sound.h dsp.c

sound: Fix a LOR between AIOGCAP and SNDCTL_DSP_SYNCGROUP

AIOGCAP locks a dsp_cdevpriv's record channel and then its play channel,
while dsp_oss_syncgroup() locked them the other way round. Verified the
LOR and deadlock by exercising both paths using a duplex FD
concurrently.

Lock the record channel first in dsp_oss_syncgroup() too, and document
the order in sound.h.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D60519
DeltaFile
+5-5sys/dev/sound/pcm/dsp.c
+2-0sys/dev/sound/pcm/sound.h
+7-52 files

FreeBSD/src 7e1ff15 — sys/dev/sound/pcm mixer.c

sound: Busy the device in mixer_oss_mixerinfo()

Rather than hold the topology lock across the whole handler, which
blocks detach of every device in the system, busy the one being selected
and used, and drop the topology lock, as the other SNDCTL_*INFO handlers
do.

The mutex now covers only the mixer fields. mixer->cdev is set once in
mixer_init() and never cleared, so reading does not need the lock.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D60518
DeltaFile
+94-100sys/dev/sound/pcm/mixer.c
+94-1001 files

FreeBSD/src 91dec58 — sys/dev/sound/pcm sound.h

sound: Document the locking protocol

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D60517
DeltaFile
+25-8sys/dev/sound/pcm/sound.h
+25-81 files

FreeBSD/src 6417651 — sys/dev/sound/pcm sound.c

sound: Retire PCM_LOCK in sound_oss_card_info()

The handler reads the device name, its description and the status
string. All three are set before pcm_register() makes the device
visible, and never change afterwards. The topology lock, which is held
across the whole function, makes sure the device is not freed.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D60515
DeltaFile
+0-5sys/dev/sound/pcm/sound.c
+0-51 files

FreeBSD/src d5b70b1 — sys/dev/sound/pcm dsp.c

sound: Busy the device in SNDCTL_DSP_GETCAPS

The handler read the device flags under PCM_LOCK, but those flags are
written while holding the device busy, so busy it instead.

The CHN_F_VIRTUAL checks do not need a lock. The flag is set once in
vchan_init() when the channel is created and never cleared.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D60514
DeltaFile
+2-2sys/dev/sound/pcm/dsp.c
+2-21 files

FreeBSD/src 1cfc55d — sys/dev/sound/pcm dsp.c

sound: Protect channels.pcm.opened with the sx alone

This list is initialized in pcm_init() and only accessed by dsp_open()
and dsp_close(), and we are under sx already, so the PCM_LOCK does not
add anything.

PCM_LOCK is also held around playcount/reccount reads, which are also
under sx now.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D60513
DeltaFile
+0-10sys/dev/sound/pcm/dsp.c
+0-101 files

FreeBSD/src 39c51e9 — sys/dev/sound/pcm sound.c vchan.c

sound: Stop taking PCM_LOCK to create and destroy channels

chn_init() and chn_kill() took PCM_LOCK around the channel lists and the
per-direction counts, so that readers which cannot sleep could inspect
them. There are none left anymore, so drop it. The few remaining
unlocked readers never took the mutex in the first place.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D60512
DeltaFile
+0-6sys/dev/sound/pcm/channel.c
+0-4sys/dev/sound/pcm/vchan.c
+0-2sys/dev/sound/pcm/sound.c
+0-123 files

FreeBSD/src 3dfca11 — sys/dev/sound/pcm sound.c

sound: Busy the device in sysctl_dev_pcm_mode()

PCM_LOCK does not keep the device alive, so it does not protect this
handler racing with pcm_unregister(). The sysctl is registered in the
device's newbus context which outlives pcm_unregister().

Busy the device instead, as the other handlers do, and hold the topology
lock across the registration check so that the device cannot start
detaching between the check and the busy.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D60509
DeltaFile
+11-3sys/dev/sound/pcm/sound.c
+11-31 files

FreeBSD/src 7c3106d — sys/dev/sound/pcm mixer.c vchan.c

sound: Busy devices before giving up the topology lock

The SNDCTL_*INFO ioctls can report info about any device in the system,
not only the one they were issued on. Both the dsp and mixer dispatchers
unnecessarily busy the caller's device first. The caller's device is
kept alive anyway, until destroy_dev() drains the cdev threadcount.

Busying the wrong device also prevents the handlers from busying the one
they actually want to report info on, because this would recurse on the
sx whenever the two were the same, so they walk the channel lists under
PCM_LOCK instead.

Busy each device as it is being inspected, and give up the topology lock
once it is busied rather than holding it across the walks.

The vchan sysctls have the same problem. They look the device up under
the topology lock, drop it, and then busy the device, leaving a window
where the device can disappear. Busy it before dropping the lock there
too.

    [4 lines not shown]
DeltaFile
+32-33sys/dev/sound/pcm/dsp.c
+17-12sys/dev/sound/pcm/sound.c
+8-8sys/dev/sound/pcm/vchan.c
+12-0sys/dev/sound/pcm/mixer.c
+69-534 files

FreeBSD/src 0cb05a9 — sys/dev/sound/pci maestro3.c

snd_maestro3: Do not hold sc_lock across the hwvol handlers

mixer_hwvol_*() can end up taking sound(4)'s channel lock through
mixer_set_softpcmvol() or mixer_set_eq(). m3_pchan_trigger() takes
sc_lock with the channel lock already held, which can cause a LOR. Drop
sc_lock for the duration of the hwvol handlers, as snd_uaudio(4) does
for the same reason.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D60464
DeltaFile
+2-0sys/dev/sound/pci/maestro3.c
+2-01 files

FreeBSD/src f7571b0 — sys/dev/sound/pcm channel.h channel.c

sound: Move channel teardown functions from sound.c to channel.c

This was a layering violation.

No functional change intended.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D60129
DeltaFile
+11-48sys/dev/sound/pcm/sound.c
+38-1sys/dev/sound/pcm/channel.c
+2-1sys/dev/sound/pcm/channel.h
+51-503 files

FreeBSD/src 615f4d5 — sys/dev/sound/pci ich.c, sys/dev/sound/pcm channel.h sound.h

sound: Retire unused locking macros

No functional change intended.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
DeltaFile
+0-2sys/dev/sound/pcm/sound.h
+0-1sys/dev/sound/pcm/channel.h
+0-1sys/dev/sound/pci/ich.c
+0-43 files

FreeBSD/src bacd867 — sys/dev/sound sndstat.c, sys/dev/sound/pcm feeder_eq.c sound.c

sound: Convert the SD_F_BUSY cv to an sx

SD_F_BUSY was essentially a custom sleepable lock, which was invisible
to WITNESS. Replace it with an sx lock. This simplifies and removes some
of the PCM macros, and gives us WITNESS coverage.

PCM_WAIT(), PCM_ACQUIRE() and PCM_RELEASE() all asserted that PCM_LOCK
is held, which forced callers to take the mutex just to use the macros.
chn_vpc_proc() and sysctl_hw_snd_feeder_rate_quality() are two such
callers. Simplify this.

Changes to snddev_info->flags are now serialized by the sx alone, which
makes the protocol uniform. Previously some writers held the busy flag,
some held busy and the mutex, and others just the mutex.
snddev_info->eqpreamp was consistent, but its only writer held the mutex
needlessly, so drop that too. Document this above the sx definition in
sound.h, and assert the flags protocol in pcm_setflags().

Name both locks after what they are rather than after the device unit,

    [6 lines not shown]
DeltaFile
+104-116sys/dev/sound/pcm/dsp.c
+29-45sys/dev/sound/pcm/vchan.c
+17-49sys/dev/sound/pcm/sound.h
+16-27sys/dev/sound/pcm/sound.c
+10-24sys/dev/sound/pcm/feeder_eq.c
+6-6sys/dev/sound/sndstat.c
+182-2674 files not shown
+189-28010 files

FreeBSD/src d30ca39 — sys/dev/sound/pcm channel.h channel.c

sound: Retire pcm_channel->sleeping

This field and the pause_sbt() in pcm_shutdownchans() are redundant now,
because pcm_shutdownchans() (previously part of pcm_killchans()) is now
only responsible for waking up and stopping the channel, and
destroy_dev() will not return until the threads have returned from their
cdev methods.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D60121
DeltaFile
+9-24sys/dev/sound/pcm/sound.c
+0-2sys/dev/sound/pcm/channel.h
+0-2sys/dev/sound/pcm/channel.c
+9-283 files

FreeBSD/src f0a59c9 — sys/dev/sound/pcm vchan.c sound.c, tests/sys/sound Makefile hotunload.sh

sound: Drain the dsp cdev before freeing resources

pcm_unregister() freed various resources before destroying the dsp cdev.
A thread that had already passed DSP_REGISTERED() could potentially
dereference those after they were freed. This was easily triggered by
the test case introduced in this commit.

Factor out pcm_killchans()'s channel wakeup/drain loop into a new
pcm_shutdownchans(), which is called before destroy_dev(), so that the
channels are freed only when destroy_dev() has returned.

Mark all channels dead, not only the active ones. An operation started
on an idle channel after pcm_shutdownchans() returned would never
complete, and destroy_dev() would wait for the thread forever.

Check PCM_REGISTERED() in vchan_create(), since it is the only place
where channels are created at runtime.

MFC after:      2 weeks

    [3 lines not shown]
DeltaFile
+57-0tests/sys/sound/hotunload.sh
+26-10sys/dev/sound/pcm/sound.c
+10-0sys/dev/sound/pcm/vchan.c
+1-0tests/sys/sound/Makefile
+94-104 files

FreeBSD/src 5151bc2 — lib/libpam/modules/pam_xdg pam_xdg.8

pam_xdg.8: Mechanical polish

+ convert license to SPDX only
+ belatedly bump date for last content change
+ rewrite in semantic line breaks to fix one sentence per line

Reviewed by:            manu
Fixes:                  ecd6631b19d9 ("pam_xdg: Add linger option")
Differential Revision:  https://reviews.freebsd.org/D61703
DeltaFile
+7-25lib/libpam/modules/pam_xdg/pam_xdg.8
+7-251 files

FreeBSD/src 812bdff — sys/compat/linuxkpi/common/src linux_pci.c

linuxkpi: Release the "from" device in pci_get_class() and pci_get_base_class()

On Linux the pci_get_*() iterators drop the reference of the device passed
as "from" once the next one has been looked up, so a loop like

        while ((pch = pci_get_class(class, pch)))

does not leak anything.  LinuxKPI allocates a new pci_dev for every device
it returns but never released "from", so each device but the last one was
leaked together with its kobject, its name and its path name.  i915 does
exactly this in intel_detect_pch() and leaked a device at every load.

Drop the reference, but only for the devices created by lkpinew_pci_dev();
the pci_dev of a device attached to a driver belongs to the bus.

Differential Revision:  https://reviews.freebsd.org/D61222
DeltaFile
+15-0sys/compat/linuxkpi/common/src/linux_pci.c
+15-01 files

FreeBSD/src c343c44 — sys/compat/lindebugfs lindebugfs.c

lindebugfs: Free the kcov symlink when the module is unloaded

lindebugfs_init() creates the "kcov" symlink with debugfs_create_symlink(),
which allocates a node and a copy of the destination, but passed no destroy
callback to pfs_create_link().  pseudofs therefore never released them and
the "debugfsint" malloc type was reported as leaking memory each time the
module was unloaded.

Use debugfs_destroy(), as done for the other nodes.

Differential Revision:  https://reviews.freebsd.org/D61221
DeltaFile
+1-1sys/compat/lindebugfs/lindebugfs.c
+1-11 files

FreeBSD/src ee2f66a — sys/compat/linuxkpi/common/src linux_pci.c

linuxkpi: Release devres when the probe of a PCI driver fails

When the probe method of a driver fails, linux_pci_attach_device() only
dropped its reference on the device.  Like on detach (see the previous
change), the devres actions are then not run if one of them holds a
reference on the device, which is what devm_drm_dev_alloc() does through the
drm_device.  The device is never released, the drm_device is leaked with its
minor, its managed memory and its debugfs entries: unloading the driver
after a failed load (e.g. a missing firmware) printed
"WARNING !xa_empty(&drm_minors_xa)" and leaked memory.

Linux releases the devres resources of a device whose probe failed, so do the
same.

Differential Reivision: https://reviews.freebsd.org/D61223
DeltaFile
+8-0sys/compat/linuxkpi/common/src/linux_pci.c
+8-01 files

FreeBSD/src 0e952a9 — usr.bin/soelim soelim.1

soelim.1: document stdin and trailing text
DeltaFile
+14-4usr.bin/soelim/soelim.1
+14-41 files

FreeBSD/src 05e79d2 — usr.bin/soelim soelim.c, usr.bin/soelim/tests soelim_test.sh

soelim: fix path and whitespace handling

Reject truncated path
Skip all white space following the file name
DeltaFile
+18-14usr.bin/soelim/soelim.c
+18-0usr.bin/soelim/tests/soelim_test.sh
+36-142 files

FreeBSD/src fbbf685 — usr.bin/soelim soelim.c, usr.bin/soelim/tests soelim_test.sh

soelim: fix error detection and exit status
DeltaFile
+34-0usr.bin/soelim/tests/soelim_test.sh
+15-5usr.bin/soelim/soelim.c
+49-52 files

FreeBSD/src 5f4a02c — usr.bin/soelim soelim.c, usr.bin/soelim/tests soelim_test.sh

soelim: bound include recursion to 64 levels
DeltaFile
+15-3usr.bin/soelim/soelim.c
+8-0usr.bin/soelim/tests/soelim_test.sh
+23-32 files

FreeBSD/src ecd6631 — lib/libpam/modules/pam_xdg pam_xdg.8 pam_xdg.c

pam_xdg: Add linger option

The pam_xdg module deletes a user's XDG_RUNTIME_DIR when the last
interactive session logs out. If the user leaves background processes
running on the system, like a terminal multiplexer, that puts state or
domain sockets in XDG_RUNTIME_DIR, then that state gets destroyed and
the processes become effectively orphaned.

On Linux, systemd-logind not only unlinks XDG_RUNTIME_DIR but also kills
all user processes on logout. To allow long-lived background processes,
it implements a per-user "linger" mode to disable the unlink and kill.

Because FreeBSD's pam_xdg does not implement process killing, this
"linger" option implementation skips only XDG_RUNTIME_DIR unlinking
when the user still has running processes after the last session logs
out.

Differential Revision:  https://reviews.freebsd.org/D61332
DeltaFile
+34-6lib/libpam/modules/pam_xdg/pam_xdg.c
+8-1lib/libpam/modules/pam_xdg/pam_xdg.8
+42-72 files

FreeBSD/src 40e1cc3 — sys/arm/allwinner aw_thermal.c

aw_thermal: Add support for the H6

Add the thermal sensor controller of the H6, which has two sensors, for
the CPU and the GPU.

The controller has other registers than the one of the supported SoCs.
The efuse has the temperature of the factory test and the value of each
sensor at this temperature, from which the calibration value of each
sensor is computed and written to the controller.

The alarm and shutdown thresholds and the interrupts are not supported
yet.

Tested on:      Pine H64 (CPU and GPU temperatures, idle and under load)
DeltaFile
+116-0sys/arm/allwinner/aw_thermal.c
+116-01 files

FreeBSD/src 672ff45 — sys/arm/allwinner aw_thermal.c

aw_thermal: Make the data register and the alarm support per SoC

The controller of the H6 has its data registers at another offset and
other alarm, shutdown and interrupt registers.

Add the offset of the first data register to the SoC configuration,
and a flag for the alarm handling (interrupt, alarm and shutdown
thresholds and the cpufreq throttling), set for all the SoCs
currently supported.

No functional change intended.
DeltaFile
+23-9sys/arm/allwinner/aw_thermal.c
+23-91 files

FreeBSD/src ab350f6 — sys/arm/allwinner aw_thermal.c

aw_thermal: Add an init function to the SoC configuration

Move the initialisation of the controller to a function of the SoC
configuration, as the controller of the H6 is different from the one
of the other supported SoCs.

No functional change intended.
DeltaFile
+11-2sys/arm/allwinner/aw_thermal.c
+11-21 files

FreeBSD/src e7b7f2a — sys/arm/allwinner aw_sid.c

aw_sid: Add the thermal sensor calibration fuse of the H6

The thermal sensor controller of the H6 gets its calibration data from
the 8 bytes of the efuse at offset 0x14, referenced by the
ths_calibration nvmem cell. Add it so the thermal driver can read it.

Tested on:      Pine H64 (thermal sensor calibration)
DeltaFile
+9-0sys/arm/allwinner/aw_sid.c
+9-01 files