Commit Graph

281274 Commits

Author SHA1 Message Date
Mitchell Horne
a7a452fedc Update comments referencing create_thread()
The equivalent function is now named thread_create(). Mention
kthread_add() where it is also relevant.

Reviewed by:	kib, markj
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38180
2023-02-09 11:58:06 -04:00
Alexander V. Chernikov
25c2dd2f2c netlink: return optional metadata with the operation result.
Some operations like interface creation may need to return metadata
 - in this case, interface name - back to the caller if the operation
 is successful.
This change implements attaching an `NLMSGERR_ATTR_COOKIE` nla to the
operation reply message via `nlmsg_report_cookie()`.
Additionally, on successful interface creation, interface index and
 interface name are returned in the `IFLA_NEW_IFINDEX` and `IFLA_IFNAME
 TLVs, encapsulated in the `NLMSGERR_ATTR_COOKIE`.

Reviewed By: pauamma
Differential Revision: https://reviews.freebsd.org/D38283
MFC after:	1 week
2023-02-09 15:30:00 +00:00
Mark Johnston
08b0c98006 atomic: Fix the atomic_load_ptr() *SAN interceptor
The interceptor didn't handle a pointer of type "foo * const *" and in
that case we'd get compiler errors 1) an invalid cast to volatile
uintptr_t, and 2) an assignment to a variable of type "foo * const"
(__retptr).

Reported by:	mjg
MFC after:	1 week
2023-02-09 10:16:34 -05:00
Alexander V. Chernikov
6332ef8941 testing: handling non-root users with VNETs in pytest-based tests.
Currently isolation and resource requirements are handled directly
 by the kyua runner, based on the requirements specified by the test.
It works well for simple tests, but may cause discrepancy with tests
 doing complex pre-setups. For example, all tests that perform
 VNET setups require root access to properly function.

This change adds additional handling of the "require_user" property
 within the python testing framework. Specifically, it requests
 root access if the test class signals its root requirements and
 drops privileges to the desired user after performing the pre-setup.

Differential Revision: https://reviews.freebsd.org/D37923
MFC after:	2 weeks
2023-02-09 14:49:27 +00:00
Alexander V. Chernikov
5a5436eb5d netlink: do not require elevated privileges when reading arp/ndp state.
MFC after:	1 day
2023-02-09 14:12:33 +00:00
Dimitry Andric
c8f47b2882 Add libclang_rt files for powerpc64 to ObsoleteFiles.inc
Since f5024381ac we have also built and installed several clang
runtime support libraries (for sanitizers) on powerpc64, so add entries
to properly clean these up when upgrading.

Reported by:	pkubaj
PR:		269423
MFC after:	2 weeks
2023-02-09 09:59:54 +01:00
Kyle Evans
b4f7a31fd1 buildworld: drop config(8) dependencies from bootstrap
We may still need them for other parts, so just remove the dependency
relationship for now and simplify config's place in bootstrap-tools.

Reviewed by:	imp
Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D38277
2023-02-08 23:19:23 -06:00
Kyle Evans
ee3872a714 tools: cleanup stale dependencies from further config(8) C++ification
Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D38276
2023-02-08 23:19:09 -06:00
Kyle Evans
83d7ed8af3 config: drop dependency on libsbuf
Use an std::stringstream instead.  get_word() and get_quoted_word() both
return a buffer that's presumed to not need release, so solve this by
returning a new special configword type that holds a string or eof/eol
state.  This cleans up caller checking for EOF/EOL to make it more
explicit what they're doing, at least in the EOL cases which previously
checked for NULL.

Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D38276
2023-02-08 22:56:10 -06:00
Konstantin Belousov
ee84487120 amd64 ia32 vdso: always define some __vdso_ symbols
... regardless of the kernel config options.
It is reported that llvm16 ld.lld warns about undefined symbols
referenced by the VERSION script.

Reviewed by:	emaste, val_packett.cool
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38392
2023-02-09 04:36:40 +02:00
Konstantin Belousov
5bb807fed4 amd64: record a dependency of vdso on its linker script
Reviewed by:	emaste, val_packett.cool
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38392
2023-02-09 04:36:39 +02:00
Kevin Bowling
905ae5881b e1000: Add support for future client platforms
MFC after:	2 weeks
Sponsored by:	BBOX.io
2023-02-08 18:14:41 -07:00
Kevin Bowling
5636590214 e1000: Fix packet loss on 11th gen and later
Ungate DMA clock on TGP and later to avoid packet loss.

A similar fix appears in Linux 639e298f432fb058a9496ea16863f53b1ce935fe

This may be needed as far back as SPT but no confirmation from intel or
other OS yet.

Obtained from:	OpenBSD (if_em_hw.c 1.116)
MFC after:	2 weeks
Sponsored by:	BBOX.io
2023-02-08 17:50:33 -07:00
Kevin Bowling
d36fbdb08f e1000: Remove redundant disable_ulp for ich8lan
This call only makes sense for ich8lan, and the shared code does it in
e1000_setup_init_funcs() above this deletion.

Obtained from:	DPDK
MFC after:	2 weeks
Sponsored by:	BBOX.io
Pull Request:	https://github.com/freebsd/freebsd-src/pull/539
2023-02-08 17:24:28 -07:00
Ed Maste
1aa9a35f63 ssh: fix SIZEOF_TIME_T #define on i386
Reported by:	imp
Reviewed by:	imp
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38443
2023-02-08 18:34:09 -05:00
Cy Schubert
6a70e0b4cd heimdal: Resolve hdb_free_entry() SIGSEGV/SIGILL
When the client sends kadmind a create principal (kadm_create) request
kadm_s_create_principal() returns an error before zeroing out ent (an
hdb entry structure wrapper -- hdb_entry_ex), resulting in a NULL
reference.

Fix obtained from upstream commit 35ea4955a.

PR:		268059
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Obtained from:	Heimdal commit 35ea4955a
MFC after:	3 days
2023-02-08 15:08:54 -08:00
Dag-Erling Smørgrav
0dfaefa975 depend-cleanup.sh: Simplify the logic, and clean bootstrap tools.
* There's no need to check if the file exists before grepping it; if it does not exist, grep will fail, which is what we want.  Just redirect the error message to /dev/null.
* There's no need to split the .o and .pico cases; the bodies are identical, so combine the conditions.  Use a glob to avoid a false negative if one exists but not the other.
* Also run depend-cleanup.sh on the bootstrap build tree.  This unbreaks the build after 29c5f8bf9a.

Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D38447
2023-02-08 23:59:13 +01:00
Rick Macklem
847967bc4e nfscl: Fix interaction between mmap'd and VOP_WRITE file updates
asomers@ found a problem with the NFS client, where a write to
an NFS mounted file done via mmap(2) was lost when fspacectl(2)
was done before it.  This turned out to be caused by clearing the
dirty bit on pages when the client was doing commit RPCs,
due to the second argument to vfs_busy_pages() being set to 1.
Commit RPCs tell the server to commit previously written data to
stable storage.  However, Commit RPCs do not write data from the
client to the server.  As such, if the dirty bit on the page has
been set by a mmap'd write to an address in the page, it should
not be cleared.  Clearing it causes the mmap'd write to by lost.

This patch fixes the problem by changing the 2nd argument to
vfs_busy_pages() to 0 for this case.

I doubt this bug has affected many, since it was inherited from
the old NFS client and was in 4.3 FreeBSD twenty years ago.
Although fspacectl(2) is FreeBSD 14 specific, a write(2) would
cause the same failure.

Reviewed by:	kib
Tested by:	asomers
PR:	269328
MFC after:	1 week
2023-02-08 14:25:01 -08:00
Rick Macklem
ded5f2954e nfsd: Fix handling of the error case for nfsvno_open
Using done_namei instead of ni_startdir did not
fix the crashes reported in the PR. Upon looking
more closely at the code, the only case where the
code near the end of nfsvno_open() needs to be
executed is when nfsvno_namei() has succeeded,
but a subsequent error was detected.

This patch uses done_namei to indicate this case.

Also, nfsvno_relpathbuf() should only be called for
this case and not whenever nfsvno_open() is called
with nd_repstat != 0. A bug was introduced here when
the HASBUF flag was deleted.

Reviewed by:	mjg
PR:	268971
Tested by:	ish@amail.plala.or.jp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38430
2023-02-08 13:08:51 -08:00
Vincenzo Maffione
fa3f665542 netmap: drop redundant if_mtu assignment
Reported by:	zlei
MFC after	3 days
2023-02-08 21:05:32 +00:00
Mitchell Horne
e6cf1a0826 physmem: add ram0 pseudo-driver
Its purpose is to reserve all I/O space belonging to physical memory
from nexus, preventing it from being handed out by bus_alloc_resource()
to callers such as xenpv_alloc_physmem(), which looks for the first
available free range it can get. This mimics the existing pseudo-driver
on x86.

If needed, the device can be disabled with hint.ram.0.disabled="1" in
/boot/device.hints.

Reviewed by:	imp
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D32343
2023-02-08 16:50:46 -04:00
Elliott Mitchell
f9bdaab95e ofwbus: remove handling of resources from ofwbus
The architecture nexus should handle allocation and release of memory and
interrupts. This is to ensure that system-wide resources such as these
are available to all devices, not just children of ofwbus0.

On powerpc this moves the ownership of these resources up one level,
from ofwbus0 to nexus0. Other architectures already have the required
logic in their nexus implementation, so this eliminates the duplication
of resources. An implementation of nexus_adjust_resource() is added for
arm, arm64, and riscv.

As noted by ian@ in the review, resource handling was the main bit of
logic distinguishing ofwbus from simplebus. With some attention to
detail, it should be possible to merge the two in the future.

Co-authored by:	mhorne
MFC after:	1 month
Differential Revision: https://reviews.freebsd.org/D30554
2023-02-08 16:50:46 -04:00
Mitchell Horne
1d03c3578d arm: add an interrupt rman to nexus
Allow the nexus bus to own and manage interrupt resources. Currently,
interrupt resources on this architecture are managed completely by
ofwbus, but it is desirable that system-wide memory and interrupt
resources be managed by the top-level bus.

This is a pre-requisite to moving this resource management out of
ofwbus.

Reviewed By:	ian, Elliott Mitchell <ehem+freebsd@m5p.com>
MFC after:	1 month
Differential Revision: https://reviews.freebsd.org/D32357
2023-02-08 16:50:46 -04:00
Mateusz Guzik
48bfd35976 Add nproc(1)
This program prints the number of CPU threads it can run on, while
respecting cpusets (or not, depending on switches).

It aims to be compatible with nproc as found in GNU coreutils.

Reviewed by:	des
Reviewed by:	pstef
Differential Revision:	https://reviews.freebsd.org/D38386
2023-02-08 19:47:33 +00:00
Kevin Bowling
647f2d2bc0 e1000: bump driver version
Incrementing these to avoid confusion in users; we are on par with these
out of tree versions.

Reviewed by:	erj
MFC after:	2 weeks
Sponsored by:	BBOX.io
Pull Request:	https://github.com/freebsd/freebsd-src/pull/540
2023-02-08 12:30:35 -07:00
Kevin Bowling
ae1dca798e e1000: fix I219 hang on reset
Clear the rings before reset to avoid a HW hang.

Inspired by em-7.7.8 and DPDK (1fc9701238edcf0541289b9ae15565b6d9d7ab30)

Reviewed by:	erj
MFC after:	2 weeks
Sponsored by:	BBOX.io
Pull Request:	https://github.com/freebsd/freebsd-src/pull/540
2023-02-08 12:30:34 -07:00
Alexander Kabaev
89a072d11c Makefile.amd64: remove construct that serves no purpose
The variable expansion as written will never match anything but
'amd64/.8' in OBJDIR. The original intention behind the construct
remains unclear, but "as is" it serves no other purpose but to
generate the warning. Remove it altogether.

Fixes: df90aeac24
Reviewed by: imp
Differential Revision:   https://reviews.freebsd.org/D38440
2023-02-08 12:19:39 -07:00
Dimitry Andric
3264f6b88f Bump __FreeBSD_version for llvm 15.0.7 merge
PR:		265425
MFC after:	2 weeks
2023-02-08 20:20:33 +01:00
Dimitry Andric
50d7464c3f Merge llvm-project release/15.x llvmorg-15.0.7-0-g8dfdcc7b7bf6
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-15.0.7-0-g8dfdcc7b7bf6.

PR:		265425
MFC after:	2 weeks
2023-02-08 20:05:25 +01:00
Dimitry Andric
f3fd488f1e Merge llvm-project release/15.x llvmorg-15.0.6-0-g088f33605d8a
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-15.0.6-0-g088f33605d8a.

PR:		265425
MFC after:	2 weeks
2023-02-08 20:05:19 +01:00
Dimitry Andric
6246ae0b85 Merge llvm-project release/15.x llvmorg-15.0.2-10-gf3c5289e7846
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-15.0.2-10-gf3c5289e7846.

PR:		265425
MFC after:	2 weeks
2023-02-08 20:05:09 +01:00
Dimitry Andric
a4a491e223 Merge llvm-project release/15.x llvmorg-15.0.0-9-g1c73596d3454
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-15.0.0-9-g1c73596d3454.

PR:		265425
MFC after:	2 weeks
2023-02-08 20:05:02 +01:00
Dimitry Andric
61cfbce334 Merge llvm-project release/15.x llvmorg-15.0.0-rc2-40-gfbd2950d8d0d
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-15.0.0-rc2-40-gfbd2950d8d0d.

PR:		265425
MFC after:	2 weeks
2023-02-08 20:04:56 +01:00
Dimitry Andric
972a253a57 Merge llvm-project main llvmorg-15-init-17826-g1f8ae9d7e7e4
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-15-init-17826-g1f8ae9d7e7e4, the last commit before
the upstream release/16.x branch was created.

PR:		265425
MFC after:	2 weeks
2023-02-08 20:04:48 +01:00
Dimitry Andric
fcaf7f8644 Merge llvm-project main llvmorg-15-init-17485-ga3e38b4a206b
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-15-init-17485-ga3e38b4a206b.

PR:		265425
MFC after:	2 weeks
2023-02-08 20:04:38 +01:00
Dimitry Andric
753f127f3a Merge llvm-project main llvmorg-15-init-16436-g18a6ab5b8d1f
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-15-init-16436-g18a6ab5b8d1f.

PR:		265425
MFC after:	2 weeks
2023-02-08 20:03:59 +01:00
Dimitry Andric
81ad626541 Merge llvm-project main llvmorg-15-init-15358-g53dc0f10787
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-15-init-15358-g53dc0f10787.

PR:		265425
MFC after:	2 weeks
2023-02-08 20:02:26 +01:00
Mariusz Zaborski
5fff09660e geli: split the initalization of HMAC
GELI allows to read a user key from a standard input.
However if user initialize multiple providers at once, the standard
input will be empty for the second and next providers.
This caused GELI to encrypt a master key with an empty key file.

This commits initialize the HMAC with the key file, and then reuse the
finalized structure to generate different encryption keys for different
providers.

Reported by:	Nathan Dorfman
Tested by:	philip
Security:	FreeBSD-SA-23:01.geli
Security:	CVE-2023-0751
2023-02-08 10:01:58 -08:00
Warner Losh
8c784bb8cf lua: Update to 5.4.4
Merge commit '755d9301ca89f02956fd17858b9d4d821ab5c972' from the
vendor branch. This updates us from lua 5.4.2 to 5.4.4.

In addition, it switches around how we flavor liblua for the boot loader
and flua. This is done to reduce diffs with upstream and make it easier
to import new versions (the current method has too many conflicts to
resolve by hand): we include luaconf.local.h from luaconf.h (the only
change to this file is now that #include at the end). We then define
what we need to: for flua (which does very little) and one for stand
(which creates the new FLOAT type out of int64).

Sponsored by:		Netflix
2023-02-08 10:33:26 -07:00
Doug Moore
87d405eab9 iommu_gas: initialize start_gap as first node
In iommu_gas.c, domain->start_gap points to one of the nodes on either
side of the first free, unallocated range. In iommu_gas_init_domain,
it is initialized to point to the node after the single free
range. Change it to point to the node before that free range, so that,
when 'lowaddr' is within the initial free range, the first allocation
search for free space below 'lowaddr' does not begin and end at an
address above 'lowaddr'. This fixes problems on a machine with Intel
DMAR enabled.

Reported by:	jah
Reviewed by:	dougm
Tested by:	jah
Obtained from:	jah
Fixes:	commit db151ca0c3 iommu_gas: start space search from 1st free space
MFC after:	1 day
2023-02-08 11:04:13 -06:00
Dag-Erling Smørgrav
8b418c83d1 cp: Adjust the sparse file tests.
* The sparsity check was ineffective: it compared the apparent size in bytes to the actual size in blocks.  Instead, write a tool that reliably detects sparseness.
* Some of the seq commands were missing an argument.
* Based on empirical evidence, 1 MB holes are not necessarily large enough to be preserved by the underlying filesystem.  Increase the hole size to 16 MB.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	cracauer
Differential Revision:	https://reviews.freebsd.org/D38414
2023-02-08 16:49:50 +00:00
Zhenlei Huang
9df6eeabb3 bpf: Add missing NOP stubs
This fixes kernel build with nodevice bpf [1].

[1] https://lists.freebsd.org/archives/freebsd-current/2023-February/003178.html

Reported by:	Gary Jennejohn <garyj@gmx.de>
Reviewed by:	jhibbits
Fixes:		950cc1f44f bpf: Add "_if" tap APIs
Differential Revision:	https://reviews.freebsd.org/D38432
2023-02-08 18:05:21 +08:00
Emmanuel Vadot
3662862f55 rc: syscons: Add UEFI special case
Changing cursor, screenmap and setting blanktime doesn't work when booted
with vt(4) and UEFI so add a special case for those depending on machdep.bootmethods.
I have no way to test if this can work with vt(4) and bios boot so just in case
keep calling those for this.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38293
2023-02-08 08:53:20 +01:00
Emmanuel Vadot
eac920e670 utx: Allow disabling user accounting
Make it possible to not run utx at boot.
Default to yes so this is a no-op for everyone.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38292
2023-02-08 08:52:54 +01:00
Emmanuel Vadot
cab549c76c pkgbase: Create a FreeBSD-console-tools package
And put in it:
 - kbdcontrol
 - vidcontrol
 - moused
 - kbdmap

Those aren't useful in a jail or for a modern desktop.
While here, split the devd.conf part into some new files.

Reviewed by:	bapt
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38321
2023-02-08 08:52:40 +01:00
Emmanuel Vadot
2878e21ff1 devd: Move power_profile part in devd/power_profile.conf
And make it part of the FreeBSD-acpi package.
This avoid calling service power_profile on an installation without it
installed.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38324
2023-02-08 08:52:17 +01:00
Emmanuel Vadot
9150a0455e devd: Move bluetooth part in devd/bluetooth.conf
And make it part of the FreeBSD-bluetooth package.
This avoid calling service bluetooth on an installation without it
installed.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38323
2023-02-08 08:51:34 +01:00
Emmanuel Vadot
f4d9116de1 devd: Move dhclient part in devd/dhclient.conf
And make it part of the FreeBSD-dhclient package.
This avoid calling dhclient on an installation without dhclient
installed.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38322
2023-02-08 08:51:20 +01:00
Emmanuel Vadot
431b9b6692 pkgbase: Put sendmail example in the sendmail package
Reviewed by:	bapt
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38297
2023-02-08 08:50:31 +01:00
Emmanuel Vadot
0b8a2c744c pkgbase: Do not override packages for FILES
Not all FILES entries should end up in FreeBSD-utilities

Reviewed by:	bapt
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38296
2023-02-08 08:50:16 +01:00