]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agonetlink: Fix "version introduced" documentation
Tom Hukins [Sat, 4 Mar 2023 15:59:02 +0000 (08:59 -0700)]
netlink: Fix "version introduced" documentation

netlink(4) and associated features will exist in FreeBSD 14.0 but they
will also exist in 13.2, an older version, from commits such as 02b958b1
and b309249b.

This commit needs merging to stable/13 and releng/13.2.

MFC after: 2days (needs to be in RC2)
Reviewed by: imp,melifaro
Pull Request: https://github.com/freebsd/freebsd-src/pull/651

14 months agonetpfil tests: Add functions for testing routing scenarios
Kristof Provost [Sat, 4 Mar 2023 13:35:24 +0000 (14:35 +0100)]
netpfil tests: Add functions for testing routing scenarios

Many pf tests use identical setup where one jail is a router and
optionally another jail is a server. Add functions to create such jails
for IPv6 and IPv4 and functions to perform tests on such setup.

Add tests using those functions: scrub actions, routing table, tcp
sequence number modulation.

Reviewed by: kp
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D38126

14 months agoifconfig: remove unused variable
Kristof Provost [Thu, 2 Mar 2023 09:30:57 +0000 (10:30 +0100)]
ifconfig: remove unused variable

In printgroup() 'cnt' is set, but never read. Remove it.

Sponsored by: Rubicon Communications, LLC ("Netgate")

14 months agolinux(4): Fixup 5c32488de0 mis-merge
Dmitry Chagin [Sat, 4 Mar 2023 09:42:04 +0000 (12:42 +0300)]
linux(4): Fixup 5c32488de0 mis-merge

14 months agolinux(4): Add a counterpart to linux_ifflags
Dmitry Chagin [Sat, 4 Mar 2023 09:26:48 +0000 (12:26 +0300)]
linux(4): Add a counterpart to linux_ifflags

For further use in linux_ioctl_socket add bsd_to_linux_ifflags() which
accepts FreeBSD interface flags and translate it to Linux if flags.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38873

14 months agolinux(4): Assert that the FreeBSD size of struct sockaddr is equal to Linux
Dmitry Chagin [Sat, 4 Mar 2023 09:11:39 +0000 (12:11 +0300)]
linux(4): Assert that the FreeBSD size of struct sockaddr is equal to Linux

Our code depends on the fact that the size of struct sockaddr and
the size of sa_data is equal between FreeBSD and Linux.

14 months agolinux(4): Drop excess assert that Linux IFNAMSIZ is equal to FreeBSD
Dmitry Chagin [Sat, 4 Mar 2023 09:11:39 +0000 (12:11 +0300)]
linux(4): Drop excess assert that Linux IFNAMSIZ is equal to FreeBSD

While here use _Static_assert() instead of the older CTASSERT().

14 months agolinux(4): Improve linux_ifconf readability
Dmitry Chagin [Sat, 4 Mar 2023 09:11:39 +0000 (12:11 +0300)]
linux(4): Improve linux_ifconf readability

Initialize max_len and full variables in a code block where
they are used.

14 months agolinux(4): Fixup of the pointer cast when comparing to an integer
Dmitry Chagin [Sat, 4 Mar 2023 09:11:39 +0000 (12:11 +0300)]
linux(4): Fixup of the pointer cast when comparing to an integer

14 months agolinux(4): Add net epoch assert to the linux_ifhwaddr, linux_ifflags
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Add net epoch assert to the linux_ifhwaddr, linux_ifflags

Now this functions are intended to use in the net epoch.

Reviewed by: emaste, melifaro
Differential Revision: https://reviews.freebsd.org/D38795

14 months agolinux(4): Refactor socket ioctl path to avoid referencing an unstable interfaces
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Refactor socket ioctl path to avoid referencing an unstable interfaces

Split the linux_ioctl_socket() function on two counterparts, where
the linux_ioctl_socket_ifreq() intended to use in a code path which
requires the struct ifreq manipulation, i.e., translating in/out
values of the struct, while the linux_ioctl_socket() function is left
as is, it calls sys_ioctl() without touching in/out values.

Due to structures ifreq, sockaddr difference between FreeBSD and Linux
the linux_ioctl_socket_ifreq() calls kern_ioctl() directly, converting
in and out values to FreeBSD and to Linux accordingly.

