]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
15 months agoee: Drop P_() macro used for pre-C89 compatibility.
John Baldwin [Tue, 18 Apr 2023 19:52:44 +0000 (12:52 -0700)]
ee: Drop P_() macro used for pre-C89 compatibility.

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

15 months agomac: Honor order when registering MAC modules.
Steve Kiernan [Sun, 2 Apr 2023 22:17:17 +0000 (15:17 -0700)]
mac: Honor order when registering MAC modules.

Ensure MAC modules are inserted in order that they are registered.

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

15 months agoloader.efi: Fix some arm64 PE metadata
Mark Johnston [Tue, 18 Apr 2023 18:32:04 +0000 (14:32 -0400)]
loader.efi: Fix some arm64 PE metadata

- Mark the file as an executable in the COFF header.
- Provide separate .text and .data sections.
- Provide sane file and section alignment values.  These values are the
  defaults defined in the PE specification.
- Set appropriate characteristics for each of .text and .data.

This is required for the MS devkit to load our UEFI image.

Obtained from: OpenBSD via allanjude
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D37765

15 months agopnpinfo: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:31:13 +0000 (11:31 -0700)]
pnpinfo: Use C89 function definitions.

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

15 months agokeyserv: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:29:27 +0000 (11:29 -0700)]
keyserv: Use C89 function definitions.

Also use more accurate function pointer types, and trim some duplicate
(but incomplete) function prototypes.

Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D39533

15 months agoyp: Use more accurate function pointer types.
John Baldwin [Tue, 18 Apr 2023 18:28:57 +0000 (11:28 -0700)]
yp: Use more accurate function pointer types.

Trim a few duplicate (but incomplete) function prototypes as well.

Reviewed by: zlei, imp
Differential Revision: https://reviews.freebsd.org/D39532

15 months agotraceroute: Use C89 function definition for one straggler.
John Baldwin [Tue, 18 Apr 2023 18:28:41 +0000 (11:28 -0700)]
traceroute: Use C89 function definition for one straggler.

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

15 months agorpc.lockd: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:28:24 +0000 (11:28 -0700)]
rpc.lockd: Use C89 function definitions.

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

15 months agocron: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:28:07 +0000 (11:28 -0700)]
cron: Use C89 function definitions.

Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D39529

15 months agotelnet: Use C89 function definitions for two stragglers.
John Baldwin [Tue, 18 Apr 2023 18:27:47 +0000 (11:27 -0700)]
telnet: Use C89 function definitions for two stragglers.

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

15 months agomail: Use a C89 function pointer type for command functions.
John Baldwin [Tue, 18 Apr 2023 18:27:29 +0000 (11:27 -0700)]
mail: Use a C89 function pointer type for command functions.

The command function is defined to always take a void *.  Functions
which accept a pointer to an array of pointers use a local temporary
'argv' assigned from the void *arg.

Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D39527

15 months agolocate: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:27:08 +0000 (11:27 -0700)]
locate: Use C89 function definitions.

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

15 months agoless: Silence -Wdeprecated-non-prototype warnings.
John Baldwin [Tue, 18 Apr 2023 18:26:08 +0000 (11:26 -0700)]
less: Silence -Wdeprecated-non-prototype warnings.

This has an active upstream so will presumably be fixed upstream at
some point.

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

15 months agoipf: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:22:28 +0000 (11:22 -0700)]
ipf: Use C89 function definitions.

Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D39523

15 months agorbootd: Remove an unnecessary (and incomplete) function prototype.
John Baldwin [Tue, 18 Apr 2023 18:22:08 +0000 (11:22 -0700)]
rbootd: Remove an unnecessary (and incomplete) function prototype.

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

15 months agorpc.rstatd/rwalld: Use more accurate function pointer types.
John Baldwin [Tue, 18 Apr 2023 18:21:50 +0000 (11:21 -0700)]
rpc.rstatd/rwalld: Use more accurate function pointer types.

Reviewed by: zlei, rmacklem
Differential Revision: https://reviews.freebsd.org/D39521

15 months agobootpd: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:21:15 +0000 (11:21 -0700)]
bootpd: Use C89 function definitions.

Trim a few duplicate (but incomplete) function prototypes as well.

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

15 months agosmbfs: Use C89 function definition for cf_getopt.
John Baldwin [Tue, 18 Apr 2023 18:20:43 +0000 (11:20 -0700)]
smbfs: Use C89 function definition for cf_getopt.

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

15 months agosendmail: Silence -Wdeprecated-non-prototype warnings.
John Baldwin [Tue, 18 Apr 2023 18:19:48 +0000 (11:19 -0700)]
sendmail: Silence -Wdeprecated-non-prototype warnings.

These will hopefully be fixed upstream eventually, but silence the
warnings until then.

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

15 months agoboot0: Drop the BOOT_BOOT0_ORG option.
John Baldwin [Tue, 18 Apr 2023 18:17:13 +0000 (11:17 -0700)]
boot0: Drop the BOOT_BOOT0_ORG option.

This shouldn't be an option (and I added it in the first place back in
4ae4202e705cf6a12aa3cbb49efb153879a6bc2f and
83f4b92050cbf8913d5c0aac16726c783d8b2d9c).  However, unlike the other
knobs I added back then, this really shouldn't be a knob since it is
hardcoded in the source.

