Commit graph

25081 commits

Author SHA1 Message Date
artembunichev
8cebb06300 open.2: add separate paragraph for O_CREAT
PR:	284353
MFC after:	1 week
2025-02-28 12:29:12 +02:00
Stefan Eßer
ab6a311c72 libc/gen/fts.c: fix assignment
Fix typo in commit e59991206b ("==" instead of "=" for the assignment
of st_ino).

Reported by:	Coverity Scan CID 1592442
Approved by:	kib
Fixes:		e59991206b fts(3): be less strict when automount does its job under us walking autofs mount
2025-02-27 10:29:17 +01:00
Kyle Evans
181549c37f libbe: avoid copying encryption-related props
libzfs insists that these be cloned from the origin, so avoid making a
deep copy of them ourselves to unbreak creating a new BE from a BE with
encrypted components -- in today's environment, without a loader that
does encryption, this means a deep BE setup where something underneath
the BE (e.g., home directories) are encrypted.

Reported and tested by:	arrowd
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D48464
2025-02-26 16:24:24 -06:00
Andrew Gallatin
709348c213 ifconfig: fix reporting optics on most 100g interfaces
This fixes a bug where optics on 100G and faster NICs
were not properly reported.

The problem is that we pull the string from the correct
table in ifconfig_sfp_physical_spec only when sfp_eth_1040g
contains the SFP_ETH_1040G_EXTENDED bit.  However, we were
never saving that bit when it was encountered.  This change
records that bit into sfp_eth_1040g, allowing us to later
select the appropriate ID string.

This should cause most 100G interfaces to stop being identified
as "unknown" in the "plugged" output of ifconfig -v, and to
start being identified as what they really are.

Example output from a Chelsio T6 with SR4 optics in one port
and DR1 optics in another:

Before:
plugged: QSFP28 Unknown (MPO 1x12 Parallel Optic)
plugged: QSFP28 Unknown (LC)

After:
plugged: QSFP28 100GBASE-SR4 or 25GBASE-SR (MPO 1x12 Parallel Optic)
plugged: QSFP28 100GBASE-DR (LC)

Reviewed by: kbowling, np
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D49127
MFC after: 7 days
2025-02-25 14:26:07 -05:00
acazuc
601925180d libpmc: add more alderlake models
According to [1], the CPU models 6-{b7,ba,bf} are also alderlake-family
models. This patch adds them to the mapfile.csv.

[1] https://github.com/torvalds/linux/blob/master/tools/perf/pmu-events/arch/x86/mapfile.csv#L2

Reviewed by:	mhorne
MFC after:	3 days
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D49126
2025-02-25 11:35:26 -04:00
Christos Margiolis
f121de8fbc mixer(3): Do not skip devices with no volume control
Some devices might not have a software volume control, but still be
able to be set as recording sources.

PR:		279787
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D48730
2025-02-25 13:44:49 +02:00
Konstantin Belousov
e59991206b fts(3): be less strict when automount does its job under us walking autofs mount
Namely, allow the file id change if the resulting file belongs to
automounted filesystem.  If it is, remember the updated id.

This allows the ids from the automounted volumes to change without
restrictions, might be a further refinement would be to only allow such
inconsistency once.

PR:	284914
Reported and tested by:	Lexi Winter <lexi@hemlock.eden.le-fay.org>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D49094
2025-02-25 09:09:29 +02:00
Konstantin Belousov
d40daefca6 libc/gen: split user-visible opendir()-like functions into separate source files
This allows, for instance, to interpose opendir() with an implementation
that calls into fdopendir(), without causing multiple symbol definitions
when libc is linked in statically.

This is aligned with the quality of implementation principle that single
object file from a static library should not provide more than one
app-visible symbol.

[The copyright for fopendir() was copied, it might be refined by the
author]

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D49089
2025-02-25 09:09:29 +02:00
Alexander Ziaee
7c3c8605d6
recv.2: Improve style in RETURN VALUES
Reported by:		des
MFC after:		3 days
Fixes:			571df2c64a (Explain how recv functions can)
Reviewed by:		mhorne, des
Approved by:		mhorne (mentor)
Differential Revision:	https://reviews.freebsd.org/D48995
2025-02-24 12:33:38 -05:00
Jose Luis Duran
39d58c8160
libefivar: Add Display Only format for Hard Drive
Ref: UEFI Specification Version 2.1 (Errata D) (released October 2008)