Finally, modify the ifname_linux_to_bsd() to return error code, not
an unstable reference to the interface.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38794

14 months agolinux(4): Drop unncessary struct l_ifconf declaration from amd64/linux
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Drop unncessary struct l_ifconf declaration from amd64/linux

Its needed only for amd64/linux32 Linuxulator.

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

14 months agolinux(4): Rename struct l_ifreq members names to avoid conflicts with FreeBSD
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Rename struct l_ifreq members names to avoid conflicts with FreeBSD

For now we are using mixed names to access struct ifreq members, some
of Linux (ifr_name, ifr_ifindex), others of FreeBSD. To avoid conflicts
switch to use FreeBSD names.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D38792

14 months agolinux(4): Reduce code duplication between MD files
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Reduce code duplication between MD files

Move struct ifnet definitions under compat/linux.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38791

14 months agolinsysfs(4): Refactor to avoid referencing an unstable interfaces
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linsysfs(4): Refactor to avoid referencing an unstable interfaces

Enter the net epoch when traversing a list of interfaces. For that
split the ifname_linux_to_bsd() function on two counterparts, where
the ifname_linux_to_ifp() intended to use in epoch, while the
ifname_linux_to_bsd() intended to be a self-contained.
Until the linux_ioctl_coket() function is refactored, the
ifname_linux_to_bsd() temporarily returns interface outside
of the net epoch.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38790

14 months agolinux(4): Make linux_ifflags return a value
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Make linux_ifflags return a value

To simplify the use of the function in the printf-like statements.

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

14 months agolinux(4): Migrate to IfAPI
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Migrate to IfAPI

Migrate linux and linprocfs to use the IfAPI interfaces instead of
direct ifnet accesses.
The code initially writed by jhibbits@, and adapted by me to 3ab3c9c2.

Reviewed by: jhibbits
Differential Revision:  https://reviews.freebsd.org/D38735

14 months agoin_mcat.c: change multicast not member condition
Fidaullah Noonari [Tue, 28 Feb 2023 16:44:12 +0000 (09:44 -0700)]
in_mcat.c: change multicast not member condition

If there is no source filter entry => block if that's SSM ("exclude"
mode per RFC 3678 clause 3).  If there is an entry => check its action &
block if the action is "exclude".

It would be nice if the test case in this PR were converted into an ATF
test case, but not blocking on that.

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

14 months agoipfw: garbage collect ip_fw_chk_ptr
Gleb Smirnoff [Fri, 3 Mar 2023 18:29:44 +0000 (10:29 -0800)]
ipfw: garbage collect ip_fw_chk_ptr

It is a relict left from the old times when ipfw(4) was hooked
into IP stack directly, without pfil(9).

14 months agoarm64: disable the physical timer for now if HCR_EL2.E2H is set
Kyle Evans [Fri, 3 Mar 2023 17:02:19 +0000 (11:02 -0600)]
arm64: disable the physical timer for now if HCR_EL2.E2H is set

On some hardware, we can't clear HCR_EL2.E2H so accesses to the physical
timer hopelessly trap to EL2.  Stash off the value of HCR_EL2 and use it
in has_hyp() to avoid this.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D38884

14 months agopkgbase: Put termcap.small in the same package as termcap
Mark Johnston [Fri, 3 Mar 2023 17:00:14 +0000 (12:00 -0500)]
pkgbase: Put termcap.small in the same package as termcap

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D36951

14 months agong_atmllc: deprecate
Brooks Davis [Fri, 3 Mar 2023 16:20:29 +0000 (16:20 +0000)]
ng_atmllc: deprecate

With the deprecation of NgATM, ng_atmllc is the last vestage of ATM
support so deprecate it too.

MFC after: 3 days
Relnotes: yes

Reviewed by: manu, emaste
Differential Revision: https://reviews.freebsd.org/D38878

14 months agoNgATM: deprecate
Brooks Davis [Fri, 3 Mar 2023 16:20:18 +0000 (16:20 +0000)]
NgATM: deprecate

Support for ATM NICs was removed prior to FreeBSD 12.  At the time it
was unclear if this code was still useful without it.  Now the time has
come to finish removing support.

Add DREPRECATION NOTICEs to the manpages and gone_in(14, ...) warnings
in the constructors (or module init for ngatmbase).