15 months agotmpfs: add missing vop_fplookup ops to tmpfs_fifoop_entries
Mateusz Guzik [Tue, 18 Apr 2023 18:04:16 +0000 (18:04 +0000)]
tmpfs: add missing vop_fplookup ops to tmpfs_fifoop_entries

Reported by: gbe
PR: 270917

15 months agoboot0: Expand the description of BOOT_BOOT0_ORG.
John Baldwin [Tue, 18 Apr 2023 18:02:50 +0000 (11:02 -0700)]
boot0: Expand the description of BOOT_BOOT0_ORG.

This really shouldn't even be an option given it is hardcoded as a
constant named ORIGIN in the assembly.  mbr.S also uses 0x600 and
hardcodes it in both the assembly and the Makefile.

15 months agoHandle errors if WARNS is not defined.
Steve Kiernan [Mon, 16 Jan 2023 23:41:20 +0000 (15:41 -0800)]
Handle errors if WARNS is not defined.

One conditional outside of ifdef WARNS did not protect against an
unset WARNS. Default WARNS to 0 in conditional if not defined.

Obtained from: Juniper Networks, Inc.

15 months agocas.4: Remove remaining sparc64-specific bit
Marius Strobl [Tue, 18 Apr 2023 17:06:51 +0000 (19:06 +0200)]
cas.4: Remove remaining sparc64-specific bit

This was missed in 702547720ca01437081fb1b6f9eb281c9541021b.

15 months agogem(4): Remove onboard-only Sun ERI and remnants of SBus support
Marius Strobl [Tue, 18 Apr 2023 16:39:38 +0000 (18:39 +0200)]
gem(4): Remove onboard-only Sun ERI and remnants of SBus support

These bits are obsolete since 58aa35d42975c298ca0adba705c042596303c9f5.
This change reverts part of 9ba2b298dfda78b6669281507b314a4c441cd706 as
well as effectively bd3d9826d73b780d349c53ee373060bc7b8d0581, i. e. the
SBus-related modifications. This also gets rid of a nasty hack required
as bus_{read,write}_N(9) doesn't really fit bus_space_subregion(9).

15 months agommc(4): Don't call bridge driver for timings not requiring tuning
Marius Strobl [Wed, 12 Apr 2023 21:46:02 +0000 (23:46 +0200)]
mmc(4): Don't call bridge driver for timings not requiring tuning

The original idea behind calling into the bridge driver was to have the
logic deciding whether tuning is actually required for a particular bus
timing in a given slot as well as doing the sanity checking only on the
controller layer which also generally is better suited for these due to
say SDHCI_SDR50_NEEDS_TUNING. On another thought, not every such driver
should need to check whether tuning is required at all, though, and not
everything is SDHCI in the first place.
Adjust sdhci{,_fsl_fdt}(4) accordingly, but keep sdhci_generic_tune() a
bit cautious still.

15 months agorenice: Factor out common code in tests.
Dag-Erling Smørgrav [Tue, 18 Apr 2023 17:14:11 +0000 (17:14 +0000)]
renice: Factor out common code in tests.

Furthermore, prefer test -eq (which ignores whitespace) over a strict string equality test when comparing numerical values.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: thj
Differential Revision: https://reviews.freebsd.org/D39650

15 months agotcp: Inconsistent use of hpts_calling flag
Randall Stewart [Mon, 17 Apr 2023 21:10:26 +0000 (17:10 -0400)]
tcp: Inconsistent use of hpts_calling flag

Gleb has noticed there were some inconsistency's in the way the inp_hpts_calls flag was being used. One
such inconsistency results in a bug when we can't allocate enough sendmap entries to entertain a call to
rack_output().. basically a timer won't get started like it should. Also in cleaning this up I find that the
"no_output" side of input needs to be adjusted to make sure we don't try to re-pace too quickly outside
the hpts assurance of 250useconds.

Another thing here is we end up with duplicate calls to tcp_output() which we should not. If packets go
from hpts for processing the input side of tcp will call the output side of tcp on the last packet if it is needed.
This means that when that occurs a second call to tcp_output would be made that is not needed and if pacing
is going on may be harmful.

Lets fix all this and explicitly state the contract that hpts is making with transports that care about the
flag.

Reviewed by: tuexen, glebius
Sponsored by: Netflix Inc
Differential Revision:https://reviews.freebsd.org/D39653

15 months agoarm64: Use FULLKERNEL instead of .ALLSRC in .bin target
Steve Kiernan [Fri, 20 Jan 2023 02:07:38 +0000 (18:07 -0800)]
arm64: Use FULLKERNEL instead of .ALLSRC in .bin target

Using .ALLSRC may get additional arguments that we may not want
and could cause the objcopy to fail.

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

15 months agotests: fix netlink type parsing.
Alexander V. Chernikov [Tue, 18 Apr 2023 14:09:47 +0000 (14:09 +0000)]
tests: fix netlink type parsing.

Netlink attribute type field is 2 bytes, not one.

MFC after: 2 weeks

15 months agopf: fix incorrect lock define
Kristof Provost [Tue, 18 Apr 2023 13:24:24 +0000 (15:24 +0200)]
pf: fix incorrect lock define

PF_TABLE_STATS_ASSERT() should be checking pf_table_stats_lock not
pf_rules_lock.

Fortunately the define is not yet used anywhere so this was harmless.
Fix it anyway, in case it does get used.

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