Reviewed by:	imp, emaste
Approved by:	emaste (mentor)
Obtained from:	9e6537469d
Differential Revision:	https://reviews.freebsd.org/D49060
2025-02-20 20:14:26 +00:00
Jose Luis Duran
05653fc774
libefivar: CodeQL Fixes
These libefivar files correspond to the following EDK2 Tianocore
routines:

efivar-dp-format.c -> MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
efivar-dp-parse.c  -> MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c

The following changes were apparently applied upstream to appease their
CodeQL workflows on GitHub.  Note that some of these changes are
logically contradictory, however avoiding differences between the two
code bases is a priority, as noted in the review.

Commit message from upstream:

Includes changes across the repo for the following CodeQL rules:
- cpp/comparison-with-wider-type
- cpp/overflow-buffer
- cpp/redundant-null-check-param
- cpp/uselesstest

Reviewed by:	imp
Approved by:	emaste (mentor)
Obtained from:	b7735a087a
Differential Revision:	https://reviews.freebsd.org/D49059
2025-02-20 20:11:52 +00:00
Jose Luis Duran
b5f60442a0
libefivar: Fix sed pattern
Add a 'g' flag to allow the replacement to occur more than once on the
same line.

Reviewed by:	imp, emaste
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D49058
2025-02-20 20:10:06 +00:00
Konstantin Belousov
e951247a98 statfs.2: document missing user-visible MNT flags
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-02-20 17:25:42 +02:00
Konstantin Belousov
0738cd9766 statfs.2: order MNT flags alphabetically
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-02-20 17:03:49 +02:00
Konstantin Belousov
13b92ae965 statfs.2: remove dead comment
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-02-20 16:58:17 +02:00
Konstantin Belousov
270542d95d statfs.2: uncomment and describe MNT_IGNORE
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-02-20 16:58:17 +02:00
Brooks Davis
cdb24fbb0a libsys: Don't create or expose __realpathat
Previously, __realpathat was in libc and libsys (as is currently
standard), but not exported from libc which meant the stub in libc was
not filtered and thus libc's copy of the syscall was used.  This broke
an upcoming change to CheriBSD limiting syscalls to libsys.

The realpath(3) implementation now uses __sys___realpathat so there are no
consumers of __realpathat.  Switch it to PSEUDO (only _foo and __sys_foo
symbols) and remove __realpathat from Symbol.map.

This is a corrected version of 58d43a3cd7.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D49049
2025-02-19 20:05:47 +00:00
Brooks Davis
58d43a3cd7 Revert "libsys: Don't create or expose __realpathat"
This change broke RTLD.  Revert while I test a fix.

This reverts commit fdccf03361.
2025-02-19 19:07:34 +00:00
Brooks Davis
fdccf03361 libsys: Don't create or expose __realpathat
Previously, __realpathat was in libc and libsys (as is currently
standard), but not exported from libc which meant the stub in libc was
not filtered and thus libc's copy of the syscall was used.  This broke
an upcoming change to CheriBSD limiting syscalls to libsys.

The realpath(3) implementation now uses __sys___realpathat so there are no
consumers of __realpathat.  Switch it to PSEUDO (only _foo and __sys_foo
symbols) and remove __realpathat from Symbol.map.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D49049
2025-02-19 16:55:05 +00:00
Brooks Davis
ed955671d2 libc: use __sys___realpathat directly in realpath
We don't need to use an interposable symbol for this purpose and it's
simpler to just call the syscall in libsys.  This resolves a bug where
we were incorrectly using __realpathat in libc not libsys.

While here, drop support for running on a FreeBSD 12 kernel and simplify
includes.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D49048
2025-02-19 16:55:04 +00:00
Kajetan Staszkiewicz
07e070ef08 pf: Add support for multiple source node types
For every state pf creates up to two source nodes: a limiting one
struct pf_kstate -> src_node and a NAT one struct pf_kstate -> nat_src_node.
The limiting source node is tracking information needed for limits using
max-src-states and max-src-nodes and the NAT source node is tracking NAT
rules only.

On closer inspection some issues emerge:
- For route-to rules the redirection decision is stored in the limiting source
  node. Thus sticky-address and source limiting can't be used separately.