MFC after: 3 days
Relnotes: yes

Reviewed by: manu, emaste
Differential Revision: https://reviews.freebsd.org/D38877

14 months agonanobsd: remove comment about keeping C++ enabled
Brooks Davis [Fri, 3 Mar 2023 16:13:44 +0000 (16:13 +0000)]
nanobsd: remove comment about keeping C++ enabled

It's no longer possible to disable C++ so there's no need to comment
on it.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D38883

14 months agoposixshm tests: Correct page size index checks
Mark Johnston [Fri, 3 Mar 2023 16:16:21 +0000 (11:16 -0500)]
posixshm tests: Correct page size index checks

MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.

14 months agodeadlkres: Make parameters settable with tunables
Mark Johnston [Fri, 3 Mar 2023 16:16:16 +0000 (11:16 -0500)]
deadlkres: Make parameters settable with tunables

MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.

14 months agobhyveload: Address compiler warnings and bump WARNS
Mark Johnston [Fri, 3 Mar 2023 14:52:17 +0000 (09:52 -0500)]
bhyveload: Address compiler warnings and bump WARNS

Mostly sprinkle __unused.  Also duplicate strings passed to addenv() so
that constant string literals can be passed.  No functional change
intended.

Reviewed by: corvink, rew, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38840

14 months agobhyvectl: Address compiler warnings and bump WARNS
Mark Johnston [Fri, 3 Mar 2023 14:32:48 +0000 (09:32 -0500)]
bhyvectl: Address compiler warnings and bump WARNS

Avoid unaligned accesses in cpu_vendor_intel() and address a few other
nits.  No functional change intended.

Reviewed by: corvink, rew, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38839

14 months agonetlink: fix vlan interface creation
Alexander V. Chernikov [Fri, 3 Mar 2023 16:01:34 +0000 (16:01 +0000)]
netlink: fix vlan interface creation

MFC after: 2 weeks

14 months agonetlink: add u8/u64 attribute fetcher accessors to snl(3).
Alexander V. Chernikov [Fri, 3 Mar 2023 14:05:40 +0000 (14:05 +0000)]
netlink: add u8/u64 attribute fetcher accessors to snl(3).

MFC after: 2 weeks

14 months agobsnmp: Remove "All Rights Reserved" from FreeBSD Foundation copyrights
Ed Maste [Fri, 3 Mar 2023 13:10:44 +0000 (08:10 -0500)]
bsnmp: Remove "All Rights Reserved" from FreeBSD Foundation copyrights

14 months agodtrace_proc.4: Fix the description of pr_sname
Mateusz Piotrowski [Fri, 3 Mar 2023 10:14:41 +0000 (11:14 +0100)]
dtrace_proc.4: Fix the description of pr_sname

MFC after: 2 weeks
Sponsored by: Klara Inc.
Sponsored by: ELW – Entsorgungsbetriebe der Landeshauptstadt Wiesbaden

14 months agonote that some arch independent code can live in dev (e.g. SMBios)
John-Mark Gurney [Fri, 3 Mar 2023 09:54:07 +0000 (01:54 -0800)]
note that some arch independent code can live in dev (e.g. SMBios)

14 months agosrc.conf.5: Regen after switching to WITHOUT_ATM
Emmanuel Vadot [Fri, 3 Mar 2023 07:50:15 +0000 (08:50 +0100)]
src.conf.5: Regen after switching to WITHOUT_ATM

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38846

14 months agoAdd description for WITH_ATM
Emmanuel Vadot [Thu, 2 Mar 2023 07:26:38 +0000 (08:26 +0100)]
Add description for WITH_ATM

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38845

14 months agoDisable ATM programs by default
Emmanuel Vadot [Thu, 2 Mar 2023 07:21:34 +0000 (08:21 +0100)]
Disable ATM programs by default

ATM is an old technology, remove build of related programs by default

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38844
Reviewed by: brooks, imp, emaste

14 months agodaemon: set supervise_enabled during argument processing
Ihor Antonov [Fri, 3 Mar 2023 05:17:02 +0000 (23:17 -0600)]
daemon: set supervise_enabled during argument processing

Now when supervsion mode has it's own variable there is really no
reason to set it separately from the rest of the variables. Move
initialization of supervise_enabled var to the argument processing
switch loop, where it belongs.

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