15 months agosplit: Update synopsis and usage; fix examples
Mateusz Piotrowski [Fri, 14 Apr 2023 11:50:13 +0000 (13:50 +0200)]
split: Update synopsis and usage; fix examples

- Mark -d as an optional flag
- Add a prompt to one of the examples for consistency
- Add -d to the usage message

Sponsored by: Klara Inc.

15 months agomlx5en(4): Don't wait for receive queue to fill up with mbufs during open channels.
Hans Petter Selasky [Tue, 18 Apr 2023 11:42:17 +0000 (13:42 +0200)]
mlx5en(4): Don't wait for receive queue to fill up with mbufs during open channels.

Failure to get mbufs may be transient.
Don't permanently fail to open the channels due to lack of mbufs.
This also makes modifying channel parameters faster.

MFC after: 1 week
Sponsored by: NVIDIA Networking

15 months agomlx5en(4): Explain why CQE zipping is off.
Hans Petter Selasky [Tue, 18 Apr 2023 11:12:32 +0000 (13:12 +0200)]
mlx5en(4): Explain why CQE zipping is off.

MFC after: 1 week
Sponsored by: NVIDIA Networking

15 months agomlx5: Remove unused debugfs node pointers.
Hans Petter Selasky [Tue, 18 Apr 2023 11:40:22 +0000 (13:40 +0200)]
mlx5: Remove unused debugfs node pointers.

No functional change intended.

MFC after: 1 week
Sponsored by: NVIDIA Networking

15 months agomlx5: Implement diagostic counters as sysctl(8) nodes.
Hans Petter Selasky [Tue, 18 Apr 2023 11:38:59 +0000 (13:38 +0200)]
mlx5: Implement diagostic counters as sysctl(8) nodes.

MFC after: 1 week
Sponsored by: NVIDIA Networking

15 months agomlx5: Don't give zero number of pages to the firmware.
Hans Petter Selasky [Tue, 18 Apr 2023 11:22:41 +0000 (13:22 +0200)]
mlx5: Don't give zero number of pages to the firmware.

Can happen when using virtual mlx5_core<N> functions, VFs.

MFC after: 1 week
Sponsored by: NVIDIA Networking

15 months agomlx5: Implement mlx5_core_modify_cq_by_mask().
Hans Petter Selasky [Tue, 18 Apr 2023 11:21:28 +0000 (13:21 +0200)]
mlx5: Implement mlx5_core_modify_cq_by_mask().

Implement one CQ modify function supporting all firmware versions,
instead of having more variants of CQ modify.

MFC after: 1 week
Sponsored by: NVIDIA Networking

15 months agomlx5: Fix duplicate free of default flow rule in error case.
Hans Petter Selasky [Tue, 18 Apr 2023 11:17:38 +0000 (13:17 +0200)]
mlx5: Fix duplicate free of default flow rule in error case.

MFC after: 1 week
Sponsored by: NVIDIA Networking

15 months agomlx5: Make mlx5_del_flow_rule() NULL safe.
Hans Petter Selasky [Tue, 18 Apr 2023 11:16:16 +0000 (13:16 +0200)]
mlx5: Make mlx5_del_flow_rule() NULL safe.

This change factors out repeated NULL checks.

No functional change intended.

MFC after: 1 week
Sponsored by: NVIDIA Networking

15 months agomlx5: Make MLX5_COMP_EQ_SIZE tunable.
Hans Petter Selasky [Tue, 18 Apr 2023 11:11:02 +0000 (13:11 +0200)]
mlx5: Make MLX5_COMP_EQ_SIZE tunable.

When using hardware pacing, this value can be increased, because more SQ's
means more EQ events aswell. Make it tunable, hw.mlx5.comp_eq_size .

MFC after: 1 week
Sponsored by: NVIDIA Networking

15 months agotcp: Blackbox logging and tcp accounting together can cause a crash.
Randall Stewart [Mon, 17 Apr 2023 17:52:00 +0000 (13:52 -0400)]
tcp: Blackbox logging and tcp accounting together can cause a crash.

If you currently turn BB logging on and in combination have TCP Accounting on we can get a
crash where we have no NULL check and we run out of memory. Also lets make sure we
don't do a divide by 0 in calculating any BB ratios.

Reviewed by: tuexen
Sponsored by: Netflix Inc
Differential Revision:https://reviews.freebsd.org/D39622

15 months agonetlink: sync interface IFLA attributes
Alexander V. Chernikov [Tue, 18 Apr 2023 12:33:48 +0000 (12:33 +0000)]
netlink: sync interface IFLA attributes

MFC after: 2 weeks

15 months agotcpdump: add missing pf reasons and actions
Kajetan Staszkiewicz [Tue, 18 Apr 2023 07:33:33 +0000 (09:33 +0200)]
tcpdump: add missing pf reasons and actions

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

15 months agomount_nfs.8: Fix a mandoc warning
Gordon Bergling [Tue, 18 Apr 2023 07:14:20 +0000 (09:14 +0200)]
mount_nfs.8: Fix a mandoc warning

- sections out of conventional order: Sh IMPLEMENTATION NOTES

MFC after: 3 days

15 months agoRevert "stand: Remove double words in source code comments"
Gordon Bergling [Tue, 18 Apr 2023 06:08:35 +0000 (08:08 +0200)]
Revert "stand: Remove double words in source code comments"

The sentence, "The base address that we the boot0 code to to run it."
is correct.

