]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 days agomqueuefs: Relax restriction that path must begin with a slash
Ricardo Branco [Wed, 15 May 2024 20:56:15 +0000 (22:56 +0200)]
mqueuefs: Relax restriction that path must begin with a slash

This is needed to support Linux implementation which discards the leading slash when calling mq_open(2)

Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1248

6 days agolinprocfs: Add support for proc/sys/fs/mqueue/*
Ricardo Branco [Sun, 12 May 2024 09:49:36 +0000 (11:49 +0200)]
linprocfs: Add support for proc/sys/fs/mqueue/*

Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1248

6 days agomqueue: Add sysctl for default_maxmsg & default_msgsize and fix descriptions
Ricardo Branco [Sun, 12 May 2024 10:30:46 +0000 (12:30 +0200)]
mqueue: Add sysctl for default_maxmsg & default_msgsize and fix descriptions

Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1248

6 days agoctl: use socket buffer mutexes in struct socket directly
Gleb Smirnoff [Thu, 23 May 2024 19:11:54 +0000 (12:11 -0700)]
ctl: use socket buffer mutexes in struct socket directly

A mechanical change performed with sed(1) script:

s/SOCKBUF_LOCK\(&so->so_rcv\)/SOCK_RECVBUF_LOCK(so)/
s/SOCKBUF_UNLOCK\(&so->so_rcv\)/SOCK_RECVBUF_UNLOCK(so)/
s/SOCKBUF_MTX\(&so->so_rcv\)/SOCK_RECVBUF_MTX(so)/
s/SOCKBUF_LOCK\(&so->so_snd\)/SOCK_SENDBUF_LOCK(so)/
s/SOCKBUF_UNLOCK\(&so->so_snd\)/SOCK_SENDBUF_UNLOCK(so)/
s/SOCKBUF_MTX\(&so->so_snd\)/SOCK_SENDBUF_MTX(so)/

Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D45190

6 days agocp: avoid a resource leak
Pierre Pronchery [Thu, 16 May 2024 14:19:44 +0000 (16:19 +0200)]
cp: avoid a resource leak

In copy_file(), make sure the from_fd file descriptor is closed even
when the operation failed early.

Reported by: Coverity Scan
CID: 1545036
Sponsored by: The FreeBSD Foundation

Reviewed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/1238

6 days agoci: Redirect output for builds.
Warner Losh [Thu, 23 May 2024 17:37:01 +0000 (11:37 -0600)]
ci: Redirect output for builds.

This target is far too noisy to be at all useful. Save the output ala
make universe in _. files. Also report where to find errors.

Sponsored by: Netflix

6 days agooption_survey.sh: Bump size to 5GB
Michael Dexter [Mon, 20 May 2024 17:22:56 +0000 (10:22 -0700)]
option_survey.sh: Bump size to 5GB

Increase image size from 4G to 5G to accommodate growth in OS.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1251

6 days agoetherswitch.4: List manual pages alphabetically
Tom Hukins [Thu, 23 May 2024 14:07:27 +0000 (15:07 +0100)]
etherswitch.4: List manual pages alphabetically

Signed-off-by: Tom Hukins <tom@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1253

6 days agoetherswitch.4: Remove non-existent manual pages
Tom Hukins [Thu, 23 May 2024 14:06:01 +0000 (15:06 +0100)]
etherswitch.4: Remove non-existent manual pages

Signed-off-by: Tom Hukins <tom@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1253

6 days agoFix "version introduced" in two manual pages
Tom Hukins [Wed, 22 May 2024 12:32:03 +0000 (13:32 +0100)]
Fix "version introduced" in two manual pages

Signed-off-by: Tom Hukins <tom@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1252

6 days agolibcompiler_rt: gcc13 doesn't support _Float16 on arm
Brooks Davis [Thu, 23 May 2024 16:26:51 +0000 (17:26 +0100)]
libcompiler_rt: gcc13 doesn't support _Float16 on arm

Don't set CRT_COMMON_F16_ARCH for arm as it's not supported by gcc13.

Differential Revision: https://reviews.freebsd.org/D45234

6 days agolibpmc: remove tautological assert
Brooks Davis [Thu, 23 May 2024 16:26:24 +0000 (17:26 +0100)]
libpmc: remove tautological assert

gcc13 whines about this assert than an unsigned integer is >= 0.

Reviewed by: luporl
Fixes: b48a2770d48b9 powerpc64: add Power8 and Power9 PMCs
Differential Revision: https://reviews.freebsd.org/D45232

6 days agoFix scn_queue races on very old pools
Alexander Motin [Thu, 23 May 2024 16:20:37 +0000 (12:20 -0400)]
Fix scn_queue races on very old pools

Code for pools before version 11 uses dmu_objset_find_dp() to scan
for children datasets/clones.  It calls enqueue_clones_cb() and
enqueue_cb() callbacks in parallel from multiple taskq threads.
It ends up bad for scan_ds_queue_insert(), corrupting scn_queue
AVL-tree.  Fix it by introducing a mutex to protect those two
scan_ds_queue_insert() calls.  All other calls are done from the
sync thread and so serialized.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #16162
PR: 278414

6 days agopcm: centralize 32-bit ioctl compat
Brooks Davis [Thu, 23 May 2024 16:14:36 +0000 (17:14 +0100)]
pcm: centralize 32-bit ioctl compat

Move all handlng of struct sndstioc_nv_arg(32) to sndstat_ioctl() and
make the functions that actually do the work take a buffer and size or
size pointer.  The 32-bit compat work is minimal so just inline it.

Remove checks that we've got a 32-bit process for 32-bit ioctls.  We
don't check that default ioctls are from 64-bit processes on 64-bit
systems.

Reviewed by: christos
Differential Revision: https://reviews.freebsd.org/D45307

6 days agoMAC/do: allow to call setuid if real user id is 0
Baptiste Daroussin [Thu, 23 May 2024 10:09:11 +0000 (12:09 +0200)]
MAC/do: allow to call setuid if real user id is 0

This fixed sshd not able to call restore_uid when MAC/do policy is
loaded

6 days agoStop treating size 0 as unknown size in vnode_create_vobject().
Pawel Jakub Dawidek [Sun, 19 May 2024 01:08:41 +0000 (01:08 +0000)]
Stop treating size 0 as unknown size in vnode_create_vobject().

Whenever file is created, the vnode_create_vobject() function will
try to determine its size by calling vn_getsize_locked() as size 0
is ambigious: it means either the file size is 0 or the file size
is unknown.

Introduce special value for the size argument: VNODE_NO_SIZE.
Only when it is given, the vnode_create_vobject() will try to obtain
file's size on its own.

Introduce dedicated vnode_disk_create_vobject() for use by
g_vfs_open(), so we don't have to call vn_isdisk() in the common case
(for regular files).

Handle the case of mediasize==0 in g_vfs_open().

Reviewed by: alc, kib, markj, olce
Approved by: oshogbo (mentor), allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D45244

7 days agofreebsd-update: Correctly check if pkg(8) is present
Zhenlei Huang [Thu, 23 May 2024 04:10:17 +0000 (12:10 +0800)]
freebsd-update: Correctly check if pkg(8) is present

On systems without pkg(8) installed, `command -v pkg` will return
success and falsely report that pkg(8) is present. Fix that by checking
via the `pkg -N` form.

This is missing from the final revision of D39695.

Reported by: delphij
Reviewed by: fernape, delphij
Fixes: bc0c6c9cf3a9 freebsd-update: Add check for kernel modules
Differential Revision: https://reviews.freebsd.org/D45292

7 days agoarm64: set ATTR_CONTIGUOUS on the DMAP's L2 blocks
Alan Cox [Mon, 13 May 2024 06:39:28 +0000 (01:39 -0500)]
arm64: set ATTR_CONTIGUOUS on the DMAP's L2 blocks

On systems configured with 16KB pages, this change creates 1GB page
mappings in the direct map where possible.  Previously, the largest page
size that was used to implement the direct map was 32MB.  Similarly, on
systems configured with 4KB pages, this change creates 32MB page
mappings, instead of 2MB, in the direct map where 1GB is too large.

Implement demotion on L2C (32MB/1GB) page mappings within the DMAP.

Update sysctl vm.pmap.kernel_maps to report on L2C page mappings.

Reviewed by: markj
Tested by: gallatin, Eliot Solomon <ehs3@rice.edu>
Differential Revision: https://reviews.freebsd.org/D45224

7 days agosound: Fix minchn, maxchn and fmts in sndstat_get_caps()
Christos Margiolis [Thu, 23 May 2024 00:57:55 +0000 (02:57 +0200)]
sound: Fix minchn, maxchn and fmts in sndstat_get_caps()

The current implementation (incorrectly) passes the channel encoding
value to AFMT_CHANNEL(), which will always return 0, since the channel
number bits are masked out by AFMT_ENCODING().

Also add missing fmts initialization and aggregate encoding formats into
it directly.

Sponsored by: The FreeBSD Foundation
MFC after: 1 day
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D45312

7 days agomixer.3: Fix mandoc -Tlint warnings
Christos Margiolis [Thu, 23 May 2024 00:57:49 +0000 (02:57 +0200)]
mixer.3: Fix mandoc -Tlint warnings

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

7 days agomixer(8): Use mixer_get_path()
Christos Margiolis [Thu, 23 May 2024 00:57:43 +0000 (02:57 +0200)]
mixer(8): Use mixer_get_path()

Sponsored by: The FreeBSD Foundation
MFC after: 1 day
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D45276

7 days agomixer(3): Implement mixer_get_path() function
Christos Margiolis [Thu, 23 May 2024 00:57:36 +0000 (02:57 +0200)]
mixer(3): Implement mixer_get_path() function

This is better than hardcoding device paths in mixer applications.

Sponsored by: The FreeBSD Foundation
MFC after: 1 day
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D45275

7 days agomixer(8): Ignore mixer_open() failures for the -a option
Christos Margiolis [Thu, 23 May 2024 00:57:25 +0000 (02:57 +0200)]
mixer(8): Ignore mixer_open() failures for the -a option

The most likely reason mixer_open() will fail is because either the
device doesn't exist, or because it is disabled, so there is not reason
to kill the application. Instead, continue and print the rest of the
enabled mixers.

PR: 277615
Sponsored by: The FreeBSD Foundation
MFC after: 1 day
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D45151

7 days agosound: Handle unavailable devices in various OSS IOCTLs
Christos Margiolis [Thu, 23 May 2024 00:57:17 +0000 (02:57 +0200)]
sound: Handle unavailable devices in various OSS IOCTLs

mixer(8)'s -a option is used to print information about all mixer
devices in the system. To do this, it loops from 0 to
mixer_get_nmixers(), and tries to open "/dev/mixer%d". However, this
approach doesn't work when there are disabled/unregistered mixers in the
system, or when an audio device simply doesn't have a mixer.

mixer_get_nmixers() calls SNDCTL_SYSINFO and returns
oss_sysinfo->nummixers, whose value is the number of currently _enabled_
mixers only. Taking the bug report mentioned below (277615) as an
example, suppose a system with 8 mixer devices total, but 3 of them are
either disabled or non-existent, which means they will not show up under
/dev, meaning we have 5 enabled mixer devices, which is also what the
value of oss_sysinfo->nummixers will be. What mixer(8) will do is loop
from 0 to 5 (instead of 8), and start calling mixer_open() on
/dev/mixer0, up to /dev/mixer4, and as is expected, the first call will
fail right away, hence the error shown in the bug report.

To fix this, modify oss_sysinfo->nummixers to hold the value of the
maximum unit in the system, which, although not necessarily "correct",
is more intuitive for applications that will want to use this value to
loop through all mixer devices.

Additionally, notify applications that a device is
unavailable/unregistered instead of skipping it. The current
implementations of SNDCTL_AUDIOINFO, SNDCTL_MIXERINFO and
SNDCTL_CARDINFO break applications that expect to get information about
a device that is skipped. Related discussion can be found here:
https://reviews.freebsd.org/D45135#1029526

It has to be noted, that other applications, apart from mixer(8), suffer
from this.

PR: 277615
Sponsored by: The FreeBSD Foundation
MFC after: 1 day
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D45256

7 days agosound: Separate implementations for SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO
Christos Margiolis [Thu, 23 May 2024 00:57:04 +0000 (02:57 +0200)]
sound: Separate implementations for SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO

FreeBSD's implementation of SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO
does not exactly work as intended. The problem is essentially that both
IOCTLs return the same information, while in fact the information
returned currently by dsp_oss_audioinfo() is what _only_
SNDCTL_ENGINEINFO is meant to return.

This behavior is also noted in the OSS manual [1] (see bold paragraph in
"Audio engines and device files" section), but since e8c0d15a64fa
("sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9)") we can
actually fix this, because we now expose only a single device for each
soundcard, and create the engines (channels) internally.
SNDCTL_ENGINEINFO will now report info about all channels in a given
device, and SNDCTL_AUDIOINFO[_EX] will only report information about
/dev/dspX.

To make this work, we also have to modify the SNDCTL_SYSINFO IOCTL to
report the number of audio devices and audio engines correctly.

While here, modernize the minimum and maximum channel counting in both
SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO. Currently these IOCTLs will
report only up to 2 channels, which is no longer the case.

[1] http://manuals.opensound.com/developer/SNDCTL_AUDIOINFO.html

PR: 246231, 252761
Sponsored by: The FreeBSD Foundation
MFC after: 1 day
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D45164

7 days agogeom: Remove sysctl.h
Warner Losh [Wed, 22 May 2024 22:23:45 +0000 (16:23 -0600)]
geom: Remove sysctl.h

These files don't need sysctl.h, so remove it.

Sponsored by: Netflix

7 days agosnd_hda: Add patch for Asus UX331UAL
Lutz Bichler [Wed, 22 May 2024 22:19:50 +0000 (00:19 +0200)]
snd_hda: Add patch for Asus UX331UAL

PR: 242802
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D45238

7 days agomqueuefs: mark newly allocated vnode as constructed, under the lock
Konstantin Belousov [Wed, 22 May 2024 02:39:59 +0000 (05:39 +0300)]
mqueuefs: mark newly allocated vnode as constructed, under the lock

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 days agomqueuefs: uma_zfree() can be postponed until mqfs sx mi_lock is dropped
Konstantin Belousov [Wed, 22 May 2024 01:46:28 +0000 (04:46 +0300)]
mqueuefs: uma_zfree() can be postponed until mqfs sx mi_lock is dropped

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 days agomqueuefs: minor style pass
Konstantin Belousov [Wed, 22 May 2024 02:52:47 +0000 (05:52 +0300)]
mqueuefs: minor style pass

Also remove not needed inclusion of sys/cdefs.h.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 days agoFix typo
Warner Losh [Wed, 22 May 2024 21:05:55 +0000 (15:05 -0600)]
Fix typo

ioclt -> ioctl. <blush>

Fixes: 08b452033834
Noticed by: Thomas Mueller and John W. De Boskey
Pointy hat to: imp
Sponsored by: Netflix

7 days agoautofs: Fix cross-threading on file to delete
Warner Losh [Wed, 22 May 2024 20:44:05 +0000 (14:44 -0600)]
autofs: Fix cross-threading on file to delete

We want to delete the new file, which is installed in man4 not man5.

Noticed by: Gary Jennejohn
Fixes: a03e8a40d404
Sponsored by: Netflix

7 days agoLinuxKPI: 802.11: rename chanctx_conf for consistency
Bjoern A. Zeeb [Mon, 13 May 2024 21:03:31 +0000 (21:03 +0000)]
LinuxKPI: 802.11: rename chanctx_conf for consistency

We used to call the struct ieee80211_chanctx_conf variable "conf"
in some places but that becomes confusing with bss_conf and other
"conf" bits.  On the vif it is already called chanctx_conf thus also
rename it on the internal struct lkpi_chanctx and for our variables
in the implementation.

This should not have any external visibility.
No functional changes intended.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45185

7 days agoLinuxKPI: 802.11: change teardown order to avoid iwlwifi firmware crashes
Bjoern A. Zeeb [Wed, 22 May 2024 02:24:51 +0000 (02:24 +0000)]
LinuxKPI: 802.11: change teardown order to avoid iwlwifi firmware crashes

While the previous order worked well for iwlwifi 22000 and later chipsets
(AXxxx, BE200), earlier chipsets had trouble and ran into firmware crashes.
Change the teardown order to avoid these problems.  The inline comments
in lkpi_sta_run_to_init() (and lkpi_disassoc()) try to document the new
order and also the old problems we were seeing (too early sta removal or
silent non-removal) leading to follow-up problems.

There is a possible further problem still lingering but a lot harder to
trigger (see comment in review) and likely related to some other doings
so we'll track it separately.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
PR: 275255
Tested with: AX210, 8265 (bz); 9260 (Bakul Shah)
Differential Revision: https://reviews.freebsd.org/D45293

7 days agozzz: Fix output formatting when suspend state not supported
Oleksandr Kryvulia [Wed, 22 May 2024 20:21:18 +0000 (14:21 -0600)]
zzz: Fix output formatting when suspend state not supported

Reviewed by: imp (who also simplified things a little)
Differenetial Revision: https://reviews.freebsd.org/D45299

7 days agoAdd function to OSD to get values without taking the lock.
Stephen J. Kiernan [Thu, 4 Apr 2024 00:12:57 +0000 (20:12 -0400)]
Add function to OSD to get values without taking the lock.

There are some cases of OSD use where the value is only initialized once
at a point where successive access of the value can be done so safely
without the need to take the lock.

Reviewed by: markj
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D44631

7 days agoblackhole.4: improve man page
Michael Tuexen [Wed, 22 May 2024 18:36:24 +0000 (20:36 +0200)]
blackhole.4: improve man page

Not the connection is dropped, but the incoming SYN segment.
Reviewed by: concussious.bugzilla_runbox.com
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D45296

7 days agosrc.conf.5: Regen
Andrew Turner [Wed, 22 May 2024 17:00:17 +0000 (17:00 +0000)]
src.conf.5: Regen

7 days agoarm64: Allow userspace to be built with PAC and BTI
Andrew Turner [Wed, 22 May 2024 15:54:32 +0000 (15:54 +0000)]
arm64: Allow userspace to be built with PAC and BTI

Add the WITH/WITHOUT_BRANCH_PROTECTION build flags. This can be used
to enable the use of pointer authentication (FEAT_PAuth) and branch
target identification (FEAT_BTI) in userspace.

The kernel already handles both of these is userspace, we just need
to enable it.

Leave disabled for a short period for this to settle before enabling.

Reviewed by: emaste
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42596

7 days agoriscv: Implement atomic operations
Ruslan Bukin [Wed, 22 May 2024 15:07:27 +0000 (16:07 +0100)]
riscv: Implement atomic operations

Implement atomic_load_acq_16, atomic_store_rel_16.

These are needed by bhyve(8) PCIe bus emulation code.

Group 16-bit atomic functions similarly to 32 and 64-bit.

Reviewed by: mhorne
Differential Revision: https://reviews.freebsd.org/D45228

7 days agoriscv: Fix SSTC extension support
Ruslan Bukin [Wed, 22 May 2024 14:51:45 +0000 (15:51 +0100)]
riscv: Fix SSTC extension support

From the SSTC spec:
"If the stimecmp (supervisor-mode timer compare) register is implemented,
then STIP is read-only in mip and reflects the supervisor-level timer
interrupt signal resulting from stimecmp. This timer interrupt signal
is cleared by writing stimecmp with a value greater than the current time
value."

This fixes operation in Spike with sstc extension enabled.
Example:
  spike --isa RV64IMAFDCH_zicntr_zihpm_sstc

Reviewed by: mhorne
Differential Revision: https://reviews.freebsd.org/D45226

7 days agotpm_if.m: declare bus addresses as bus_size_t not bus_addr_t
Ryan Libby [Wed, 22 May 2024 14:55:04 +0000 (07:55 -0700)]
tpm_if.m: declare bus addresses as bus_size_t not bus_addr_t

Do like bus_space(9) does.  This fixes the build on platforms where
bus_addr_t and bus_size_t are different (like i386 PAE).

Reviewed by: jhibbits
Fixes: c2e9c5bbf022 tpm: Refactor TIS and add a SPI attachment
Differential Revision: https://reviews.freebsd.org/D45287

7 days agousr.bin/top: fix displaying load average for loads of at least 100
Piotr Kubaj [Tue, 21 May 2024 10:28:35 +0000 (12:28 +0200)]
usr.bin/top: fix displaying load average for loads of at least 100

After top registers load average of at least 100 which then gets reduced to
below 100, there are left stray digits.
Supporting load over 100 requires increasing the width only to 6, but since
we support over 1000 CPU's now, let's increase it to 7.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D45284

7 days agomac_do(4): fix typo
Baptiste Daroussin [Wed, 22 May 2024 13:56:03 +0000 (15:56 +0200)]
mac_do(4): fix typo

Reported by: Gary Jennejohn <garyj@gmx.de>

7 days agorc.d: add a service jails config to all base system services
Alexander Leidinger [Wed, 22 May 2024 13:31:47 +0000 (15:31 +0200)]
rc.d: add a service jails config to all base system services

This gives more permissions to services (e.g. network access to
services which require this) when they are started as an automatic
service jail.

The sshd patch is important for the sshd-related functionality as
described in the man-page in the service jails part.

The location of the added env vars is supposed to allow overriding them
in rc.conf, and to hard-disable the use of svcj for some parts where it
doesn't make sense or will not work.

Only a subset of all of the services are fully tested (I'm running this
since more than a year with various services started as service jails).
The untested parts should be most of the time ok, in some edge-cases
more permissions are needed inside the service jail.
Differential Revision: https://reviews.freebsd.org/D40371

7 days agorc: add service jails framework
Alexander Leidinger [Wed, 22 May 2024 13:28:11 +0000 (15:28 +0200)]
rc: add service jails framework

This takes a rc.d-service and starts it in a jail which shares the same
root-path as the host (or parent jail) and may inherit the network from
the host (or parent jail). Per service there is the possibility to
specify some arguments which give more permissions (e.g. netv4, netv6,
sysvipc...).
Reviewed by: bcr (man page)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D40370

7 days agoarm64: Return newline at the end of NOTES back
Dmitry Salychev [Wed, 22 May 2024 13:20:40 +0000 (15:20 +0200)]
arm64: Return newline at the end of NOTES back

It fixes LINT kernel build after ac4ddc467bfe.

MFC after: 3 days

7 days agoRELNOTES: document MAC/do
Baptiste Daroussin [Wed, 22 May 2024 12:05:57 +0000 (14:05 +0200)]
RELNOTES: document MAC/do

7 days agomac_do: add a new MAC/do policy and mdo(1) utility
Baptiste Daroussin [Thu, 9 May 2024 22:03:28 +0000 (00:03 +0200)]
mac_do: add a new MAC/do policy and mdo(1) utility

This policy enables a user to become another user without having to be
root (hence no setuid binary). it is configured via rules using sysctl
security.mac.do.rules

For example:
security.mac.do.rules=uid=1001:80,gid=0:any

The above rule means the user identifier by the uid 1001 is able to
become user 80
Any user of the group 0 are allowed to become any user on the system.

The mdo(1) utility expects the MAC/do policy to be installed and its
rules defined.

Reviewed by: des
Differential Revision: https://reviews.freebsd.org/D45145

7 days agoarm64: Fixed IOMMU compilation errors
Dmitry Salychev [Tue, 21 May 2024 20:25:59 +0000 (22:25 +0200)]
arm64: Fixed IOMMU compilation errors

These are missing changes after 1228b93b410a when ref_count was
removed from bus_dma_tag_common and 1e3f42b6bad5, when the address
arguments were switched to pointers.

Reviewed by: jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45289

7 days agosys: Build arm64 per-thread SSP with GCC
Andrew Turner [Wed, 22 May 2024 08:20:01 +0000 (08:20 +0000)]
sys: Build arm64 per-thread SSP with GCC

It has been supported since GCC 9. It is unlikely anything older than
that will build the kernel so mark it as supported by GCC.

Reviewed by: brooks, jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45267

7 days agodev/hwpmc: Fix the dmc620 MD4 macro
Andrew Turner [Wed, 22 May 2024 08:19:49 +0000 (08:19 +0000)]
dev/hwpmc: Fix the dmc620 MD4 macro

Add braces to the dmc620 MD4 macro to fix the GCC build.

Reviewed by: brooks, imp, jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45266

7 days agopci: Fix pci_host_generic_acpi with gcc
Andrew Turner [Wed, 22 May 2024 08:19:38 +0000 (08:19 +0000)]
pci: Fix pci_host_generic_acpi with gcc

In pci_host_generic_acpi.c we loop over pci_acpi_quirks to check if
we need to handle any quirks. GCC doesn't like the terminatin as it
sets a fixed width string to 0.

As this the array is only ever used in this file change to use nitems
to find when to stop the loop.

Reviewed by: brooks, imp, jhb, emaste
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45265

7 days agoarm64/rockchip: Fix the build with GCC
Andrew Turner [Wed, 22 May 2024 08:19:19 +0000 (08:19 +0000)]
arm64/rockchip: Fix the build with GCC

We were missing brackets in GPIO_FLAGS_PINCTRL. Without them GCC
complains a use is ambiguous. Fix by adding the needed brackets.

Reviewed by: manu, brooks, imp, jhb, emaste
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45264

7 days agoarm64: Use the pointer auth register defines
Andrew Turner [Wed, 22 May 2024 08:19:06 +0000 (08:19 +0000)]
arm64: Use the pointer auth register defines

When building with gcc it complains the pointer authentication
registers aren't valid with the architecture level we are targeting.
Fix this by using the alternative spelling of these registers accesses
through MRS_REG_ALT_NAME.

Reviewed by: jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45263

7 days agoarm64: Add the pointer auth registers to armreg.h
Andrew Turner [Wed, 22 May 2024 08:18:54 +0000 (08:18 +0000)]
arm64: Add the pointer auth registers to armreg.h

Add the pointer authentication registers to armreg.h. These will be
used to support pointer authentication in a kernel built with GCC.

Reviewed by: jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45262

7 days agoarm64: Use the UL macro in TCR_EL1 defines
Andrew Turner [Wed, 22 May 2024 08:18:39 +0000 (08:18 +0000)]
arm64: Use the UL macro in TCR_EL1 defines

While clang can handle numbers with a UL suffix in assembly files
gcc/gas is unable to. Switch to use the UL macro for TCR_EL1 defines as
some are used in locore.S

Reviewed by: brooks, jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45261

7 days agosys/sys: Fix __builtin_is_aligned fallback
Andrew Turner [Wed, 22 May 2024 08:18:26 +0000 (08:18 +0000)]
sys/sys: Fix __builtin_is_aligned fallback

When the compiler doesn't provide __builtin_is_aligned we use
macro as a fallback. The macro was missing brackets around one
argument. This could lead to incorrect results when the argument is
more complex than a single stagement.

Fix this by adding the needed brackets.

Reviewed by: brooks, imp, jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45260

7 days agocsu: Find the main pointer through the GOT
Andrew Turner [Wed, 22 May 2024 08:18:10 +0000 (08:18 +0000)]
csu: Find the main pointer through the GOT

Use the Global Offset Table to find the location of main in crt1. With
lld the old code would point to main@plt, however ld.bfd fails to link
when main is in a shared library.

Fix this by using the GOT address to find main as it works with both
lld and bfd.

Reviewed by: jrtc27
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45259

7 days agostand/kboot: Fix the linker script OUTPUT_FORMAT
Andrew Turner [Wed, 22 May 2024 08:17:52 +0000 (08:17 +0000)]
stand/kboot: Fix the linker script OUTPUT_FORMAT

ld.bfd doesn't understand elf64-aarch64 but does have
elf64-littleaarch64. Switch to this so we can link kboot with it.

While here switch to the single format version. We are unlikely to
support booting from a big-endian Linux.

Reviewed by: imp, emaste
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45258

7 days agostand/efi: Fix for binutils when targeting arm64
Andrew Turner [Wed, 22 May 2024 08:17:26 +0000 (08:17 +0000)]
stand/efi: Fix for binutils when targeting arm64

When linking with ld.bfd it complain with the following:

/usr/local/bin/aarch64-unknown-freebsd14.0-ld: start.o: relocation
 R_AARCH64_ABS32 against `__data_size' can not be used when making a
 shared object

Fix this by marking the __data_size with ABSOLUTE. This returns a
non-relocatable value which appears to be the same behaviour of lld.

Reviewed by: imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45257

7 days agodaemon: Add -C (--restart-count) option
Juraj Lutter [Thu, 25 Apr 2024 13:40:00 +0000 (15:40 +0200)]
daemon: Add -C (--restart-count) option

Add a new option (-C, --restart-count) to specify the maximum
number of times that the controlled process is restarted if
restart (-r) is restarted.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44944

7 days agoif_vlan: handle VID conflicts
Kristof Provost [Tue, 21 May 2024 11:31:13 +0000 (13:31 +0200)]
if_vlan: handle VID conflicts

If we fail to change the vlan id we have to undo the removal (and vlan id
change) in the error path. Otherwise we'll have removed the vlan object from the
hash table, and have the wrong vlan id as well. Subsequent modification attempts
will then try to remove an entry which doesn't exist, and panic.

Undo the vlan id modification if the insertion in the hash table fails, and
re-insert it under the original vlan id.

PR: 279195
Reviewed by: zlei
MFC atfer: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D45285

7 days agotime: siginfo_recvd needs to be marked volatile
Kyle Evans [Wed, 22 May 2024 05:36:29 +0000 (00:36 -0500)]
time: siginfo_recvd needs to be marked volatile

sig_atomic_t does not imply volatility, we must do it ourselves to avoid
caching of siginfo_recvd loads.

Sponsored by: Klara, Inc.

7 days agocapsicum: SIGTRAP is delivered also on ECAPMODE error.
Pawel Jakub Dawidek [Mon, 22 Jan 2024 21:37:04 +0000 (13:37 -0800)]
capsicum: SIGTRAP is delivered also on ECAPMODE error.

Approved by: oshogbo (mentor)

8 days agoFix build.
Pawel Jakub Dawidek [Wed, 22 May 2024 03:56:59 +0000 (03:56 +0000)]
Fix build.

8 days agoSimplify the code.
Pawel Jakub Dawidek [Sun, 19 May 2024 01:58:14 +0000 (01:58 +0000)]
Simplify the code.

Obtained from: Fudo Security
Reviewed by: asomers, imp
Approved by: oshogbo (mentor)
Differential Revision: https://reviews.freebsd.org/D45247

8 days agoAllow DEBUG_SH=rc:all to debug all rc.d
Simon J. Gerraty [Wed, 22 May 2024 02:44:20 +0000 (19:44 -0700)]
Allow DEBUG_SH=rc:all to debug all rc.d

Usually a bad idea but there are exceptions to every rule.
Allso debugging all rc.d scripts or all with a given arg.

8 days agolinprocfs: use %z for size_t arguments
Warner Losh [Wed, 22 May 2024 02:01:58 +0000 (20:01 -0600)]
linprocfs: use %z for size_t arguments

64-bit doesn't care or give a warning, but i386 compile complains
(rightly) that these are size_t and need a %z modifier.

Fixes: 25a04527b706
Sponsored by: Netflix

8 days agolinprocfs: Add support for proc/sysvipc/{msg,sem,shm}
Ricardo Branco [Sun, 12 May 2024 20:26:15 +0000 (22:26 +0200)]
linprocfs: Add support for proc/sysvipc/{msg,sem,shm}

Reviewed by: imp,kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1232

8 days agokern/rman: mark rman get functions as taking constants
Elliott Mitchell [Fri, 10 May 2024 16:13:39 +0000 (09:13 -0700)]
kern/rman: mark rman get functions as taking constants

The arguments are left completely unchanged by these functions.  This
allows passing constant pointers for verifying ownership, but not
modifying the contents.

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1224

8 days agokern/rman: update rman_make_alignment_flags()
Elliott Mitchell [Thu, 9 May 2024 04:47:09 +0000 (21:47 -0700)]
kern/rman: update rman_make_alignment_flags()

The flsl() function makes use of hardware functionality to compute the
value faster than this loop.  The only deviation from flsl() is at 0.

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1224

8 days agokern/rman: remove rman_reserve_resource_bound(), partially revert 13fb6657723
Elliott Mitchell [Thu, 9 May 2024 04:55:28 +0000 (21:55 -0700)]
kern/rman: remove rman_reserve_resource_bound(), partially revert 13fb6657723

Not once has rman_reserve_resource_bound() ever been used.  There are
though several uses of RF_ALIGNMENT.  In light of this remove this
extra and leave the actually used portion in place.

This partially reverts commit 13fb6657723c1e9cb47bbd286942b432a4306b96.

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1224

8 days agokern/rman: update debugging lines in subr_rman.c
Elliott Mitchell [Thu, 9 May 2024 04:15:53 +0000 (21:15 -0700)]
kern/rman: update debugging lines in subr_rman.c

Rather than hard-code the function name, use __func__ instead.  Apply
some style and adjust indentation as appropriate.  Remove the no longer
required braces.

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1224

8 days agokern/rman: update DPRINTF() macro, avoid semicolon swallowing match function
Elliott Mitchell [Thu, 9 May 2024 05:34:49 +0000 (22:34 -0700)]
kern/rman: update DPRINTF() macro, avoid semicolon swallowing match function

Using a variadic macro allows passing everything properly to printf().
Using the do { } while(0) construct ensures the macro acts like any
other single statement.  This shows just how long some of this has
existed.

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1224

8 days agolibnvmf: avoid resource leak
Pierre Pronchery [Thu, 16 May 2024 14:34:34 +0000 (16:34 +0200)]
libnvmf: avoid resource leak

In nvmf_host_fetch_discovery_log_page(), the log variable may have been
allocated on the heap during the first loop cycle, and should be
free()'d before exiting upon errors.

Reported by: Coverity
CID: 1545034
Sponsored by: The FreeBSD Foundation

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1239

8 days agosmb.4/smbfs.4: distinguishable descriptions, +SPDX
Alexander Ziaee [Thu, 16 May 2024 21:54:30 +0000 (17:54 -0400)]
smb.4/smbfs.4: distinguishable descriptions, +SPDX

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1241

8 days agounionfs.4: describe better, tag SPDX
Alexander Ziaee [Thu, 16 May 2024 22:49:01 +0000 (18:49 -0400)]
unionfs.4: describe better, tag SPDX

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1242

8 days agoautofs manuals: align lists, tag SPDX
Alexander Ziaee [Thu, 16 May 2024 23:18:30 +0000 (19:18 -0400)]
autofs manuals: align lists, tag SPDX

MFC after: 3 days
Fixes: 286c4906d60f (add -noauto), 3914ddf8a7b1 (import autofs)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1243

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1243

8 days agoLinuxKPI: add FIELD_PREP_CONST()
Bjoern A. Zeeb [Mon, 13 May 2024 17:40:26 +0000 (17:40 +0000)]
LinuxKPI: add FIELD_PREP_CONST()

Add FIELD_PREP_CONST() like FIELD_PREP() without any extra checks likely
expected on this version in Linux.  This is called by an updated wireless
driver.

Sposnored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D45180

8 days agoiavf(4): Improve man page
Eric Joyner [Tue, 21 May 2024 23:24:31 +0000 (01:24 +0200)]
iavf(4): Improve man page

MFC after: 3 days
Reviewed by: erj
Differential Revision: https://reviews.freebsd.org/D43093

8 days agoftpd: stop using -g flag for /bin/ls
Allan Jude [Tue, 21 May 2024 22:40:12 +0000 (22:40 +0000)]
ftpd: stop using -g flag for /bin/ls

In 3bfbb521 the behaviour of ls was changed such that -g was no longer
a noop for compatibility with BSD 4.3, but instead changed the output
of long mode to exclude the owner of the file and display only the
group.

Update how FTPd invokes ls to restore the previous behaviour

Reported-by: Andrew Fengler <andrew.fengler@scaleengine.com>
Reviewed-by: jrtc27, des, imp
MFC after: 3 days
Sponsored-by: ScaleEngine Inc.
Fixes: 3bfbb521fef5 ("ls: Improve POSIX compatibility for -g and -n.")

8 days agoaccess(2): Discourage use of these system calls.
Dag-Erling Smørgrav [Tue, 21 May 2024 22:35:22 +0000 (00:35 +0200)]
access(2): Discourage use of these system calls.

Fixes: 421025a274fb
PR: 262895
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D45240

8 days agoLinuxKPI: add kvmemdup()
Bjoern A. Zeeb [Mon, 13 May 2024 17:43:25 +0000 (17:43 +0000)]
LinuxKPI: add kvmemdup()

Add kvmemdup() as a variant of kmemdup().  While currently it could
just call kmemdup() we duplicate the code and use kvmalloc() in case
someone will change the implementation of kvmalloc/kvfree in slab.h.
This is used by an updated wireless driver.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D45181

8 days agoLinuxKPI: 802.11: fix for_each_sta_active_link()
Bjoern A. Zeeb [Tue, 21 May 2024 21:58:47 +0000 (21:58 +0000)]
LinuxKPI: 802.11: fix for_each_sta_active_link()

Likely a c&p error from for_each_vif_active_link() to
for_each_sta_active_link().
We are checking the nitems on the vif instead of the sta in this macro.
Function wise there is no difference as the arrays are the same size
but for correctness fix this.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

8 days agoRegen
Mariusz Zaborski [Tue, 21 May 2024 20:02:50 +0000 (22:02 +0200)]
Regen

8 days agocapsicum: allow rfork(2) in capability mode
Edward Tomasz Napierala [Tue, 21 May 2024 19:55:09 +0000 (21:55 +0200)]
capsicum: allow rfork(2) in capability mode

Reviewed by: brooks, rwatson
MFC after: 4 days
Differential Revision: https://reviews.freebsd.org/D45040

8 days agoglabel.8: Describe cases related to permissions / existing mounts
Chris Moerz [Tue, 21 May 2024 18:10:11 +0000 (15:10 -0300)]
glabel.8: Describe cases related to permissions / existing mounts

Specially, note some requirements for label changes:

- glabel requires write permission on device
- filesystems first need to be unmounted for new labels to persist
  across reboots
- if the affected device node holds the filesystem root, single-user
  mode with r/o mount will be required.

Also, while here, apply some formatting tweaks.

PR: 276724
Reported by: Alex Matei <matei35@yahoo.com>
Reviewed by: gbe, jrm, Alexander Ziaee <concussious@runbox.com>
Differential Revision: https://reviews.freebsd.org/D44394

8 days agogetblk: fail faster with GB_LOCK_NOWAIT
Ryan Libby [Tue, 21 May 2024 17:21:50 +0000 (10:21 -0700)]
getblk: fail faster with GB_LOCK_NOWAIT

If we asked not to wait on a lock, and then we failed to get a buf lock
because we would have had to wait, then just return the error.  This
avoids taking the bufobj lock and a second trip to lockmgr.

Reviewed by: mckusick, kib, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D45245

8 days agobuf: define and use BUF_DISOWNED
Ryan Libby [Tue, 21 May 2024 17:21:50 +0000 (10:21 -0700)]
buf: define and use BUF_DISOWNED

Implement an API where previously code was directly reaching into the
buf's internal lock.

Reviewed by: mckusick, imp, kib, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D45249

8 days agolockmgr: make lockmgr_disowned public and use it
Ryan Libby [Tue, 21 May 2024 17:21:50 +0000 (10:21 -0700)]
lockmgr: make lockmgr_disowned public and use it

Reviewed by: mckusick, kib, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D45248

8 days agocryptocheck: Don't test Chacha20-Poly1305 with an IV size of 8
John Baldwin [Tue, 21 May 2024 16:42:12 +0000 (09:42 -0700)]
cryptocheck: Don't test Chacha20-Poly1305 with an IV size of 8

OpenSSL 3.0+ doesn't support an IV size of 8 either for the Chacha20
stream cipher or the AEAD combination with Poly1305.  This did work
previously with OpenSSL 1.1.

Reviewed by: markj
Sponsored by: AFRL, DARPA
Differential Revision: https://reviews.freebsd.org/D45280

8 days agoifconfig: Redo fix vlan/vlanproto reconfiguration
Zhenlei Huang [Tue, 21 May 2024 16:35:01 +0000 (00:35 +0800)]
ifconfig: Redo fix vlan/vlanproto reconfiguration

When the if_vlan(4) interface has not been fully configured, i.e., a
bare interface without a physical interface associated with it,
retrieving the current settings of it and unconditionally overwriting
`params` will result in losing vlandev settings in `params`. That will
lead to failing to associate the if_vlan(4) interface with the requested
physical interface and the false report 'both vlan and vlandev must be
specified'.

Fix that by checking if the vlan interface has been fully configured.

The basic VLAN test is slightly modified to cover this case.

PR: 279181
Reviewed by: kp
Tested by: Mike Tancsa <mike@sentex.net>
Fixes: b82b8055ad44 ifconfig: fix vlan/vlanproto reconfiguration
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45283

8 days agofix (nuageinit): SSH keys are not handled in metadata but in userdata
Jeremy Collin [Tue, 21 May 2024 14:52:23 +0000 (16:52 +0200)]
fix (nuageinit): SSH keys are not handled in metadata but in userdata

MFC After: 1 day

8 days agouipc_shm: Fix double check for shmfd->shm_path
Ricardo Branco [Mon, 20 May 2024 13:09:08 +0000 (15:09 +0200)]
uipc_shm: Fix double check for shmfd->shm_path

Reviewed by: emaste, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/1250

8 days agoAdd man page for the ice network driver.
Mathieu Simon [Tue, 21 May 2024 05:49:50 +0000 (07:49 +0200)]
Add man page for the ice network driver.

PR: 262892
MFC after: 3 days
Reviewed by: concussious.bugzilla@runbox.com, erj
Differential Revision: https://reviews.freebsd.org/D45270

9 days agosound: Make SNDST_UNVLBUF_MAX a power of two
Christos Margiolis [Mon, 20 May 2024 17:41:18 +0000 (19:41 +0200)]
sound: Make SNDST_UNVLBUF_MAX a power of two

Fixes: 074d337ad618 ("sound: Check user-supplied size passed to SNDSTIOC_ADD_USER_DEVS*")
Reported by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 day
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D45277

9 days agolock.9: LK_TIMELOCK is a lockmgr flag, not lockinit
Ryan Libby [Mon, 20 May 2024 16:48:32 +0000 (09:48 -0700)]
lock.9: LK_TIMELOCK is a lockmgr flag, not lockinit

Reviewed by: imp, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D45246

9 days agobsdinstall: Fix wifi network selection size
Renato Botelho [Mon, 20 May 2024 13:43:35 +0000 (10:43 -0300)]
bsdinstall: Fix wifi network selection size

Use correct variable while creating dialog used to select among
available wireless networks

Approved by: asiciliano
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D45271

9 days agoman: the exists function needs to validate the first parameter
Wolfram Schneider [Mon, 20 May 2024 16:02:21 +0000 (16:02 +0000)]
man: the exists function needs to validate the first parameter

This fixes an issue with the ".so " macro for FreeBSD
ports manual pages.

PR: 275978
Reported by: Jamie Landeg-Jones <jamie@catflap.org>
MFC after: 1 week

Differential Revision: https://reviews.freebsd.org/D45231 (discussion)