14 months agodaemon: decouple restart variable
Ihor Antonov [Fri, 3 Mar 2023 05:17:02 +0000 (23:17 -0600)]
daemon: decouple restart variable

The 'restart' variable was responsible for enablement of restart
behavior and for restart delay. While it may seem convenient it
leads to cluttering the exit/restart logic

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

14 months agodaemon: add braces to while loop
Ihor Antonov [Fri, 3 Mar 2023 05:17:02 +0000 (23:17 -0600)]
daemon: add braces to while loop

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

14 months agodaemon: simplify if/else chain
Ihor Antonov [Fri, 3 Mar 2023 05:17:02 +0000 (23:17 -0600)]
daemon: simplify if/else chain

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

14 months agodaemon: change type of listen_child() to C99 bool
Ihor Antonov [Fri, 3 Mar 2023 05:17:02 +0000 (23:17 -0600)]
daemon: change type of listen_child() to C99 bool

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

14 months agodaemon: flatten and simplify fork() logic
Ihor Antonov [Fri, 3 Mar 2023 05:17:02 +0000 (23:17 -0600)]
daemon: flatten and simplify fork() logic

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

14 months agodaemon: style changes
Ihor Antonov [Fri, 3 Mar 2023 05:17:01 +0000 (23:17 -0600)]
daemon: style changes

This is not a functional change.
- Clean up whitespace (spaces where there should be tabs)
- Break up lines that are longer than 80

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

14 months agoMakefile.inc1: Support building with macOS Ventura's AMFI Launch Constraints
Jessica Clarke [Fri, 3 Mar 2023 02:15:30 +0000 (02:15 +0000)]
Makefile.inc1: Support building with macOS Ventura's AMFI Launch Constraints

As of macOS Ventura, Apple-signed binaries cannot be run if copied away from
their system location. This security feature doesn't really make sense for
boring things like sh(1), more so for applications with special entitlements,
but it's universally present, and results in the following error:

  >>> Install check world
  bmake[2]: "/Users/Jess/cheri/freebsd/Makefile.inc1" line 572: warning: "MAKEFLAGS= CPUTYPE=dummy /Users/Jess/cheri/build/freebsd-riscv64-build/bmake-install/bin/bmake -f /dev/null  -m /Users/Jess/cheri/freebsd/share/mk MK_AUTO_OBJ=no -V CPUTYPE" exited on a signal
  bmake[2]: "/Users/Jess/cheri/freebsd/Makefile.inc1" line 575: CPUTYPE global should be set with ?=.

As with host-symlinks, we don't actually need to copy the files on macOS, since
we're not updating the current machine, so copy its approach and just symlink
them instead.

MFC after: 1 week

14 months agomergemaster: add deprecation notice to man page
Ed Maste [Wed, 22 Jan 2020 21:04:03 +0000 (16:04 -0500)]
mergemaster: add deprecation notice to man page

Reviewed by: bapt, gjb, kevans (all earlier)
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23327

14 months agolength for the 64-bit entry is 32-bits, not 16-bits.
John-Mark Gurney [Fri, 3 Mar 2023 01:03:57 +0000 (17:03 -0800)]
length for the 64-bit entry is 32-bits, not 16-bits.

Reported by: Jérôme Duval  (korli on github)

14 months agoabstract out the vm detection via smbios..
John-Mark Gurney [Thu, 23 Feb 2023 20:59:50 +0000 (20:59 +0000)]
abstract out the vm detection via smbios..

This makes the detection of VMs common between platforms that
have SMBios.

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D38800

14 months agosrc.conf.5: regen for KBOOT and KTLS changes
Brooks Davis [Fri, 3 Mar 2023 00:47:09 +0000 (00:47 +0000)]
src.conf.5: regen for KBOOT and KTLS changes

kboot was enabled for aarch64 in 46010641267 and KTLS was added for
powerpc64* in e552cac3d7d9.

14 months agofreebsd-update: use grep -E instead of egrep
Ed Maste [Thu, 2 Mar 2023 23:54:52 +0000 (18:54 -0500)]
freebsd-update: use grep -E instead of egrep

