Skip to content

update to latest code#15

Merged
EthanCornell merged 354 commits intoEthanCornell:mainfrom
freebsd:main
Apr 10, 2025
Merged

update to latest code#15
EthanCornell merged 354 commits intoEthanCornell:mainfrom
freebsd:main

Conversation

@EthanCornell
Copy link
Copy Markdown
Owner

No description provided.

bsdjhb and others added 30 commits March 27, 2025 16:44
…bject

This wraps a new optional cdev_pg_path method in struct
cdev_pager_ops.  If the method pointer is NULL, the function does
nothing.  The old device pager reads the pathname of the cdev stored
in the object handle to match the existing code.

Retire the OBJ_CDEVH flag as it is no longer needed.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D49335
This uses the constant string of "sgx" as the pathname

Reviewed by:	br, kib
Differential Revision:	https://reviews.freebsd.org/D49336
The PCI power management specification requires that the OS clear any
pending PME# interrupt and generation of PME# interrupts during
"initial operating system load".  Note that clearing a pending PME#
interrupt requires writing a 1 to the Read/Write-Clear PME bit in the
power management status register.  To handle the boot time case, clear
PME# state in pci_read_cap() when scanning new PCI devices.  This
should also cover hotplug devices.

In addition, clear this state on every PCI device after resume from
sleep in pci_resume_child before invoking the driver's DEVICE_RESUME
method.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D49222
pci_has_pm is a quick check that returns true if a PCI device supports
the power management capability.

pci_enable_pme can be used in DEVICE_SUSPEND driver methods to enable
PME# during suspend.

Reviewed by:	Krzysztof Galazka <krzysztof.galazka@intel.com>x
Differential Revision:	https://reviews.freebsd.org/D49250
Depend on the PCI bus driver clearing PME# after resume to remove the
need for clearing PME# from DEVICE_RESUME methods.

Use pci_has_pm and pci_enable_pme.

Reviewed by:	Krzysztof Galazka <krzysztof.galazka@intel.com>
Differential Revision:	https://reviews.freebsd.org/D49251
…isters

This is the more typical pattern for other capability register sets,
and two of these variables weren't used.

Differential Revision:	https://reviews.freebsd.org/D49267
To support common shell patterns (test -n and -z) we want NO_ROOT and
WITHOUT_QEMU to be set and not empty in mk-vmimage.sh if they are set at
all in the Makefile.

Actually do this rather than making them always set (which propogates to
submakes run by mk-vmimage.sh and unconditionally enables NO_ROOT with
undesirable side effects such as installing a /METALOG in vm images).

Reported by:	cperciva
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D49544
aio(4) is a hard requirement in the kernel as of f321533. The
scenario that the patch was submitted for is no longer possible.

This isn't a straight up revert since the previous change also addressed
some minor issues.

PR:		190942
Reported by:	asomers
MFC after:	2 weeks
MFC with:	d97e447
Fixes:		d97e447 ("aio_*(2): mention ENOSYS under ERRORS")
Differential Revision: https://reviews.freebsd.org/D49541
The ones that were effectively unchanged from
d97e447^..e24279e did not have `.Dd` bumped. Only
the ones that had a net content change between those
revisions.

MFC after:	2 weeks
MFC with:	d97e447 e24279e
Find the predecessor in dst_object, not src_object.

Fixes: 6d6c97f <https://reviews.freebsd.org/rG6d6c97fb72a7dce85008cef891d093b24dcbb380> ("vm_fault: update pred lock acq in copy_entry")

Reported by:	markj
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D49547
Sponsored by:	Rubicon Communications, LLC ("Netgate")
The pf pools are used in NAT, route-to and af-to rules. Some parts of
code are duplicated between them. Create functions apply_redirspec(),
apply_nat_ports() and apply_rdr_ports() to handle the common tasks.

Simplify data structures used for pool parsing. Move the contents of
struct redirection to struct redirspec. Map all ways of parsing pools
directly onto struct redirspec. Name various forms of struct redirspect
to hint where they are used.

Remove struct redirspec *rroute from struct filter_opts, because
filter_opts is bzero()'ed after the route part of rule is parsed, and
thus can't be used.

Add tests to ensure that parsing and error messages behave as expected.
The tests have been written and tested with pfctl from before this
patch.

This is prerequisite for adding support for OpenBSD NAT syntax.

Reviewed by:		kp
Approved by:		kp (mentor)
Sponsored by:		InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D49218
Summary:

MFC after:	1 week

Test Plan: make kernel and boot with ZFS on /

Reviewers: #powerpc

