"LDFLAGS= -lutil" dropped LDFLAGS from make.conf for every test in the
directory.
Approved by: glebius
Fixes: c3ac06161d ("nmount: Introduce the "check_fsid" option")
Sponsored by: Netflix
Print the file and line number of the caller where the assert fired.
Use _thread_exitf() directly for this.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
The module declaration is necessary for 'kldstat -m' to see it,
and the rc(8) uses that to detect presence of ipfw_nat.
NB: the module(9) KPI lacks a way to declare a module without
providing an empty handler and no SYSINITs.
Reported by: ambrisko
Fixes: 9bcc1e97dd
This fixes the flaky testcase in CI[0].
While here:
* fix a typo in a comment
* remove an unnecessary import
* fix this deprecation warning:
/usr/local/lib/python3.12/site-packages/scapy/contrib/igmp.py:12:
DeprecationWarning: scapy.contrib.igmp is deprecated. Please use
scapy.layers.igmp instead !
[0] https://ci.freebsd.org/job/FreeBSD-main-amd64-test/29813/testReport/junit/sys.netpfil.pf.igmp/py/TestIGMP__test_ip_opts/
Reviewed by: kp
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
With FRED, SYSCALL is delivered as event type syscall (7) and vector 1.
SYSENTER is syscall with vector 2. Handle SYSENTER in slow path,
otherwise 32bit code is able to execute 64bit syscalls.
Also check that SYSCALL comes from the 64bit mode. Intel already
specifies that SYSCALL causes #UD in compatibility mode, but there is no
AMD specification for SYSCALL under FRED yet, and SYSCALL is allowed
in compatibility mode on AMD with IDT event delivery.
Fixes: 6e93f5e4d6 ("amd64: FRED support")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
- Save %r10 into tf_rcx. This is the location for the 4th arg.
libsys stubs do 'movq %rcx, %r10' so the fast syscall path works
as is. But Go binaries directly put arg 4 into %r10.
Also save %r11 into tf_r11 for the duration of syscall handler.
- Somewhat improve binary compatibility with IDT SYSCALL fast return,
by copying userspace return %rip into %rcx, and %rflags into %r11,
emulating SYSCALL IDT delivery.
Fixes: 6e93f5e4d6 ("amd64: FRED support")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
SDM requires that IOPL is zero when returning to usermode with ERETU.
Do not set rflags.iopl for FreeBSD io(4) open.
This might be changed to disallow io(4) open for FRED at all with a
knob, if there is a real need.
Return ENOSYS from linux iopl(2), apparently Linux kernel can be
configured without iopl(2) support, so linux programs should be prepared
for this error.
Return EINVAL from vt(4)/syscons(4) ioctl(KDENABIO).
Fixes: 6e93f5e4d6 ("amd64: FRED support")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
While here, remove two munmap(2) calls on mappings the tests require to
have failed, since they are practically dead.
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60800
Since 3107b952f5 ("sound: Merge PCM_ALIVE() with PCM_REGISTERED()"),
pcm_unregister() is gated on PCM_REGISTERED(), so it cannot run unless
pcm_register() has already succeeded, which means drivers will leak
resources if a failure happened prior to this.
Reintroduce PCM_ALIVE(), but test dev rather than the lock. pcm_init()
assigns dev before anything else, so it can tell us whether pcm_init()
has run or not. Make sure to clear it in pcm_unregister() so that a
second call to pcm_unregister() cannot double-free.
While here, publish to sndstat(4) only once pcm_register() has
succeeded.
Reported by: jah
Fixes: 3107b952f5 ("sound: Merge PCM_ALIVE() with PCM_REGISTERED()")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Reviewed by: jah, markj
Differential Revision: https://reviews.freebsd.org/D60801
Fix three unrelated problems found by security review of the driver.
ECD helper ioctl:
- OCS_ECD_HELPER_CFG_READ* and OCS_ECD_HELPER_CFG_WRITE* passed a user
supplied offset straight to pci_read_config() and pci_write_config().
Reject accesses that extend past PCIE_REGMAX, so that a wide access
starting in range cannot run past the end of config space.
- Use the real access width (1, 2 or 4 bytes) of the command for both
the BAR and the config space checks, rather than assuming 4 bytes, so
that narrow accesses at the very end of the BAR or config space are
not rejected while wider ones remain bounded.
PRLI:
- When a PRLI carries an FC-4 type other than the one the driver
supports, ocs_d_send_prli_rsp() sent an LS_RJT and started node
shutdown, but then fell through and sent a second response on the same
IO (another LS_RJT, or a PRLI LS_ACC when the initiator is accepted),
followed by a conflicting transition to __ocs_d_device_ready. The two
responses posted two WQEs for one IO and caused a double ocs_ref_put(),
a use after free of the ELS IO. Return after dispatching the LS_RJT so
that exactly one response is sent.
- __ocs_d_port_logged_in calls ocs_d_send_prli_rsp() without checking
the FC-4 type, so any port that has completed a PLOGI can trigger this
with a single PRLI, whether or not target mode is enabled.
Management:
- The active profile id is a uint32_t that is formatted as "0x%02x"
with sprintf() into a buffer of MAX_PROFILE_LENGTH (5) bytes, which
overflows for any id above 0xff. Size the buffer for the longest
possible string ("0x" plus 8 hex digits and the terminating NUL) and
use ocs_snprintf().
- Use ocs_snprintf() for nv_wwpn as well, as nv_wwnn already does.
MFC after: 1 week
Sponsored by: Broadcom
Reviewed by: ken
Fix several issues found by security review of the driver.
ioctl:
- Require PRIV_DRIVER for all ocs ioctls and create the device node
with mode 0600, group wheel.
- Return the error from ocs_process_sli_config() to the caller.
Previously only ENXIO was propagated, so a failed validation or a
failed copyin() still issued the mailbox command, in the latter case
with a descriptor pointing at freed memory.
- Reject COMMON_WRITE_OBJECT when in_bytes exceeds
desired_write_length, and cap WRITE_OBJECT, READ_OBJECT,
READ_OBJECT_LIST and non-embedded mailbox buffers at
OCS_MAX_DMA_ALLOC, returning EINVAL.
- Use a 64-bit size for the non-embedded mailbox buffer to avoid
truncation of a user supplied length.
- Refuse to copy out more than the size of the DMA buffer allocated
for the command.
- Range check the BAR offset in the ECD helper ioctl.
HW:
- Range check the XRI in ocs_hw_io_lookup() and return NULL when it is
out of range. Handle a NULL return in the auto xfer ready command
and data paths (returning the RQ buffers in the former), and in
ocs_hw_reclaim_xri().
- Make ocs_ref_get_unless_zero() atomic.
FCP:
- additional_fcp_cdb_length is in 4-byte words, but
ocs_validate_fcp_cmd() added it to the expected payload length as
bytes, so the length check under-validated the received frame.
- Drop commands with a CDB longer than CAM_MAX_CDBLEN instead of
passing a truncated CDB to CAM.
MFC after: 1 week
Sponsored by: Broadcom
Reviewed by: ken
Currently our man(1) utility search manages only in $lang_country.$charset, $lang.$charset and,
as failover, in en.$charset which is historical behavior.
But nowadays most of ported software uses only $lang subdirectories for translated manpages
instead of use full locale notation, for example, share/ja/man1, share/de/man1, share/ru/man1.
In such cases, our man(1) utility cannot find any translated manpages and silently fallback to english version.
Add $man_lang in search path allows man(1) search and use translated manpages under historical and modern path traditions
MFC after: 1 day
MFC to: stable/15 stable/14
Reviewed by: ziaee, fernape
Approved by: fernape
Differential Revision: https://reviews.freebsd.org/D55805
Since SCTP keeps fibnum in the SCTP protocol control block,
the code can't just defer the processing to the IPv4 or IPv6
layer. Therefore it needs to be implemented in the the SCTP
layer and it needs to call the socket layer function.
PR: 300091
Reviewed by: tuexen
Fixes: caccbaef8e ("socket: Move SO_SETFIB handling to protocol layers")
MFC after: 3 days
MFC to: stable/14
MFC to: stable/15
The diagnostics array contained expected modules to be loaded but the
checking logic checked for if a devclass of that name existed instead.
Have the diagnostics array contain the devclass instead as well as the
module to load for the hint string.
Furthermore, check tha the number of devices is greater than 0 so that
leftover devclasses from unloaded modules don't skip the hint.
Reported by: emaste
Reviewed by: emaste
Fixes: 758578370f ("amdsmu: Hints on what to do if IP block blocking S0i3")
Sponsored by: The FreeBSD Foundation
Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/70
When the kernel is started directly by SBI firmware, locore.S maps only
the 1GB region that contains the kernel, and initriscv() reads the DTB
through that mapping at the physical address passed in a1. If the
firmware put the DTB in another 1GB region, as QEMU does with more than
1GB of RAM, fake_preload_metadata() faults before the console is up and
the kernel hangs.
Also map the 1GB region that contains the DTB.
This fixes direct kernel booting without FreeBSD loader(8).
PR: 299088
Reviewed by: mhorne
Fixes: bfb8575469 ("riscv: Construct an identity map in locore.S")
MFC after: 1 week
Signed-off-by: Rick Richard <[email protected]>
In-tree Clang is unaware of the N2680 fixed-width modifier `w` and emits
a warning when used.
PR: 299631
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D60939
Testing on a Dell AMD Ryzen AI 5 PRO 435 laptop shows that the same
diagnostic information is valid.
Reviewed by: obiwac
Sponsored by: The FreeBSD Foundation
For objects without a TLS segment, tlsindex is zero. tls_get_addr_slow()
then reads dtv_slots[-1], which is dtv_size, and returns it as the TLS
address. Set dlpi_tls_data to NULL for such objects instead.
Fixes: d36d681615 ("rtld dl_iterate_phdr(): dlpi_tls_data is wrong")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Add a missing word in the comment.
Make each assignment a separate statement.
Fix formatting.
Fixes: 1e370f0387 ("rtld: stop using unbound alloca()")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
[libunwind] Support extended amd64 segment registers (#229176)
Raise the amd64 DWARF register limit to 59 and add RFLAGS, all six
segment selectors, FS.base, and GS.base to the register model. Capture
the extended state and restore it when resuming, using sigreturn() on
FreeBSD to restore selectors and bases together. Pack the state into the
existing context buffers without changing their public sizes or the
Windows XMM offsets.
Add tests for register access, signal-frame CFI recovery, register
bounds, and resume behavior.
Assisted-by: GPT
MFC after: 1 week
[libunwind] Unwind through AArch64 FreeBSD signal trampolines (#235065)
Retried from https://reviews.llvm.org/D155066.
Recognize signal trampolines using KERN_PROC_SIGTRAMP when unwind
metadata is unavailable. Restore the interrupted PC, LR, SP, general
registers, and valid floating-point registers.
Add coverage for unwinding out of an interrupted leaf function on both
regular and alternate signal stacks.
Assisted-by: GPT
MFC after: 1 week
This makes the driver attach, but the device is still not usable.
Reported by: Lukasz Wencki <[email protected]>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
The error message noting that the file should not be included said
"bsd.conf.mk" before this change. Now it correctly says "bsd.confs.mk".
MFC after: 3 days
These are Single-Pair Ethernet types (SPE) from 802.3cg. smsc sets the
link flag only if mii_media_active is one of a known set of media types.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60745