Commit graph

286304 commits

Author SHA1 Message Date
Baptiste Daroussin bf986d5245 pci_vendors: update to 2023-08-12 2023-09-06 14:23:27 +02:00
Baptiste Daroussin 358f8a7add sendmail: remove all m4 files with WITHOUT_SENDMAIL 2023-09-06 14:23:27 +02:00
Zhenlei Huang 49d6743da1 net: Check per-flow priority code point for untagged traffic
Commit 868aabb470 introduced per-flow priority. There's a defect in the
logic for untagged traffic, it does not check M_VLANTAG set in the mbuf
packet header or MTAG_8021Q/MTAG_8021Q_PCP_OUT tag set by firewall, then
can result missing desired priority in the outbound packets.

For mbuf packet with M_VLANTAG in header, some interfaces happen to work
due to bug in the drivers mentioned in D39499. As modern interfaces have
VLAN hardware offloading, the defect is barely noticeable unless the
feature per-flow priority is widely tested.

As a side effect of this defect, the soft padding to work around buggy
bridges is bypassed. That may result in regression if soft padding is
requested.

PR:		273431
Discussed with:	kib
Fixes:	868aabb470 Add IP(V6)_VLAN_PCP to set 802.1 priority per-flow
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39536
2023-09-06 18:15:14 +08:00
黃清隆 cb1a0aab4f sys/dev/arcmsr: Update Areca RAID driver to version 1.50.00.06.
- Suppressed a harmless warning message, "arcmsr_dr_handle: target=f,
   lun=0, GONE!!!," which could appear a few seconds after UEFI system
   boot due to the boot volume UEFI initialization.
 - Corrected various typing errors.
 - Refactored arcmsr_initialize() to improve code readability.
 - Added support for device IDs 1883 and 1886 controllers.
 - Introduced support for controllers requiring host memory for the
   RAID 5 and 6 XOR engines.

Many thanks to Areca for continuing to support FreeBSD.

MFC after:	3 days
2023-09-06 01:11:55 -07:00
Dag-Erling Smørgrav 117c54a78c split: Fix linecount parsing.
The “undocumented kludge” which unfortunately can't be dropped for backward compatibility reasons was prone to segfaulting and would improperly allow a new linecount when one was already set.  Fix these issues and add regression tests.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41757
2023-09-06 03:29:31 +00:00
Dag-Erling Smørgrav 851bf856d1 split: Code cleanup.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41756
2023-09-06 03:29:31 +00:00
Dag-Erling Smørgrav cbea5eddb1 split: Add missing test cases.
This adds test cases for c4f7198f47 and ac17fc816e.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41755
2023-09-06 03:29:28 +00:00
Dag-Erling Smørgrav 8091b82e29 time.h: Fix visibility check for C11 and C23 features.
__BSD_VISIBLE is always defined; we need to check if it's true.

Fixes:		d02489d11a 9b5d724cad
MFC after:	3 days
Reviewed by:	brooks, imp
Differential Revision:	https://reviews.freebsd.org/D41733
2023-09-06 03:38:01 +02:00
Jake Freeland 918966a274 timerfd: Relocate 32-bit compat code
32-bit compatibility code is conventionally stored in
sys/compat/freebsd32. Move freebsd32_timerfd_gettime() and
freebsd32_timerfd_settime() from sys/kern/sys_timerfd.c to
sys/compat/freebsd32/freebsd32_misc.c.

MFC After: 3 days
Reviewed by: imp, markj
Differential Revision; https://reviews.freebsd.org/D41640
2023-09-05 16:25:07 -06:00
Jake Freeland fb5daae920 timerfd: Namespace pollution adjustments
Do not pollute userspace with <sys/proc.h>, instead declare struct thread
    when _KERNEL is defined.

    Include <sys/time.h> instead of <sys/timespec.h>. This causes intentional
    namespace pollution that mimics Linux. g/musl libcs include <time.h> in
    their <sys/timerfd.h>, exposing clock gettime, settime functions and
    CLOCK_ macro constants. Ports like Chromium expect this namespace
    pollution and fail without it.

MFC After: 3 days
Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D41641
2023-09-05 16:25:01 -06:00
Jake Freeland a1f506156c timerfd: Define a locking regime
Define a locking regime for the members of struct timerfd and document
    it so future code can follow the standard. The lock legend can be found
    in a comment above struct timerfd.

    Additionally,
    * Add assertions based on locking regime.
    * Fill kn_data with the expiration count when EVFILT_READ is triggered.
    * Report st_ctim for stat(2).
    * Check if file has f_type == DTYPE_TIMERFD before assigning timerfd
      pointer to f_data.