Subscribers: imp, delphij

Differential Revision: https://reviews.freebsd.org/D49538
It was necessary in the beginning for a definition of curthread,
but in the later versions of the patch turned out to be not needed.

Fixes:	5b02365
Reported by:	mav
This discrepancy previously caused `make makeman` to warn
`riscv/riscv64: ignoring duplicate option EFI`.  Make the kernel EFI
option consistent with EFI's per-arch defaults in src.opts.mk to remove
the warning.  Note that we do build EFI boot programs for RISC-V.

This is a NFC because the only component gated by the kernel's EFI
option is sys/modules/efirt, which is also inside of a MACHINE_CPUARCH
block that excludes riscv64 anyway.

Reviewed by:	mhorne
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49549
The low bits of GICR_PROPBASER are defined as
  The number of bits of LPI INTID supported, minus one, by the LPI
  Configuration table starting at Physical_Address.
but flsl(1 << n) returns n + 1; use ilog2_long instead.

PR:	285677
Reported by:	Julien Grall
Reviewed by:	andrew
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D49542
The ps(1) utility uses 1024 byte units, not 1000 byte units.

git grep KiB | wc -l
	535
git grep KBytes | wc -l
	39

Fixes:			20bdda1 (Consistent usage of Kbyte unit)
MFC after:		3 days
Reviewed by:		jsm, imp, mhorne
Approved by:		mhorne (mentor)
Differential Revision:	https://reviews.freebsd.org/D49522
Switching between io and cpu sorting uses a great example in the usage.
[-m io | cpu]. Use that everywhere.

MFC after:		3 days
Reviewed by:		mhorne
Approved by:		mhorne (mentor)
Differential Revision:	https://reviews.freebsd.org/D49515
I recommended the incorrect text to the submitter.

MFC after:		3 days
Fixes:			f47cbb2 (Add /dev/gpt)
Reported by:		Mark Millard <marklmi@yahoo.com>
Reviewed by:		imp, mhorne
Approved by:		mhorne (mentor)
Differential Revision:	https://reviews.freebsd.org/D49523
Using Compute Gallery as the source is the preferred method now.

Reviewed by:	brooks, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D49528
It looks like this was missed during the driver development and
porting.

Differential Revision:	https://reviews.freebsd.org/D49512
Reviewed by:	thj
Add a reference to the 802.11 specification for the management frame
capability info field.

Differential Revision:	https://reviews.freebsd.org/D49513
Reviewed by:	thj
Check req->s instead of s to know if the state needs to be
cleaned up first.

This error is from a refactor I did years ago.  Oops!

Differential Revision:	https://reviews.freebsd.org/D49545
Reviewed by:	thj
Don't do err(1, ptr); that's a very old security risk turned warning.

Differential Revision:	https://reviews.freebsd.org/D49546
Reviewed by:	thj
Enable running of contrib/netbsd-tests/lib/libc/net/getaddrinfo without
modifications to the test program itself.  However, create our own version
of expected results files.  They are produced from the NetBSD files, with
the following list of changes:

o AF_INET6 value is different, hence: s/family 24/family 28/.
o SCTP result (socktype 5 protocol 132) needs to be added to many queries
  results.
o NetBSD libc sorts multiple results first by protocol, then by address
  family.  FreeBSD first sorts on address family, then on protocol.  Some
  results need to be reordered.
o Error strings need to be fixed:
  s/hostname nor servname provided, or not known/Name does not resolve/
  s/ai_family not supported/Address family not recognized/
  s/servname not supported for ai_socktype/\
  Service was not recognized for socket type/.

Reviewed by:		ngie, kib
Differential Revision:	https://reviews.freebsd.org/D49409
A test suite for getaddrinfo(3) written in C.  Unlike NetBSD test, this
one will be mostly focused on what the API should return when something
isn't good with your DNS.  Test emulates bad DNS servers in resolv.conf
intercepting fopen(2) and emulates downed network intercepting send(2).

Initial version covers three main scenarios: all good, server(s) timed
out, network down.  For each scenario we test hostname with trailing dot
and without, since libc resolver uses quite different code paths,
sometimes even yielding with different error codes.  All current error
codes in the test are what our libc returns right now, meaning the test
documents what we have, not what there should be.

Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D49410
A nameserver timeout is a soft failure, future attempts may succeed.
Returning EAI_AGAIN is crucial for API users to tell a soft name
resolution failure from negative resolution result.