- Global source tracking, as promised in the man page, is totally absent from
  the code. Pfctl is capable of setting flags PFRULE_SRCTRACK (enable source
  tracking) and PFRULE_RULESRCTRACK (make source tracking per rule). The kernel
  code checks PFRULE_SRCTRACK but ignores PFRULE_RULESRCTRACK. That makes
  source tracking work per-rule only.

This patch is based on OpenBSD approach where source nodes have a type and each
state has an array of source node pointers indexed by source node type
instead of just two pointers. The conditions for limiting are applied
only to source nodes of PF_SN_LIMIT type. For global limit tracking
source nodes are attached to the default rule.

Reviewed by:		kp
Approved by:		kp (mentor)
Sponsored by:		InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D39880
2025-02-13 15:59:12 +01:00
Kristof Provost
71594e3235 pf: support "!received-on <interface>"
ok dlg benno

Obtained from:	OpenBSD, henning <henning@openbsd.org>, 7d0482a910
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-13 13:38:44 +01:00
Felix Johnson
571df2c64a
recv.2: Explain how recv functions can return 0
Clarify the RETURN VALUES section with improved structure,
the condition of the return value 0, and the setting of errno.

PR:			174581
Reviewed by:		jhb, ziaee
Approved by:		mhorne (mentor)
Differential Revision:	https://reviews.freebsd.org/D48955
2025-02-12 22:54:14 -05:00
John Baldwin
d35b039af9 gpart: Stop documenting freebsd-vinum partition types
Support for the partition types is still retained so that tools can
display existing partitions.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D48535
2025-02-11 09:13:32 -05:00
Kristof Provost
0d2058abf3 pf: convert DIOCRDELTABLES to netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-10 12:09:47 +01:00
Kristof Provost
84a80eae69 pf: convert DIOCRADDTABLES to netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-10 12:09:47 +01:00
Mark Johnston
23a28fe777 libvmmapi: Fix auto-loading of vmm.ko
- We should autoload vmm.ko when creating a VM with vm_openf(), to
  preserve behaviour prior to commit 99127fd103.
- kldload(2) returns a non-zero value upon success, so the existing code
  was wrong.

Reviewed by:	jhb
Reported by:	olivier
Fixes:		99127fd103 ("libvmmapi: Use the vmmctl device file to create and destroy VMs")
Differential Revision:	https://reviews.freebsd.org/D48797
2025-02-06 16:25:42 +00:00
Mark Johnston
ee951eb59f socket: Add an option to retrieve a socket's FIB number
The SO_SETFIB option can be used to set a socket's FIB number, but there
is no way to retrieve it.  Rename SO_SETFIB to SO_FIB and implement a
handler for it for getsockopt(2).

Reviewed by:	glebius
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D48834
2025-02-06 14:17:19 +00:00
Jose Luis Duran
bccaf0262d
libopencsd: Remove extra slashes
Remove extra slashes that end up in the metalog.  These double slashes
can produce an invalid specification file if there are subdirectories
down the hierarchy when sorted.

For example, consider the following metalog excerpt:

    ./base/aaa type=dir
    ./base//aaa/bbb type=dir

If sorted, would turn out:

    ./base//aaa/bbb type=dir
    ./base/aaa type=dir

Apparently missing the ./base/aaa directory in the specification.

Luckily here are no subdirectories.