MFC After: 3 days
Reviewed by:	imp, kib, markj
Differential Revision:	https://reviews.freebsd.org/D41600
2023-09-05 16:24:41 -06:00
Navdeep Parhar 3814249f1e cxgbe(4): Avoid hang on kldunload on netlink enabled kernels.
netlink(4) calls back into the driver during detach and it attempts to
start an internal synchronized op recursively, causing an interruptible
hang.  Fix it by failing the ioctl if the VI has been marked as DOOMED
by cxgbe_detach.

Here's the stack for the hang for reference.
 #6  begin_synchronized_op
 #7  cxgbe_media_status
 #8  ifmedia_ioctl
 #9  cxgbe_ioctl
 #10 if_ioctl
 #11 get_operstate_ether
 #12 get_operstate
 #13 dump_iface
 #14 rtnl_handle_ifevent
 #15 rtnl_handle_ifnet_event
 #16 rt_ifmsg
 #17 if_unroute
 #18 if_down
 #19 if_detach_internal
 #20 if_detach
 #21 ether_ifdetach
 #22 cxgbe_vi_detach
 #23 cxgbe_detach
 #24 DEVICE_DETACH

MFC after:	3 days
Sponsored by:	Chelsio Communications
2023-09-05 15:10:02 -07:00
Warner Losh b19d8afe4d msun: LIBCSRCDIR is too fragile, use ${SRCTOP}/lib/libc instead
LIBCSRCDIR is defined in bsd.libnames.mk, which is read in later in the
Makefile than the line:

.if exists(${LIBCSRCDIR}/${MACHINE_ARCH})

so we test to see if /${MARCHIN_ARCH} exists which it usually doesn't
(but did for me since I mounted 13.2R SD image there).  Move to defining
our own LIBC_SRCTOP in terms of SRCTOP to treat these uniformily.

Sponsored by:		Netflix
Reviewed by:		sjg
Differential Revision:	https://reviews.freebsd.org/D41661
2023-09-05 16:08:02 -06:00
Bjoern A. Zeeb 815b7436a7 iwlwifi/LinuxKPI: 802.11: update ieee80211_request_smps()
Update ieee80211_request_smps() to the new number of arguments in
LinuxKPI (which was already prepared) and update the one call in the
older iwlwifi driver version.
This will allow iwlwifi as-is now and rtw88 to compile in case someone
else wants to work on the latter in parallel to predominant efforts on
the former.

Sponsored by:	The FreeBSD Foundation
MFC after:	20 days
2023-09-05 21:14:25 +00:00
Bjoern A. Zeeb 90aac0d83b rtw88: update driver from upstream
This is a combined version of updates of the rtw88 driver based
on wireless-testing
(wt-2023-05-11) 711dca0ca3d77414f8f346e564e9c8640147f40d (after v6.4-rc1),
(wt-2023-06-09) 7bd20e011626ccc3ad53e57873452b1716fcfaaa (after v6.4-rc5),
(wt-2023-07-24) 62e409149b62a285e89018e49b2e115757fb9022 (after v6.5-rc3),
(wt-2023-08-06) 2a220a15be657a24868368892e3e2caba2115283 (after v6.5-rc4).

This update follows other currently disconnected LinuxKPI based wireless
drivers to lift them all to a same version in case someone else wants to
work on this driver in parallel to predominant iwlwifi efforts.

MFC after:	20 days
2023-09-05 21:13:19 +00:00
Bjoern A. Zeeb 712468443d rtw88: temporary disconnect from build
As announced on freebsd-wireless [1] disconnect rtw88 from the build.
Add a note to the man page about the current state but leave the man
page in place for now as this is supposed to be temporary.

[1] https://lists.freebsd.org/archives/freebsd-wireless/2023-September/001377.html

MFC after:	20 days
X-MFC:		will see about 14/13
2023-09-05 21:13:19 +00:00
Bjoern A. Zeeb cf94672363 rtw88/rtw89: remove local firmware.
Remove firmware from src/ in favor of the ports/packages and fwget(8).
This will allow us to shrink the size of src (and installed modules).
Update the rtw88 man page to reflect the change.

MFC after:	20 days
X-MFC:		will see about 14/13
2023-09-05 21:13:18 +00:00
Bjoern A. Zeeb aece2a4fb1 rtw88: detach firmware from build
Firmware is kept in ports now and fwget will find the right one to
install.