GNU egrep emits a warning that it is obsolescent and suggests grep -E
instead.  Switch to grep -E in case we end up invoking GNU (e)grep (and
for consistency with other invocations in this file).

Reported by: Steffen Nurpmeso
Sponsored by: The FreeBSD Foundation

14 months agonetgraph.4: remove obsolete ng_atm.4 reference
Brooks Davis [Thu, 2 Mar 2023 23:37:18 +0000 (23:37 +0000)]
netgraph.4: remove obsolete ng_atm.4 reference

MFC After: 3 days

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38876

14 months agoNgATM: Remove useless NGATM_ATM option
Brooks Davis [Thu, 2 Mar 2023 23:37:10 +0000 (23:37 +0000)]
NgATM: Remove useless NGATM_ATM option

MFC after: 3 days

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38875

14 months agoNATM: Remove useless NETGRAPH_ATM_ATMPIF option
Brooks Davis [Thu, 2 Mar 2023 23:36:55 +0000 (23:36 +0000)]
NATM: Remove useless NETGRAPH_ATM_ATMPIF option

This code was removed as part of the NATM removal in 2017 and somehow
this option was missed.

MFC after: 3 days

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38874

14 months agokern_jail.c: Remove #ifdefs for VNET_NFSD
Rick Macklem [Thu, 2 Mar 2023 21:13:24 +0000 (13:13 -0800)]
kern_jail.c: Remove #ifdefs for VNET_NFSD

The consensus was that VNET_NFSD was not needed.
This patch removes it from kern_jail.c.

With this patch, support for the "allow.nfsd"
jail parameter is enabled in the kernel for
kernels built with "options VIMAGE".

Reviewed by: markj
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D38808

14 months agovfs_mount.c: Allow mountd(8) to do exports in a vnet prison
Rick Macklem [Thu, 2 Mar 2023 21:09:01 +0000 (13:09 -0800)]
vfs_mount.c: Allow mountd(8) to do exports in a vnet prison

To run mountd in a vnet prison, three checks in vfs_domount()
and vfs_domount_update() related to doing exports needed
to be changed, so that a file system visible within the
prison but mounted outside the prison can be exported.

I did all three in a minimal way, only changing the checks for
the specific case of a process (typically mountd) doing exports
within a vnet prison and not updating the mount point in other
ways.  The changes are:
- Ignore the error return from vfs_suser(), since the file
  system being mounted outside the prison will cause it to fail.
- Use the priv_check(PRIV_NFS_DAEMON) for this specific case
  within a prison.
- Skip the call to VFS_MOUNT(), since it will return an error,
  due to the "from" argument not being set correctly.  VFS_MOUNT()
  does not appear to do anything for the case of doing exports only.

Reviewed by: markj
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D37741

14 months agoopen.2: describe O_RESOLVE_BENEATH errors correctly
Val Packett [Sun, 19 Feb 2023 20:14:15 +0000 (17:14 -0300)]
open.2: describe O_RESOLVE_BENEATH errors correctly

The behavior is the same as in capability mode, it does not actually
return EINVAL for absolute lookups:

    openat(AT_FDCWD,"/tmp/test",O_RDONLY|O_DIRECTORY,00) = 3 (0x3)
    openat(3,"../../",O_RDONLY|0x800000,00)          ERR#93 'Capabilities insufficient'
    openat(3,"/etc/passwd",O_RDONLY|0x800000,00)     ERR#93 'Capabilities insufficient'

Fixes: 1f305be43 ("Document {O,AT}_RESOLVE_BENEATH...")
Reviewed by:    kib, pauamma (manpages), emaste
Sponsored by:   https://www.patreon.com/valpackett
Pull Request: https://github.com/freebsd/freebsd-src/pull/680
Differential Revision: https://reviews.freebsd.org/D38675

14 months agoxlocale: garbage collect references to strtoq_l/strtouq_l
Val Packett [Mon, 6 Feb 2023 19:43:48 +0000 (16:43 -0300)]
xlocale: garbage collect references to strtoq_l/strtouq_l

These were explicitly never implemented (see
lib/libc/locale/DESIGN.xlocale), but were referenced in the
manpage and the symbol map.