Reported by: jrtc27

This reverts commit b12ccd0bb1b37f32e972bb3e945e4025fe409e2f.

15 months agorenice: Clean up the tests.
Dag-Erling Smørgrav [Tue, 18 Apr 2023 05:31:41 +0000 (05:31 +0000)]
renice: Clean up the tests.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D39629

15 months agometa: print some additional variables on build errors.
Stephen J. Kiernan [Tue, 18 Apr 2023 04:32:06 +0000 (00:32 -0400)]
meta: print some additional variables on build errors.

Add CPUTYPE and MACHINE_CPUARCH to the list of variables printed
when there are build errors.

Protect local.sys.mk from multiple inclusion.

Reviewed by: sjg
Obtained from: Juniper Networks, Inc.

15 months agokern_sysctl: Remove double words in source code comments
Gordon Bergling [Tue, 18 Apr 2023 05:13:30 +0000 (07:13 +0200)]
kern_sysctl: Remove double words in source code comments

- s/on on/on/

MFC after: 5 days

15 months agolast(1): Remove double words in source code comments
Gordon Bergling [Tue, 18 Apr 2023 05:12:45 +0000 (07:12 +0200)]
last(1): Remove double words in source code comments

- s/on on/on/
- s/we we/we/

MFC after: 5 days

15 months agonet80211: Remove double words in source code comments
Gordon Bergling [Tue, 18 Apr 2023 05:11:43 +0000 (07:11 +0200)]
net80211: Remove double words in source code comments

- s/we we/we/

MFC after: 5 days

15 months agostand: Remove double words in source code comments
Gordon Bergling [Tue, 18 Apr 2023 05:09:57 +0000 (07:09 +0200)]
stand: Remove double words in source code comments

- s/to to/to/
- s/value value/value/

MFC after: 5 days

15 months agometa: Allow TARGET_SPEC_VARS to be overridden
Stephen J. Kiernan [Tue, 18 Apr 2023 04:25:59 +0000 (00:25 -0400)]
meta: Allow TARGET_SPEC_VARS to be overridden

Reviewed by: sjg
Obtained from: Juniper Networks, Inc.

15 months agoflash: Add "n25q64" to mx25l driver
Stephen J. Kiernan [Tue, 18 Apr 2023 04:17:14 +0000 (00:17 -0400)]
flash: Add "n25q64" to mx25l driver

This is for 64Mb Micron N25Q serial NOR flash memory

Obtained from: Juniper Networks, Inc.

15 months agolibsa: Update comments about SMBIOS specification
Stephen J. Kiernan [Tue, 18 Apr 2023 01:36:37 +0000 (21:36 -0400)]
libsa: Update comments about SMBIOS specification

Summary:
Include details from the SMBIOS 3 specification and some additional
details for SMBIOS 2.1.

Obtained from: Juniper Networks, Inc.

Reviewers: jmg, manu

Subscribers: imp, dab

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

15 months agovfs_lookup(): re-check v_mountedhere on lock upgrade
Jason A. Harmening [Tue, 28 Mar 2023 18:06:29 +0000 (13:06 -0500)]
vfs_lookup(): re-check v_mountedhere on lock upgrade

The VV_CROSSLOCK handling logic may need to upgrade the covered
vnode lock depending upon the requirements of the filesystem into
which vfs_lookup() is walking.  This may involve transiently
dropping the lock, which can allow the target mount to be unmounted.

Tested by: pho
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D39272

15 months agounionfs_mkdir(): handle dvp reclamation
Jason A. Harmening [Mon, 16 Jan 2023 21:50:59 +0000 (15:50 -0600)]
unionfs_mkdir(): handle dvp reclamation

The underlying VOP_MKDIR() implementation may temporarily drop the
parent directory vnode's lock.  If the vnode is reclaimed during that
window, the unionfs vnode will effectively become unlocked because
the its v_vnlock field will be reset.  To uphold the locking
requirements of VOP_MKDIR() and to avoid triggering various VFS
assertions, explicitly re-lock the unionfs vnode before returning
in this case.

Note that there are almost certainly other cases in which we'll
similarly need to handle vnode relocking by the underlying FS; this
is the only one that's caused problems in stress testing so far.
A more general solution, such as that employed for nullfs in
null_bypass(), will likely need to be implemented.

Tested by: pho
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D39272

15 months agoRemove unionfs_islocked()
Jason A. Harmening [Mon, 16 Jan 2023 21:50:10 +0000 (15:50 -0600)]
Remove unionfs_islocked()

The implementation is racy; if the unionfs vnode is not in fact
locked, vnode private data may be concurrently altered or freed.
Instead, simply rely upon the standard implementation to query the
v_vnlock field, which is type-stable and will reflect the correct
lower/upper vnode configuration for the unionfs node.

Tested by: pho
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D39272

15 months agoRemove an impossible condition from unionfs_lock()
Jason A. Harmening [Mon, 16 Jan 2023 21:48:11 +0000 (15:48 -0600)]
Remove an impossible condition from unionfs_lock()

We hold the vnode interlock, so vnode private data cannot suddenly
become NULL.

Tested by: pho
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D39272

15 months agounionfs: remove LK_UPGRADE if falling back to the standard lock
Jason A. Harmening [Mon, 16 Jan 2023 21:46:59 +0000 (15:46 -0600)]
unionfs: remove LK_UPGRADE if falling back to the standard lock