MFC after:	20 days
X-MFC:		will see about 14/13
2023-09-05 21:13:18 +00:00
Jamie Gritton 165234d552 jail.conf(5): Fix and expand description of ".include".
Escape a period that caused a line not to be includesd.  Also mention
that glob(3) patterns may be included, and a consequence of that.

PR:		273561
Reported by:	crest@rlwinm.de
Reviewed by:	emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D41723
2023-09-05 13:35:54 -07:00
Kyle Evans 3141e51d2e localedef: add newlines to error messages
These won't be added elsewhere, so add a little bit of room to make
these messages a little easier to read.  The existing set is a mixed
bag, there are somewhere in the ballpark of 45, 46 printfs to stderr and
19 of those had newlines.

Reviewed by:	yuripv
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D41693
2023-09-05 14:08:59 -05:00
Kyle Evans 3a7ffe206c localedef: expand the default charmap
POSIX defines a number of other control characters as well as
alternative aliases for some that should be provided in the default set,
so let's go ahead and add those.

Reviewed by:	bapt, yuripv
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D41692
2023-09-05 14:08:59 -05:00
Dmitry Chagin 20845a6994 linux(4): Validate exec_setregs on arm64
The lr register is cleared at the beginning of the _dl_start and _start,
so there is no need to initialize it.
Gnu libc _start takes an rtld_fini pointer in x0 which is set by ld.so
for __libc_start_main, the kernel does not register any atexit pointers.

While here fix whitespaces.

MFC after:		1 week
2023-09-05 21:19:08 +03:00
Dmitry Chagin 2a1cf1b6b5 linux(4): Deduplicate mmap2
To help porting the Linux emulation layer to a new platforms start using
Linux names for conditional builds instead of architecture-specific ifdefs.

MFC after:		1 week
2023-09-05 21:16:39 +03:00
Dmitry Chagin 553b1a4e4e linux(4): Deduplicate mprotect, madvise
MFC after:		1 week
2023-09-05 21:15:52 +03:00
Konstantin Belousov 9636299233 kthread_add(): do not allow to attach the thread to a dead or dying process
Reported by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-09-05 19:30:08 +03:00
John Baldwin ba675bb948 riscv: Don't print zero offsets for register addresses
This matches the behavior of db_printsym.

Reviewed by:	mhorne, markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D41702
2023-09-05 09:12:27 -07:00
John Baldwin 25b58f9a4a ObsoleteFiles.inc: Add libclang_rt libraries for riscv64 for LLVM 14/15.
Reviewed by:	dim
Differential Revision:	https://reviews.freebsd.org/D41701
2023-09-05 09:12:12 -07:00
John Baldwin 3b35d2a8af riscv: Save gp in the trapframe in both modes
Similar to d95fbf4e1a, always save gp in
the trapframe even though it is only restored when returning to user
mode.  This is mostly a debugging aid so that dump_regs() doesn't
print out random stack garbage as the value of gp for kernel faults
(e.g. sysctl debug.kdb.trap=1) as well as keeping kgdb's trapframe
unwinder from reporting bogus values of $gp for lower frames.

Reviewed by:	mhorne, jrtc27, markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D41699
2023-09-05 09:04:54 -07:00
John-Mark Gurney f1c5a2e3a6 virtio_random: Pipeline fetching the data
Queue an initial fetch of data during attach and after every read
rather than synchronously fetching data and polling for completion.

If data has not been returned from an previous fetch during read,
just return EAGAIN rather than blocking.

Co-authored-by: John Baldwin <jhb@FreeBSD.org>

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D41656
2023-09-05 08:59:43 -07:00
Mateusz Piotrowski 5b7a776f48 getdirentries.2: Reference dir(5)
As a note, parts of manual pages getdirentries(2) and dir(5) should
probably be consolidated.

MFC after:	3 days
2023-09-05 15:50:45 +02:00
Mateusz Piotrowski 52d374a067 getdirentries.2: Improve readability of dirent members
MFC after:	3 days
2023-09-05 15:50:45 +02:00
Robert Clausecker d41afb8146 */string.3,arch.7,environ.7: add cross-references to simd(7)
With the new simd-dispatch framework documented in simd(7),
add cross-references to the new man pages to appropriate places.