Fixes: 3c87aa1d3dc ("Implement xlocale APIs from Darwin")
Reported by:    ld.lld 16 being --no-undefined-version by default
Reviewed by:    theraven, emaste
Sponsored by:   https://www.patreon.com/valpackett
Pull Request: https://github.com/freebsd/freebsd-src/pull/679
Differential Revision: https://reviews.freebsd.org/D38408

14 months agoFix kernel memory disclosures in mpr and mps
Alan Somers [Wed, 1 Mar 2023 18:53:46 +0000 (11:53 -0700)]
Fix kernel memory disclosures in mpr and mps

In every mpr and mps ioctl that copies kernel data to userland, validate
that the requested length does not exceed the size of the kernel's
buffer.

Note that all of these ioctls already required root access.

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D38842

14 months agoarm: Tag VHYBRID kernel as NO_UNIVERSE
Emmanuel Vadot [Thu, 2 Mar 2023 08:26:54 +0000 (09:26 +0100)]
arm: Tag VHYBRID kernel as NO_UNIVERSE

All drivers are already either in GENERIC or in the other arches LINT
so no need to build this one too.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38851

14 months agoarm: Tag SOCFPGA kernel as NO_UNIVERSE
Emmanuel Vadot [Thu, 2 Mar 2023 08:25:38 +0000 (09:25 +0100)]
arm: Tag SOCFPGA kernel as NO_UNIVERSE

All drivers are already either in GENERIC or in the other arches LINT
so no need to build this one too.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38850

14 months agoarm: Tag EFIKA_MX kernel as NO_UNIVERSE
Emmanuel Vadot [Thu, 2 Mar 2023 08:22:59 +0000 (09:22 +0100)]
arm: Tag EFIKA_MX kernel as NO_UNIVERSE

All drivers are already either in GENERIC or in the IMX51 kernel config
so no need to build this one too.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38849

14 months agoarm: Tag ALPINE kernel as NO_UNIVERSE
Emmanuel Vadot [Thu, 2 Mar 2023 08:18:03 +0000 (09:18 +0100)]
arm: Tag ALPINE kernel as NO_UNIVERSE

Specific devices are in LINT so no need to build this one as part
of make universe.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38848
Reviewed by: imp

14 months agoarm: Add PCI and Annapurna devices drivers to LINT
Emmanuel Vadot [Thu, 2 Mar 2023 08:17:21 +0000 (09:17 +0100)]
arm: Add PCI and Annapurna devices drivers to LINT

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38847
Reviewed by: imp

14 months agokboot: Fix hostdisk_override
Warner Losh [Thu, 2 Mar 2023 17:57:43 +0000 (10:57 -0700)]
kboot: Fix hostdisk_override

We were assuming that hostdisk_override was both a directory and a
file, which is not going to work very well. It's supposed to be a
single file, so recode it as such. Simplify erorr handling a little as
well and fix a return type-mismatch that doesn't matter for the
generated code (return NULL is the same as return false in this
context)

Sponsored by: Netflix

14 months agokboot: Use MIN instead of min
Warner Losh [Thu, 2 Mar 2023 17:56:44 +0000 (10:56 -0700)]
kboot: Use MIN instead of min

MIN works for any type, while min() is only for integers. So we were
rounding down to 0 since that's the size of 4GB truncated to an int.

Sponsored by: Netflix

14 months agokboot: Better default boot device
Warner Losh [Thu, 2 Mar 2023 17:55:06 +0000 (10:55 -0700)]
kboot: Better default boot device

Provide a better message when we can't find a boot device.

Sponsored by: Netflix

14 months agokboot: Hack for running on FreeBSD host
Warner Losh [Thu, 2 Mar 2023 17:31:05 +0000 (10:31 -0700)]
kboot: Hack for running on FreeBSD host

When we're running on a FreeBSD host, we can't open /proc/iomem.  So,
for now, just assume that we have 32GB of ram starting at 4GB.

Sponsored by: Netflix

14 months agomoused: Fix typos
Elyes Haouas [Fri, 24 Feb 2023 06:53:51 +0000 (07:53 +0100)]
moused: Fix typos

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
14 months agoftgpio: Fix panic at attach and use better device description
Stéphane Rochoy [Thu, 2 Mar 2023 15:16:35 +0000 (08:16 -0700)]
ftgpio: Fix panic at attach and use better device description

Use ftgpio_group_get_status instead of inlining an imperfect
version of it to get correct register and avoid
panic: ftgpio_group_get_ioreg: invalid register 0 for group 0

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