Before the change we would return EAI_ADDRFAMILY, which I believe, is a
regression from 1443613, and before that revision we used to return
EAI_NONAME in most of the cases.

Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D49411
Typical problem with network mounts is remote equipment not being
available when our host boots up after a power failure.  Even if you
properly configure boot order of all local services and wait for link
coming up on your NIC, you still may boot faster than some intermediate
switch on the network or the DNS server itself.  Let's refer to this as a
"server room boot race".  For NFS mounts with hostname in hosts(5) the
race is addressed by a retry loop on NFS mount timeout.  However, a DNS
resolution timeout is treated differently to NFS mount timeout.  We fail
on the former and keep retrying on the latter.

With feedback received on current@, I see that the problem is so old, that
people got used to it and see it as a desired behavior rather than a
problem.  And for those who is affected by the problem, they suggest
hosts(5) as a solution.  Note that using hosts(5) isn't scalable, and
using bare IP addresses is neither scalable, nor compatible with
Kerberized mounts.

A trade-off solution would be to enable the retry cycle over DNS timeouts
only when background mode is specified, which is a typical use in fstab(5)
and very uncommon in a command line.  That would address the server room
boot race problem without breaking POLA for command line.

Reviewed by:		rmacklem
Differential Revision:	https://reviews.freebsd.org/D49145
kprovost and others added 29 commits April 9, 2025 21:30
In FreeBSD's pf the state lookup is done through a hash table, not an RB tree as
on OpenBSD. Remove a misleading line from the man page.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
The OpenBSD rationale ('so the name does not collide with the statekey to inp
unlinking') doesn't apply to us, but it makes future imports easier if we follow
this rename.

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, acb93c8a64
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Some laptops sold in Brazil have the key "/, ?" in same position
where it should be the right control key.

Reported by:	Andrei Drusian <drusian@gmail.com>
Tested by:	Andrei Drusian <drusian@gmail.com>
MFC After:	1 week
Only aarch64 and amd64 are working. For the moment, comment out
everything else until I can make it work too. The others build, to be
fair, but don't work or haven't been confirmed to work.

Sponsored by:		Netflix
The default should be per-os, not per user. this lets me use this on
both my mac and my FreeBSD server.

Sponsored by:		Netflix
13.x didn't need this, but 14.2 does need it. Extract /sbin/fastboot
too since it's recorded as the target of reboot/halt that we do want.

Sponsored by:		Netflix
Use SRCS+= to allow for better ifdefs

Sponsored by:		Netflix
This code is really generic segment processing and should live here. It
also interfaces primarily with Linux APIs, so it's also appropriate for
this if we have a version of that runs as a FreeBSD binary using FreeBSD
system calls and APIs, though that's in the future somehow...

Sponsored by:		Netflix
These are needed for the next round of EFI support for amd64 (partially
shared with aarch64, but only partially because the Linux host interfaces
are different to get the same info).

Sponsored by:		Netflix
Set errno for bad actions in tsetattr to catch bad actions.

Sponsored by:		Netflix
…inline

The boot loader pads efi_map_header to start the array of
efi_memory_descriptor entries on the 16-byte-aligned boundary after the
header. Since the header isn't naturally 16-byte aligned, we need to do
this.

We should have used the actual UEFI EFI_MEMORY_ATTRIBUTES_TABLE which
used uint32_t's to pass all this data to the kernel (they never needed
to be 64-bit quantities or size_t's even) since these entries and the
total size of the table is small. However, this ship long since sailed
since we've used these structures for a decade and there's little to be
gained by changing them. The table header we pass to the kernel from the
loader has similar names, but the seamntics of the fields are different.

Sponsored by:		Netflix
efi_map_header is similar to, but not at all the same as the UEFI
EFI_MEMORY_ATTRIBUTES_TABLE (we could easily have used the latter
though, with one fewer non-standard types, but we can't change
it easily now due to the last 10 years of boot loaders passing
this in).

Sponsored by:		Netflix
Start to move the common efi routines into libkboot by moving the efi
memory map walking and implementing a printing routine around it.

Sponsored by:		Netflix
We can call init_avail() multiple times. Each time, we want to toss
whatever garbage may have already been there from a prior failed attempt
to find a good memory map.

Sponsored by:		Netflix
Noted by:	olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This patch updates the man page for the O_NAMEDATTR flag.

Another man page that explains named attributes will
be introduced in a future commit.

This is a content change.

Reviewed by:	manpages (zaiee)
Fixes:	2ec2ba7 ("Add support for Solaris style extended attr")
Differential Revision:	https://reviews.freebsd.org/D49718
After vm_page_grab_lookup fails to find a page, and
vm_page_alloc_after fails to allocate one, reset the pages iterator
which is invalidated by a release/acquire of the object write lock
within the allocation code.

Reported by:	pho
Reviewed by:	kib
Fixes:	7becd87 ("vm_grab: use iterator for grab lookup")
Differential Revision:	https://reviews.freebsd.org/D49755
Pass an iterator to vm_fault_allocate, so that it can invoke
vm_page_alloc_after. In vm_fault_object, use an iterator for a page
lookup so that the search can benefit the allocation in
vm_fault_allocate. In vm_fault, define an iterator, initialize it only
when it might be used, and pass it on to vm_fault_allocate.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D49741
This change adds support for matching single and multi-character
equivalence classes and collating symbols, as specified
by POSIX1, section 9.3.5.

Sponsored by:	Klara, Inc.
Obtained from:	https://github.com/apple-oss-distributions/Libc
Differential Revision:	https://reviews.freebsd.org/D49659
Reviewed by:	markj
…character classes

This change extends fnmatch to support collating symbol expressions,
equivalence class expressions, and character class expressions (as
defined by POSIX.1, section 9.3.5), along with the corresponding
tests.

Sponsored by:	Klara, Inc.
Obtained from:	https://github.com/apple-oss-distributions/Libc
Differential Revision:	https://reviews.freebsd.org/D49660
Reviewed by:	markj, ziaee (manpages)
Add separators to make the maximum number of (micro)seconds
in (u)alarm.3 more readable.

Sponsored by:	Klara, Inc.
Obtained from:	https://github.com/apple-oss-distributions/Libc
Differential Revision:	https://reviews.freebsd.org/D49712
Reviewed by:	markj
Renumber the private flags so there is a sizeable gap between them and
the public flags, making it easier to add public flags in the future.
These private flags are only ever set or read by FTS itself, so there
is no compatibility issue.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D49711
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D49756
Reviewed by:	des
In general we are working towards making public headers self-contained.

cdefs.h is included for __packed; just assume that types.h includes
cdefs.h as that's a very common assumption.

PR:		285924
Reviewed by:	emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D49735
Regenerate badfiles.inc as well.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D49736
There is at least one case where we need to support it: kmem_malloc()
might need to allocate multiple pages to satisfy a NOFREE allocation,
which it implements by calling vm_page_alloc() in a loop.  If it fails
part-way though, it needs to free already-allocated pages, but this was
illegal.

Convert the bump allocator to a linked list; (ab)use the pindex field of
each page in the list to store the number of contiguous pages in the
block.  (Originally I added a new plinks member for this purpose, but
it's not safe to use that until after vm_page_dequeue() is called due to
lazy page queue removal.) Then, modify vm_page_free() to support freeing
pages to this list.

While here, add a __noinline qualifier to vm_page_alloc_nofree_domain()
to ensure that it doesn't get inlined into a hot path.

Reported by:	syzbot+93bc9edd2d0f22ae426a@syzkaller.appspotmail.com
Reviewed by:	bnovkov, kib
Fixes:		a8693e8 ("vm: Introduce vm_page_alloc_nofree_domain")
Differential Revision:	https://reviews.freebsd.org/D49480
Following the example of rtw88 and rtw89 only ship iwlwifi firmware
from ports/packages.  Users are asked to run fwget(8) to install the
firmware needed for their system or build it from ports
(see also UPDATING).

This is the end of a long story adding wireless support to fwget(8),
migrating the firmware for multiple branches into ports, splitting them
up into flavors, and updating some install media and the installer to
provide firmware.

The overall amount for new firmware amongst all drivers would have
added more than 100M of binary blobs to src.git for the first import,
ignoring future updates which (along with some duplication between
multiple drivers) was considered too much.

While maintenance within the src tree certainly would have been
easier in the longer term this seems to be the better solution and
I would like to thank everyone who helped along the path to get there.

The iwlwififw.4 man page is to stay (for now) and will likely point
at the appropriate firmware package flavor in the future as well
so people may find it easier to transition.  In the long term this
information is likely not needed anymore.

Sponsored by:	The FreeBSD Foundation
Requested by:	core (Oct 2022)
Reviewed by:	thj, jrm (earlier)
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D49713
Ensure we can only pass AF_UNSPEC, AF_INET or AF_INET6 (and only when supported
in our kernel config).

Reported-by:	syzbot+8a9ee157bfed9e6b9efc@syzkaller.appspotmail.com
Sponsored by:	Rubicon Communications, LLC ("Netgate")
@EthanCornell EthanCornell merged commit 675d972 into EthanCornell:main Apr 10, 2025
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.