Sponsored by:	The FreeBSD Foundation
Approved by:	emaste
MFC to:		stable/14
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D41697
2023-09-05 09:33:12 -04:00
Mateusz Piotrowski e8fc6a9980 extattr.9: Improve the fragment about jail(8)
Fixes:		315d7bbbb4 extattr(9): Mention system namespace restrictions
MFC after:	1 week
2023-09-05 11:59:35 +02:00
Mateusz Piotrowski 3a02df5e27 getdirentries.2: Reference directory(3)
MFC after:	3 days
2023-09-05 11:39:39 +02:00
Vico Chen aadc14bceb linux(4): Convert flags in timerfd_create
The timerfd is introduced in FreeBSD 14, and the Linux ABI timerfd is
also moved to FreeBSD native timerfd, but it can't work well as Linux
TFD_CLOEXEC and TFD_NONBLOCK haven't been converted to FreeBSD
TFD_CLOEXEC and TFD_NONBLOCK.

Reviewed by:		dchagin, jfree
Differential revision:	https://reviews.freebsd.org/D41708
MFC after:		1 week
2023-09-05 11:53:02 +03:00
Dmitry Chagin 11e37048db linux(4): Return ENOTSUP from listxattr instead of EPERM
FreeBSD does not permits manipulating extended attributes in the system
namespace by unprivileged accounts, even if account has appropriate
privileges to access filesystem object.
In Linux the system namespace is used to preserve posix acls. Some Gnu
coreutils binaries uses posix acls, eg, install, ls, cp.  And fails if
we unexpectedly return EPERM error from xattr system calls.

In the other hands, in Linux read and write access to the system
namespace depend on the policy implemented for each filesystem, so we'll
mimics we're a filesystem that prohibits this for unpriveleged accounts.

Reported by:		zirias
Tested by:		zirias
MFC after:		1 week
2023-09-05 11:52:27 +03:00
Dmitry Chagin 18d1c86788 linux(4): Fix listxattr for the case when the size is 0
If size is specified as zero, these calls return the current size
of the list of extended attribute names (and leave list unchanged).