The LK_UPGRADE operation may have temporarily dropped the upper or
lower vnode's lock.  If the unionfs vnode was reclaimed during that
window, its lock field will be reset to no longer point at the
upper/lower vnode lock, so the lock operation will use the standard
lock stored in v_lock.  Remove LK_UPGRADE from the flags in this case
to avoid a lockmgr assertion, as this lock has not been previously
owned by the calling thread.

Reported by: pho
Tested by: pho
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D39272

15 months agoxargs: improve foundeof check for -E
Yuri Pankov [Mon, 17 Apr 2023 19:14:33 +0000 (21:14 +0200)]
xargs: improve foundeof check for -E

4aeb63826e0f got it almost correct (we can't use strcmp() here as
current argument isn't guaranteed to be NUL-terminated), but we also
need to check that current argument length is equal to that of eofstr.

PR: 270867
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D39583

15 months agorenice: Avoid segfault if -n flag is given without argument.
Dag-Erling Smørgrav [Mon, 17 Apr 2023 19:49:13 +0000 (19:49 +0000)]
renice: Avoid segfault if -n flag is given without argument.

Fixes: 65ee0a8495538
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D39623

15 months agogeom: use bool for one-bit wide bit-field
Ed Maste [Mon, 17 Apr 2023 18:56:51 +0000 (14:56 -0400)]
geom: use bool for one-bit wide bit-field

A one-bit wide bit-field can take only the values 0 and -1.  Clang 16
introduced a warning that "implicit truncation from 'int' to a one-bit
wide bit-field changes value from 1 to -1".  Fix by using c99 bool.

Reported by: Clang, via dim
Reviewed by: dim
Sponsored by: The FreeBSD Foundation

15 months agoInclude bsd.linker.mk to get LINKER_TYPE and VERSION in rescue
Dimitry Andric [Mon, 17 Apr 2023 17:43:29 +0000 (19:43 +0200)]
Include bsd.linker.mk to get LINKER_TYPE and VERSION in rescue

To be able to use these make variables, you also have to include
bsd.linker.mk, apparently.

Fixes: 458f4722bf97
MFC after: 1 week

15 months agoMove include of site.src.opts.mk to allow more control
Simon J. Gerraty [Mon, 17 Apr 2023 17:44:37 +0000 (10:44 -0700)]
Move include of site.src.opts.mk to allow more control

Sometimes a site may have different policy needs,
include site.src.opts.mk just before bsd.mkopt.mk to allow
more control.

Reviewed by: imp

15 months agotcp: fix build
Gleb Smirnoff [Mon, 17 Apr 2023 17:24:20 +0000 (10:24 -0700)]
tcp: fix build

The recent 25685b75375 came in conflict with a540cdca318.  Remove the
code that cleans up the old style input queue.  Note that two lines
below we assert that the new style input queue is empty.  The TCP
stacks that use the queue are supposed to flush it in their
tfb_tcp_fb_fini method.

15 months agoSuppress lld 16 errors about multiply defined symbols in rescue
Dimitry Andric [Mon, 17 Apr 2023 16:25:30 +0000 (18:25 +0200)]
Suppress lld 16 errors about multiply defined symbols in rescue

lld >= 16 became more strict about multiply defined symbols. Since there
are many of those in crunchgen'd programs, turn off the check when
linking the rescue binary.

MFC after: 1 week

15 months agolibarchive: make single bit bitfields unsigned to avoid clang 16 warning
Dimitry Andric [Mon, 17 Apr 2023 16:20:56 +0000 (18:20 +0200)]
libarchive: make single bit bitfields unsigned to avoid clang 16 warning

Clang 16 introduced a warning about single bit bitfields in structs,
which is triggered by various declarations in libarchive:

    contrib/libarchive/libarchive/archive_write_set_format_7zip.c:1541:13: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                    file->dir = 1;
                              ^ ~
    contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:5127:15: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                    isoent->dir = 1;
                                ^ ~
    contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:5213:14: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
            isoent->dir = 1;
                        ^ ~
    contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:5214:18: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
            isoent->virtual = 1;
                            ^ ~
    contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7149:18: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
            isoent->virtual = 1;
                            ^ ~
    contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7435:32: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                    iso9660->zisofs.detect_magic = 1;
                                                 ^ ~
    contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7495:25: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
            iso9660->zisofs.making = 1;
                                   ^ ~
    contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7496:26: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
            iso9660->zisofs.allzero = 1;
                                    ^ ~
    contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7702:28: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                            iso9660->zisofs.allzero = 1;
                                                    ^ ~
    contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7871:25: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                    zisofs->header_passed = 1;
                                          ^ ~
    contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7894:24: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                            zisofs->initialized = 1;
                                                ^ ~

Signed one-bit bitfields can only have values -1 and 0, but the intent
here is to use the fields as booleans, so make them unsigned.

This has also been sent upstream.

MFC after: 3 days

15 months agolibsa: make single bit bitfields unsigned to avoid clang 16 warning
Dimitry Andric [Mon, 17 Apr 2023 16:15:57 +0000 (18:15 +0200)]
libsa: make single bit bitfields unsigned to avoid clang 16 warning

Clang 16 introduced a warning about single bit bitfields in structs,
which is triggered by a declaration in libsa's tftp.c:

    stand/libsa/tftp.c:382:20: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                                    h->islastblock = 1;     /* very short file */
                                                   ^ ~
    stand/libsa/tftp.c:432:18: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                    h->islastblock = 1;     /* EOF */
                                   ^ ~

Signed one-bit bitfields can only have values -1 and 0, but the intent
here is to use the field as a boolean, so make it unsigned.

MFC after: 3 days

15 months agobsnmp: make single bit bitfields unsigned to avoid clang 16 warning
Dimitry Andric [Mon, 17 Apr 2023 16:11:56 +0000 (18:11 +0200)]
bsnmp: make single bit bitfields unsigned to avoid clang 16 warning

Clang 16 introduced a warning about single bit bitfields in structs,
which is triggered by a declaration in bsnmp's snmpd.h:

    contrib/bsnmp/snmpd/trans_lsock.c:271:21: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
            peer->input.stream = 1;
                               ^ ~

Signed one-bit bitfields can only have values -1 and 0, but the intent
here is to use the field as a boolean, so make it unsigned.

MFC after: 3 days

15 months agoSuppress lld 16 errors about undefined symbols in version maps
Dimitry Andric [Mon, 17 Apr 2023 16:00:20 +0000 (18:00 +0200)]
Suppress lld 16 errors about undefined symbols in version maps

lld >= 16 turned on --no-undefined-version by default, which results in
errors whenever symbols are mentioned in version maps, but are not
actually defined in the binary.

Since we have quite a few instances of symbols that are defined or not,
depending on various compile-time settings, suppress this lld check for
the time being.

MFC after: 1 week

15 months agonet: replace IFF_KNOWSEPOCH with IFF_NEEDSEPOCH
Gleb Smirnoff [Mon, 17 Apr 2023 16:08:35 +0000 (09:08 -0700)]
net: replace IFF_KNOWSEPOCH with IFF_NEEDSEPOCH

Expect that drivers call into the network stack with the net epoch
entered. This has already been the fact since early 2020. The net
interrupts, that are marked with INTR_TYPE_NET, were entering epoch
since 511d1afb6bf. For the taskqueues there is NET_TASK_INIT() and
all drivers that were known back in 2020 we marked with it in
6c3e93cb5a4. However in e87c4940156 we took conservative approach
and preferred to opt-in rather than opt-out for the epoch.

This change not only reverts e87c4940156 but adds a safety belt to
avoid panicing with INVARIANTS if there is a missed driver. With
INVARIANTS we will run in_epoch() check, print a warning and enter
the net epoch.  A driver that prints can be quickly fixed with the
IFF_NEEDSEPOCH flag, but better be augmented to properly enter the
epoch itself.

Note on TCP LRO: it is a backdoor to enter the TCP stack bypassing
some layers of net stack, ignoring either old IFF_KNOWSEPOCH or the
new IFF_NEEDSEPOCH.  But the tcp_lro_flush_all() asserts the presence
of network epoch.  Indeed, all NIC drivers that support LRO already
provide the epoch, either with help of INTR_TYPE_NET or just running
NET_EPOCH_ENTER() in their code.

Reviewed by: zlei, gallatin, erj
Differential Revision: https://reviews.freebsd.org/D39510

15 months agotcp_hpts: use queue(9) STAILQ for the input queue
Gleb Smirnoff [Mon, 17 Apr 2023 16:07:23 +0000 (09:07 -0700)]
tcp_hpts: use queue(9) STAILQ for the input queue

Reviewed by: rrs
Differential Revision: https://reviews.freebsd.org/D39574

15 months agosqlite3: Vendor import of sqlite3 3.41.2
Cy Schubert [Mon, 17 Apr 2023 16:02:41 +0000 (09:02 -0700)]
sqlite3: Vendor import of sqlite3 3.41.2

Release notes at https://www.sqlite.org/releaselog/3_41_2.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-3410200.tar.gz
MFC after:      2 weeks

Merge commit '853a43f7c79218855a6e45a25a00b942972e3fa1'

15 months agoveriexec: Add function to get label associated with a file
Steve Kiernan [Mon, 3 Apr 2023 00:33:12 +0000 (17:33 -0700)]
veriexec: Add function to get label associated with a file

Add mac_veriexec_metadata_get_file_label to avoid the need to
expose internals to other MAC modules.

Obtained from: Juniper Networks, Inc.

15 months agolibveriexec: add function to check a label based on a path
Steve Kiernan [Mon, 3 Apr 2023 00:09:42 +0000 (17:09 -0700)]
libveriexec: add function to check a label based on a path

veriexec_check_path_label() can be used to check if a specified
path has a label associated with it that contains the what we
want.

Obtained from: Juniper Networks, Inc.

15 months agoveriexec: Rename old VERIEXEC_SIGNED_LOAD as VERIEXEC_SIGNED_LOAD32
Steve Kiernan [Sun, 2 Apr 2023 21:58:27 +0000 (14:58 -0700)]
veriexec: Rename old VERIEXEC_SIGNED_LOAD as VERIEXEC_SIGNED_LOAD32

We need to handle old ioctl from old binary.

Add some missing ioctls.

Obtained from: Juniper Networks, Inc.

15 months agoveriexec: Add option MAC_VERIEXEC_DEBUG
Steve Kiernan [Sun, 2 Apr 2023 19:46:53 +0000 (12:46 -0700)]
veriexec: Add option MAC_VERIEXEC_DEBUG

Obtained from: Juniper Networks, Inc.

15 months agoveriexec: mac_veriexec_syscall compat32 support
Simon J. Gerraty [Sat, 11 Dec 2021 02:32:35 +0000 (18:32 -0800)]
veriexec: mac_veriexec_syscall compat32 support

Some 32bit apps may need to be able to use
MAC_VERIEXEC_GET_PARAMS_PID_SYSCALL
MAC_VERIEXEC_GET_PARAMS_PATH_SYSCALL

Therefore compat32 support is required.

Obtained from: Juniper Networks, Inc.

15 months agoveriexec: Additional functionality for MAC/veriexec
Steve Kiernan [Sun, 2 Apr 2023 19:33:10 +0000 (12:33 -0700)]
veriexec: Additional functionality for MAC/veriexec

Ensure veriexec opens the file before doing any read operations.

When the MAC_VERIEXEC_CHECK_PATH_SYSCALL syscall is requested, veriexec
needs to open the file before calling mac_veriexec_check_vp. This is to
ensure any set up is done by the file system. Most file systems do not
explicitly need an open, but some (e.g. virtfs) require initialization
of access tokens (file identifiers, etc.) before doing any read or write
operations.

The evaluate_fingerprint() function needs to ensure it has an open file
for reading in order to evaluate the fingerprint. The ideal solution is
to have a hook after the VOP_OPEN call in vn_open. For now, we open the
file for reading, envaluate the fingerprint, and close the file. While
this leaves a potential hole that could possibly be taken advantage of
by a dedicated aversary, this code path is not typically visited often
in our use cases, as we primarily encounter verified mounts and not
individual files. This should be considered a temporary workaround until
discussions about the post-open hook have concluded and the hook becomes
available.

Add MAC_VERIEXEC_GET_PARAMS_PATH_SYSCALL and
MAC_VERIEXEC_GET_PARAMS_PID_SYSCALL to mac_veriexec_syscall so we can
fetch and check label contents in an unconstrained manner.

Add a check for PRIV_VERIEXEC_CONTROL to do ioctl on /dev/veriexec

Make it clear that trusted process cannot be debugged. Attempts to debug
a trusted process already fail, but the failure path is very obscure.
Add an explicit check for VERIEXEC_TRUSTED in
mac_veriexec_proc_check_debug.

We need mac_veriexec_priv_check to not block PRIV_KMEM_WRITE if
mac_priv_gant() says it is ok.

Reviewed by: sjg
Obtained from: Juniper Networks, Inc.

15 months agorelease: Remove "All Rights Reserved" from FreeBSD Foundation copyrights
Ed Maste [Mon, 17 Apr 2023 14:56:59 +0000 (10:56 -0400)]
release: Remove "All Rights Reserved" from FreeBSD Foundation copyrights

15 months agosqlite3: Vendor import of sqlite3 3.41.2
Cy Schubert [Mon, 17 Apr 2023 14:10:51 +0000 (07:10 -0700)]
sqlite3: Vendor import of sqlite3 3.41.2

Release notes at https://www.sqlite.org/releaselog/3_41_2.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-3410200.tar.gz

15 months agoriscv: save the thread pointer in both modes
Mark Johnston [Mon, 17 Apr 2023 13:44:44 +0000 (09:44 -0400)]
riscv: save the thread pointer in both modes

The contents of frame->tf_tp are uninitialized if accessed by DTrace (in
probe context), resulting in a panic when trying to access the memory
pointed to by tp. This saves the thread pointer to the trap frame when
handling both userland and kernel exceptions.

Reviewed by: markj, mhorne
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39582

15 months agotests: make ktest build on ppc.
Alexander V. Chernikov [Mon, 17 Apr 2023 13:46:44 +0000 (13:46 +0000)]
tests: make ktest build on ppc.

MFC after: 2 weeks

15 months agomakefs: remove unused variable
Ed Maste [Mon, 17 Apr 2023 12:12:27 +0000 (08:12 -0400)]
makefs: remove unused variable

Reported by: Clang
Sponsored by: The FreeBSD Foundation

15 months agomakefs: use unsigned and %u for rock_ridge_move_count
Ed Maste [Mon, 10 Apr 2023 22:53:53 +0000 (18:53 -0400)]
makefs: use unsigned and %u for rock_ridge_move_count

For diff reduction against NetBSD's makefs.  Based on NetBSD git mirror
commit 00991aee8248.

With this change our makefs cd9660 support should be in sync up to
NetBSD commit bdae6c9dc792 ("makefs(8): Nix trailing whitespace.").

Sponsored by: The FreeBSD Foundation

15 months agonetlink: fix operations with link-local routes/gateways.
Alexander V. Chernikov [Mon, 17 Apr 2023 12:04:43 +0000 (12:04 +0000)]
netlink: fix operations with link-local routes/gateways.

MFC after: 3 days

15 months agotests: add ktest modules to build
Alexander V. Chernikov [Mon, 17 Apr 2023 10:45:47 +0000 (10:45 +0000)]
tests: add ktest modules to build

MFC after: 2 weeks

15 months agozfs: Add vfs.zfs.bclone_enabled sysctl.
Pawel Jakub Dawidek [Mon, 17 Apr 2023 10:38:30 +0000 (03:38 -0700)]
zfs: Add vfs.zfs.bclone_enabled sysctl.

Keep block cloning disabled by default for now, but allow to enable and
use it after setting vfs.zfs.bclone_enabled to 1, so people can easily
try it.

Approved by: oshogbo
Reviewed by: mm, oshogbo
Differential Revision: https://reviews.freebsd.org/D39613

15 months agolagg(4): Correctly define some sysctl variables
Zhenlei Huang [Mon, 17 Apr 2023 10:24:35 +0000 (18:24 +0800)]
lagg(4): Correctly define some sysctl variables

939a050ad96c virtualized lagg(4), but the corresponding sysctl of some
virtualized global variables are not marked with CTLFLAG_VNET. A try to
operate on those variables via sysctl will effectively go to the 'master'
copies and the virtualized ones are not read or set accordingly. As a
side effect, on updating the 'master' copy, the virtualized global
variables of newly created vnets will have correct values.

PR: 270705
Reviewed by: kp
Fixes: 939a050ad96c Virtualize lagg(4) cloner
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39467

15 months agovnet: Fix a typo in a source code comment
Zhenlei Huang [Mon, 17 Apr 2023 10:24:35 +0000 (18:24 +0800)]
vnet: Fix a typo in a source code comment

- s/form/from/

MFC after: 3 days

15 months agozfs: Merge https://github.com/openzfs/zfs/pull/14739
Pawel Jakub Dawidek [Mon, 17 Apr 2023 09:22:56 +0000 (02:22 -0700)]
zfs: Merge https://github.com/openzfs/zfs/pull/14739

The zfs_log_clone_range() function is never called from the
zfs_clone_range_replay() function, so I assumed it is safe to assert
that zil_replaying() is never TRUE here. It turns out zil_replaying()
also returns TRUE when the sync property is set to disabled.

Fix the problem by just returning if zil_replaying() returns TRUE.

Reported by: Florian Smeets
Signed-off-by: Pawel Jakub Dawidek pawel@dawidek.net
Approved by: oshogbo, mm

15 months agozfs: cherry-pick openzfs/zfs@c71fe7164
Pawel Jakub Dawidek [Mon, 17 Apr 2023 09:19:49 +0000 (02:19 -0700)]
zfs: cherry-pick openzfs/zfs@c71fe7164

Fix data corruption when cloning embedded blocks

Don't overwrite blk_phys_birth, as for embedded blocks it is part of
the payload.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Issue #13392
Closes #14739

Approved by: oshogbo, mm

15 months agoUpdate meta mode makefiles
Simon J. Gerraty [Mon, 17 Apr 2023 01:40:53 +0000 (18:40 -0700)]
Update meta mode makefiles

meta2deps - add checks to detect truncated/corrupted filemon data
(only known to happen on Linux hosts), to ensure we do not auto
update dependencies based on incomplete data.

meta.stage.mk adds STAGE_SHLIB_LINKS_FILTER and STAGE_LINK_AS_*

We also allow for hosts where egrep is deprecated for grep -E

Reviewed by: stevek

15 months agoveriexec: Add SPDX-License-Identifier
Stephen J. Kiernan [Mon, 17 Apr 2023 01:21:21 +0000 (21:21 -0400)]
veriexec: Add SPDX-License-Identifier

15 months agoUpdate dirdeps.mk
Simon J. Gerraty [Mon, 17 Apr 2023 01:17:26 +0000 (18:17 -0700)]
Update dirdeps.mk

Fix handling of local.dirdeps-missing.mk
we need to reset DEP_RELDIR and DIRDEPS just as if including
a Makefile.depend*

Also fix a typo in DIRDEP_LOADAVG_REPORT
and improve debug output.

Reviewed by: stevek

15 months agoveriexec: fix use of getopt
Stephen J. Kiernan [Mon, 17 Apr 2023 00:59:37 +0000 (20:59 -0400)]
veriexec: fix use of getopt

getopt(3) returns int type not char. Using char triggers the
-Wtautological-constant-out-of-range-compare warning with clang.
Change the type of the variable used for holding the return value
of getopt(3) to int to match the prototype and eliminate the warning.

MFC after: 1 week

15 months agosys/modules/Makefile: conditionally add MAC/veriexec modules
Stephen J. Kiernan [Sun, 16 Apr 2023 23:36:07 +0000 (19:36 -0400)]
sys/modules/Makefile: conditionally add MAC/veriexec modules

Only build MAC/veriexec modules when MK_VERIEXEC is yes or we
are building all modules.

Add VERIEXEC knob to kernel __DEFAULT_NO_OPTIONS

Reviewed by: sjg
Obtained from: Juniper Networks, Inc.

15 months agoveriexec: allow sha512 fingerprint in manifest parser
Stephen J. Kiernan [Sun, 16 Apr 2023 23:25:27 +0000 (19:25 -0400)]
veriexec: allow sha512 fingerprint in manifest parser

MAC/veriexec already supports SHA512 fingerprints, therefore the
veriexec program should also.

Reviewed by: sjg

15 months agosys/modules/Makefile: add MAC/veriexec modules into the build
Stephen J. Kiernan [Sun, 16 Apr 2023 23:16:49 +0000 (19:16 -0400)]
sys/modules/Makefile: add MAC/veriexec modules into the build

Build the MAC/veriexec module and the SHA2, SHA256, SHA384, and
SHA512 fingerprint modules.

Obtained from: Juniper Networks, Inc.