Reviewed by:	imp, emaste
Approved by:	emaste (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48779
2025-02-04 14:15:37 +00:00
Jose Luis Duran
841856570e
csu tests: Remove extra slash
Remove an extra slash that ends up in the metalog.  This double slash
can produce an invalid specification file if there are subdirectories
down the hierarchy when sorted.

For example, consider the following metalog excerpt:

    ./base/aaa type=dir
    ./base//aaa/bbb type=dir

If sorted, would turn out:

    ./base//aaa/bbb type=dir
    ./base/aaa type=dir

Apparently missing the ./base/aaa directory in the specification.

Luckily here are no subdirectories.

Reviewed by:	imp, emaste
Approved by:	emaste (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48778
2025-02-04 14:15:12 +00:00
Gleb Smirnoff
fe5a6266dd protosw: this is a kernel only header, put back #ifdef _KERNEL
The uncommented #ifdef _KERNEL originates from 1997 by wollman@ (see
57bf258e3d) with no clear original reason.  Since these old times two
abusers of the header leak were created - libprocstat(3) and netstat(1).
These two already have a lot of _WANT_FOO hacks, so satisfy them with
_WANT_PROTOSW.

While here, cleanup and sort forward declaraions.
2025-02-03 09:48:53 -08:00
Gleb Smirnoff
99e5a70046 sysent: regen for deletion of gssd_syscall and new ABI for rpctls_syscall 2025-02-01 01:00:28 -08:00
Gleb Smirnoff
c62ae124cc rpc: limited multithread support for svc_nl
The rpc(3) itself was not designed with multithreading in mind, but we can
actually achieve some parallelism without modifying the library and the
framework.  This transport will allow to process RPCs in threads, with
some hacks on the application side (documented in code).  We make
reentrable only one method - SVC_REPLY().  Reading and parsing of incoming
calls is still done synchronously.  But the actual processing of the calls
can be offloaded to a thread, and once finished the thread can safely
execute svc_sendreply() and the reply would be sent with the correct xid.

Differential Revision:	https://reviews.freebsd.org/D48569
2025-02-01 01:00:28 -08:00
Gleb Smirnoff
030c028255 kgssapi: remove the gssd_syscall
Reviewed by:		brooks
Differential Revision:	https://reviews.freebsd.org/D48554
2025-02-01 01:00:26 -08:00
Gleb Smirnoff
c5d671b711 libc/rpc: add userland side RPC server over netlink(4)
To be used by NFS related daemons that provide RPC services to the kernel.
Some implementation details inside the new svc_nl.c.

Reviewed by:		rmacklem
Differential Revision:	https://reviews.freebsd.org/D48550
2025-02-01 01:00:25 -08:00
John Baldwin
38e1083940 nvmf: Add NVMF_CONNECTION_STATUS ioctl
This returns an nvlist indicating if a Fabrics host is connected and
the time of the most recent disconnection.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48219
2025-01-31 15:47:58 -05:00
Kirk McKusick
1111a44301 Defer the January 19, 2038 date limit in UFS1 filesystems to February 7, 2106
UFS1 uses a signed 32-bit value for its times. Zero is
January 1, 1970 UTC. Negative values of 32-bit time predate
January 1, 1970 back to December 13, 1901. The maximum positive
value for 32-bit time is on January 19, 2038 (my 84th birthday).
On that date, time will go negative and start registering from
December 13, 1901. Note that this issue only affects UFS1 filesystems
since UFS2 has 64-bit times. This fix changes UFS1 times from
signed to unsigned 32-bit values. With this change it will no longer
be possible to represent time from before January 1, 1970, but it
will accurately track time until February 7, 2106. Hopefully there
will not be any FreeBSD systems using UFS1 still in existence by
that time (and by then I will have been dead long enough that no-one
will know at whom to yell :-).

It is possible that some existing UFS1 systems will have set times
predating January 1, 1970. With this commit they will appear as
later than the current time. This commit checks inode times when
they are read into memory and if they are greater than the current
time resets them to the current time. By default this reset happens
silently, but setting the sysctl vfs.ffs.prttimechgs=1 will cause
console messages to be printed whenever a future time is changed.

Reviewed-by: kib
Tested-by:   Peter Holm
MFC-after:   1 week
Differential Revision: https://reviews.freebsd.org/D48472
2025-01-30 17:31:08 -08:00
John Baldwin
de3deff65c libiscsiutil: Add log_warnc() and log_errc() functions
These are similar to warnc() and errc() in that they take an explicit
error code instead of using the value of the errno global.

Reviewed by:	mav, asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48648
2025-01-30 10:15:39 -05:00
John Baldwin
7554746c43 libdevinfo: Avoid false positives for the root0 sentinel value
Previously, a NULL pointer value was used to request the root0 device
at the top of the device tree.  However, this meant that resource
ranges from a rman with a NULL device pointer were annotated as being
owned by root0 instead of being unowned.  Switch to a different value
for root0's sentinel to avoid the clash.

Since this is an ABI change, bump the SHLIB_MAJOR for libdevinfo to 7.

Reported by:	jrtc27
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D48675
2025-01-29 10:03:59 -05:00
Konstantin Belousov
21502f9a92 crtend: accurately check for the start of .ctors
For the hypothetic situation where crtbegin.o is not linked into the
binary, but crtend.o is, which results in the missing starting sentinel
in the ctors array, be careful to not iterate past the start of the
section.

Reviewed by:	andrew, dim
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D48700
2025-01-29 00:59:20 +02:00
Konstantin Belousov
6ee34bca48 crtbegin: accurately check for the end of .dtors
not relying only on the end section marker, but also checking for the
section size when iterating.

Reported by:	kargl
Analyzed by:	dim
Reviewed by:	andrew, dim
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D48700
2025-01-29 00:59:20 +02:00
Kirk McKusick
aa90fbed15 Standardize the definition of a UFS dinode.
Each program that operates on UFS on-disk inodes defines its own
version of a dinode. They all (of necessity) define the same
layout but use different names. This change adds a definition of
a dinode (a union of a UFS1 on-disk inode and a UFS2 on-disk inode)
as well as a dinodep (a union of a pointer to a UFS1 on-disk inode
and a pointer to a UFS2 on-disk inode) in sys/ufs/ufs/dinode.h.
It then deletes the definitions of dinode and dinodep in all the
programs that operate on them and instead uses these standard
definitions.

No functional change intended.

MFC-after: 1 week
2025-01-27 17:39:45 -08:00
CismonX
c814172896 open.2: update description for O_PATH
- Add fstatfs(), fchdir(), fchroot(), extattr_*_fd(), cap_*_get(),
  cap_*_limit() to the list of syscalls that can take an O_PATH fd.
- Remove readlinkat() from the list, since it is already discussed
  in the first few lines of the paragraph.  It was originally added
  to the list when readlinkat() adds support for non-dir fd with
  an empty relative path (as if with AT_EMPTY_PATH), however,
  such use case is also discussed in the next paragraph.
- Add funlinkat() to the list, since it accepts an extra fd
  (of the file to be unlinked), which is worth extra mentioning.
- Fix a syntax issue which causes a bogus space to be rendered
  before a closing parentheses.

Signed-off-by: CismonX <admin@cismon.net>

Reviewed by:	markj, jhb
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1564
2025-01-24 20:15:09 +00:00
John Baldwin
dd3603749c iscsi: Move valid_iscsi_name to libiscsiutil
While here, use isxdigit(3) instead of a home-rolled version.

Reviewed by:	mav, asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48593
2025-01-24 09:53:22 -05:00
John Baldwin
8bba2c0f89 nvmf: Refactor reconnection support
Save more data associated with a new association including the network
address of the remote controller.  This permits reconnecting an
association without providing the address or other details.  To use
this new mode, provide only an existing device ID to nvmecontrol's
reconnect command.  An address can still be provided to request a
different address or other different settings for the new association.

The saved data includes an entire Discovery Log page entry to aim to
be compatible with other transports in the future.  When a remote
controller is connected to via a Discovery Log page entry (nvmecontrol
connect-all), the raw entry is used.  When a remote controller is
connected to via an explicit address, an entry is synthesized from the
parameters.

Note that this is a pseudo-ABI break for the ioctls used by nvmf(4) in
that the nvlists for handoff and reconnect now use a slightly
different set of elements.  Since this is only present in main I did
not bother implementing compatability shims.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48214
2025-01-24 09:43:19 -05:00
Konstantin Belousov
6700e2d963 csu: add the "Retain" flag to notes sections flag
It should make the notes immune against --gc-sections.

Reported and tested by:	bapt
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2025-01-24 15:36:41 +02:00
Kristof Provost
0972294ef0 pf: add a dedicated pf pool for route options
As suggested by henning.
Which unbreaks ie route-to after the recent pf changes.

With much help debugging and pointing out of missing bits from claudio@

ok claudio@ "looks good" henning@

Obtained from:	OpenBSD, jsg <jsg@openbsd.org>, 7fa5c09028
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-01-24 11:20:30 +01:00
John Baldwin
27bd6c32bb Remove references to gvinum(8) in various manpages
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D48540
2025-01-23 13:16:47 -05:00
Simon J. Gerraty
f486ebb5e3 libsecureboot/README.rst clarify use of gpg
Clarify some language and provide an example of gpg use to generate
a detached signature.
2025-01-22 19:10:10 -08:00
Emmanuel Vadot
9dcb984251 Remove publickey(5) stuff
This uses DES and it's likely that nobody uses that in 2025.
If somebody uses this we help them by deprecating and removing this.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D30683
2025-01-22 18:04:26 +01:00