14 months agoyp_mkdb: Remove useless return at the end of void function
Elyes Haouas [Thu, 2 Mar 2023 14:59:07 +0000 (07:59 -0700)]
yp_mkdb: Remove useless return at the end of void function

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/656

14 months agousbconfig: Remove useless return at the end of void function
Elyes Haouas [Thu, 2 Mar 2023 14:59:07 +0000 (07:59 -0700)]
usbconfig: Remove useless return at the end of void function

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/656

14 months agorrenumd: Remove useless return at the end of void function
Elyes Haouas [Thu, 2 Mar 2023 14:59:07 +0000 (07:59 -0700)]
rrenumd: Remove useless return at the end of void function

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/656

14 months agorpcbind: Remove useless return at the end of void function
Elyes Haouas [Thu, 2 Mar 2023 14:59:07 +0000 (07:59 -0700)]
rpcbind: Remove useless return at the end of void function

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/656

14 months agorpc.yppasswdd: Remove useless return at the end of void function
Elyes Haouas [Thu, 2 Mar 2023 14:59:07 +0000 (07:59 -0700)]
rpc.yppasswdd: Remove useless return at the end of void function

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/656

14 months agopmcstat: Remove useless return at the end of void function
Elyes Haouas [Thu, 2 Mar 2023 14:59:07 +0000 (07:59 -0700)]
pmcstat: Remove useless return at the end of void function

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/656

14 months agolpr: Remove useless return at the end of void function
Elyes Haouas [Thu, 2 Mar 2023 14:59:07 +0000 (07:59 -0700)]
lpr: Remove useless return at the end of void function

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/656

14 months agoextattr: Remove useless return at the end of void function
Elyes Haouas [Thu, 2 Mar 2023 14:59:06 +0000 (07:59 -0700)]
extattr: Remove useless return at the end of void function

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/656

14 months agodiskinfo: Remove useless return at the end of void function
Elyes Haouas [Thu, 2 Mar 2023 14:59:06 +0000 (07:59 -0700)]
diskinfo: Remove useless return at the end of void function

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/656

14 months agodconschat: Remove useless return at the end of void function
Elyes Haouas [Thu, 2 Mar 2023 14:59:06 +0000 (07:59 -0700)]
dconschat: Remove useless return at the end of void function

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/656

14 months agobluetooth/hccontrol: Remove useless return at the end of void function
Elyes Haouas [Thu, 2 Mar 2023 14:59:06 +0000 (07:59 -0700)]
bluetooth/hccontrol: Remove useless return at the end of void function

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/656

14 months agouuidgen(1): back to the past and fix typo
Baptiste Daroussin [Thu, 2 Mar 2023 08:35:30 +0000 (09:35 +0100)]
uuidgen(1): back to the past and fix typo

Reported by: ceri

14 months agodaemon: more human-friendly variable names
Ihor Antonov [Thu, 2 Mar 2023 03:00:43 +0000 (21:00 -0600)]
daemon: more human-friendly variable names

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

14 months agodaemon: move syslog facility and syslog tag into log_params
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: move syslog facility and syslog tag into log_params

Since struct log_params already contains logging-related
varaiables, including syslog-related, move remaining
syslog-related variables into struct log_params as well

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

14 months agodaemon: deduplicate log_params varaibles
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: deduplicate log_params varaibles

While we're here, sort log_params by size.

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

14 months agodaemon: make log_reopen variable a bool
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: make log_reopen variable a bool

Following style(9) and C99 recommendation use bool instead of
int for boolean operations.

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

14 months agodaemon: make dosyslog variable a bool and give it a better name
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: make dosyslog variable a bool and give it a better name

Following style(9) and C99 recommendation use bool instead of
int for boolean operations. Also give the variable a more descriptive
name that follows boolean naming convention.

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

14 months agodaemon: add supervision_enabled var
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: add supervision_enabled var

explicitly name a bunch of boolean checks that enable
supervison mode and improve comments

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

14 months agodaemon: initialize struct sigaction at declaration site
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: initialize struct sigaction at declaration site

This improves readability by uncluttering the code

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

14 months agodaemon: fix double init of pid variable
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: fix double init of pid variable

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