Tested by:		zirias
MFC after:		1 week
2023-09-05 11:51:46 +03:00
Xin LI ef3a764bc5 MFV: zlib: examples: define functions as static ones. (PR #855)
MFC after:	3 days
2023-09-04 20:14:31 -07:00
Xin LI 900147a461 examples: define functions as static ones.
This fixes warnings when building with -Wmissing-prototypes.

Upstreamed at https://github.com/madler/zlib/pull/855 .
2023-09-04 20:10:39 -07:00
Kyle Evans 5bc1e0c228 stand: lua: module names should permit more
The module entries should generally allow whatever is allowed as an
env_var in the pattern table.  Notably, we're missing periods which
would allow proper entries for .dtb files in loader.conf that don't need
to specify a module_name entry for it.

%d in this expression is actually redundant as %w is actually
"all alphanumerics," but I've included it for now to match the env_var
entry.  We should really remove it from both.

Reported by:	"aribi" on the forums via allanjude@
MFC after:	1 week
2023-09-04 21:28:11 -05:00
Dag-Erling Smørgrav b451dcc84f if_vlan: Always default to 802.1q.
There is no reason for this fallback to be conditional on COMPAT_FREEBSD12.

PR:		273539
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Reviewed by:	melifaro, allanjude
Differential Revision:	https://reviews.freebsd.org/D41717
2023-09-04 23:26:18 +00:00
Tom Hukins f49d6f583e uefi(8): Refer to a related manual page
PR:	265834
Reviewed by:	mhorne
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D39577
2023-09-04 12:22:30 -07:00
Wei Hu 643fd7b4bc mana: fix tso parameters and set hwassist bits
The parameters for tso on mana were not set correctly. Also the
hwassist bits were not set. These two cause tso on mana not work.
Fixed the issues and make tso working on mana.

Tested by:	whu
MFC after:	3 days
Sponsored by:	Microsoft
2023-09-04 15:04:00 +00:00
Andrey V. Elsukov 3afe6b5253 ahci: add AMD device id in RAID mode
Found on Asus ROX Strix X570-F Gaming.

MFC after:	1 week
2023-09-04 15:33:49 +03:00
Wei Hu 289ba6b870 Hyper-V: hn: use VF's capabilities when it is attached
Current code in hn/netvsc tries to merge  (logical AND) VF and
its own capability bits when a VF is attached. This results in
losing some key VF features, especially in tx path. For example,
the VF's txcsum, rxcsum or tso bits could be lost if any of
these are not in hn/netvsc's own capablility field.

Actually when VF is attached, hn just needs to use VF's caps
as all the tx packets would be forwarded to the VF interface.
Fix this problem by doing so.

Reported by:	whu
Tested by:	whu
MFC after:	3 days
Sponsored by:	Microsoft
2023-09-04 10:40:11 +00:00
Graham Perrin dbf30052ca
committers-doc.dot: move grahamperrin to alumni
Pull Request:	https://github.com/freebsd/freebsd-src/pull/828
2023-09-04 18:18:07 +08:00
Mustafa Ateş Uzun 2f7e72bd1c
arcmsr(4): Fix typo: rebulid -> rebuild
MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/819
2023-09-04 18:13:03 +08:00
Jessica Clarke 8524dc53fd Merge commit 4bb2416d42eb from llvm-project (by Jessica Clarke):
[builtins][AArch64] Implement _sync out-of-line atomics

  Whilst Clang does not use these, recent GCC does, and so on systems such
  as FreeBSD that wish to use compiler-rt as the system runtime library
  but also wish to support building programs with GCC these interfaces are
  needed.

  This is a light adaptation of the code committed to GCC by Sebastian Pop
  <spop@amazon.com>, relicensed with permission for use in compiler-rt.

  Fixes https://github.com/llvm/llvm-project/issues/63483

  Reviewed By: sebpop, MaskRay

  Differential Revision: https://reviews.llvm.org/D158536

Reviewed by:	dim
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D41716
2023-09-04 09:33:27 +01:00
Mitchell Horne c190fb35f3 pmc: better distinguish pmu-events allocation path
Background:

The pm_ev field of struct pmc_op_pmcallocate and struct pmc
traditionally contains the index of the chosen event, corresponding to
the __PMC_EVENTS array in pmc_events.h. This is a static list of events,
maintained by FreeBSD.

In the usual case, libpmc translates the user supplied event name
(string) into the pm_ev index, which is passed as an argument to the
allocation syscall. On the kernel side, the allocation method for the
relevant hwpmc class translates the given index into the event code that
will be written to an event selection register.

In 2018, a new source of performance event definitions was introduced:
the pmu-events json files, which are maintained by the Linux kernel. The
result was better coverage for newer Intel processors with a reduced
maintenance burden for libpmc/hwpmc. Intel and AMD CPUs were
unconditionally switched to allocate events from pmu-events instead of
the traditional scheme (959826ca1b, 81eb4dcf9e).

Under the pmu-events scheme, the pm_ev field contains an index
corresponding to the selected event from the pmu-events table, something
which the kernel has no knowledge of. The configuration for the
performance counting registers is instead passed via class-dependent
fields (struct pmc_md_op_pmcallocate).

In 2021 I changed the allocation logic so that it would attempt to
pull from the pmu-events table first, and fall-back to the traditional
method (dfb4fb4116). Later, pmu-events support for arm64 and power8
CPUs was added (28dd6730a5 and b48a2770d4).

The problem that remains is that the pm_ev field is overloaded, without
a definitive way to determine whether the event allocation came from the
pmu-events table or FreeBSD's statically-defined PMC events. This
resulted in a recent fix, 21f7397a61.

Change:

To disambiguate these two supported but separate use-cases, add a new
flag, PMC_F_EV_PMU, to be set as part of the allocation, indicating that
the event index came from pmu-events.

This is useful in two ways:
 1. On the kernel side, we can validate the syscall arguments better.
    Some classes support only the traditional event scheme (e.g.
    hwpmc_armv7), while others support only the pmu-events method (e.g.
    hwpmc_core for Intel). We can now check for this. The hwpmc_arm64
    class supports both methods, so the new flag supersedes the existing
    MD flag, PM_MD_EVENT_RAW.

 2. The flag will be tracked in struct pmc for the duration of its
    lifetime, meaning it is communicated back to userspace. This allows
    libpmc to perform the reverse index-to-event-name translation
    without speculating about the meaning of the index value.

Adding the flag is a backwards-incompatible ABI change. We recently
bumped the major version of the hwpmc module, so this breakage is
acceptable.

Reviewed by:	jkoshy
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40753
2023-09-03 13:27:21 -07:00
Mitchell Horne 45dcc17e2f libpmc: make pmc_pmu_pmcallocate() machine-independent
Have it call the platform-dependent version. For better layering, move
the reset logic inside the new function. This is mainly to facilitate an
upcoming change.

Reviewed by:	jkoshy
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40752
2023-09-03 13:27:05 -07:00