14 months agodaemon: initialize mask_orig with sigemptyset()
Ihor Antonov [Thu, 2 Mar 2023 03:00:41 +0000 (21:00 -0600)]
daemon: initialize mask_orig with sigemptyset()

consolidation of variable declarations and initializations in previous
commit allowed me to detect that one of the signal masks is not properly
initialized with sigemptyset (as man 3 sigsetops demands)

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

14 months agodaemon: consolidate variable declarations and initializaions
Ihor Antonov [Thu, 2 Mar 2023 03:00:41 +0000 (21:00 -0600)]
daemon: consolidate variable declarations and initializaions

- improve readability by breaking apart single-line multi-variable declarations
- initialize simple variables at declaration site
- move other top-level variable initializations closer declarations
  to avoid potential UB and unclutter the use-site.

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

14 months agodaemon: use braces with 'if' consistently
Ihor Antonov [Thu, 2 Mar 2023 03:00:41 +0000 (21:00 -0600)]
daemon: use braces with 'if' consistently

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

14 months agofreebsd-update: re-edit files if merge conflict markers remain
Ed Maste [Wed, 14 Dec 2022 17:34:59 +0000 (12:34 -0500)]
freebsd-update: re-edit files if merge conflict markers remain

freebsd-update will open ${EDITOR} if conflicts occur while merging
updates to config files.  Inform the user if they've left conflict
markers behind, and go back to editing the file.

PR: 185546
PR: 229689
Reviewed by: delphij
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37703

14 months agotools/build: Hide spurious errors if sys/stat.h does not exist
Ed Maste [Fri, 24 Feb 2023 14:43:57 +0000 (09:43 -0500)]
tools/build: Hide spurious errors if sys/stat.h does not exist

Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38757

14 months agoFix typo: messages missing an 'a'.
Warner Losh [Wed, 1 Mar 2023 23:34:43 +0000 (16:34 -0700)]
Fix typo: messages missing an 'a'.

14 months agosvc_rpcsec_gss.c: Separate out the non-vnet initialization
Rick Macklem [Wed, 1 Mar 2023 23:29:25 +0000 (15:29 -0800)]
svc_rpcsec_gss.c: Separate out the non-vnet initialization

Without this patch, a single initialization function was
used to initialize both the vnet'd and non-vnet'd data.
This patch separates out the non-vnet'd initializations
into a separate function invoked by SYSINIT().
This avoids use of IS_DEFAULT_VNET() in the initialization
functions and also configures the non-vnet'd initialization
function to be called first, although ordering is not
currently needed.

Reviewed by: glebius
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D38749

14 months agonfs_fha_new: Fix nfs_fha_new so that sysctls work in prisons
Rick Macklem [Wed, 1 Mar 2023 23:25:35 +0000 (15:25 -0800)]
nfs_fha_new: Fix nfs_fha_new so that sysctls work in prisons

The sysctls were in "struct fha_params", making it impractical
to vnet them.  This patch moves the sysctls out of "struct fha_params"
and vnet's them, so that they are available in vnet prisons
running nfsd(8).  It also avoids the IS_DEFAULT_VNET() macros
in the VNET_SYSINIT() function.

Reviewed by: glebius
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D38748

14 months agotesting: skip tarfs tests if module is not loadable.
Olivier Cochard [Wed, 1 Mar 2023 20:26:54 +0000 (21:26 +0100)]
testing: skip tarfs tests if module is not loadable.

Approved by: asomers
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D38828

14 months agosysctl: tests: fix a couple issues
Kyle Evans [Wed, 1 Mar 2023 20:35:52 +0000 (14:35 -0600)]
sysctl: tests: fix a couple issues

The function that sets test case metadata is actually named ${tc}_head
rather than ${tc}, so add the suffix.

While we're here, hook the tests up to the infrastructure so that they
do get run.

Sponsored by: Klara, Inc.

14 months agonvram2env: Remove MIPS-specific support.
John Baldwin [Wed, 1 Mar 2023 18:54:08 +0000 (10:54 -0800)]
nvram2env: Remove MIPS-specific support.

14 months agousb: Trim another MIPS reference.
John Baldwin [Wed, 1 Mar 2023 18:51:27 +0000 (10:51 -0800)]
usb: Trim another MIPS reference.

Fix a nearby whitespace nit while here.