]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agootus: Return computed error value instead of ENXIO from otus_raw_xmit.
John Baldwin [Fri, 8 Apr 2022 00:01:27 +0000 (17:01 -0700)]
otus: Return computed error value instead of ENXIO from otus_raw_xmit.

(cherry picked from commit c0ca75b0db2fac9c4fd900a0ba8fe453c4c6156c)

2 years agomlx5: Pass the correct data pointer to the add_dst_cb instead of NULL.
John Baldwin [Thu, 7 Apr 2022 17:46:48 +0000 (10:46 -0700)]
mlx5: Pass the correct data pointer to the add_dst_cb instead of NULL.

Reported by: -Wunused-but-set-variable
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34812

(cherry picked from commit ebb16d5e93934c27ccf4e54e780db0b80bd4142e)

2 years agobnhd: Write out updated resource dependencies from the table.
John Baldwin [Thu, 7 Apr 2022 17:46:19 +0000 (10:46 -0700)]
bnhd: Write out updated resource dependencies from the table.

The driver parsed the table to update the relevant resource map
registers, but failed to write the new register value after computing
it.

Reported by: -Wunused-but-set-variable
Reviewed by: landonf, imp
Differential Revision: https://reviews.freebsd.org/D34814

(cherry picked from commit 3cebca152b183a87c48a3d36610569f2b4865261)

2 years agoisci: Propagate error from bus_dma_tag_create.
John Baldwin [Wed, 6 Apr 2022 23:45:28 +0000 (16:45 -0700)]
isci: Propagate error from bus_dma_tag_create.

Return error from isci_controller_allocate_memory if bus_dma_tag_create
fails instead of ignoring the error.

(cherry picked from commit bbfec32d156cec4c004f6f5148a074ba5f0a294d)

2 years agoarm: Zero padding in mcontext_vfp_t in get_vfpcontext().
John Baldwin [Fri, 25 Mar 2022 16:57:20 +0000 (09:57 -0700)]
arm: Zero padding in mcontext_vfp_t in get_vfpcontext().

This can leak kernel stack data otherwise.

Reviewed by: imp, markj
Sponsored by: The University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34594

(cherry picked from commit b234b8d911cdb4fe53032fde0cb8611ae9d0b81d)

2 years agox86: Add a NT_X86_SEGBASES register set.
John Baldwin [Thu, 24 Mar 2022 18:36:19 +0000 (11:36 -0700)]
x86: Add a NT_X86_SEGBASES register set.

This register set contains the values of the fsbase and gsbase
registers.  Note that these registers can already be controlled
individually via ptrace(2) via MD operations, so the main reason for
adding this is to include these register values in core dumps.  In
particular, this will enable looking up the value of TLS variables
from core dumps in gdb.

The value of NT_X86_SEGBASES was chosen to match the value of
NT_386_TLS on Linux.  The notes serve similar purposes, but FreeBSD
will never dump a note equivalent to NT_386_TLS (which dumps a single
segment descriptor rather than a pair of addresses) and picking a
currently-unused value in the NT_X86_* range could result in a future
conflict.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D34650

(cherry picked from commit 931983ee0864079c5f1be0a6b3b9ef097d84ffba)

2 years agoarm,arm64: Add a NT_ARM_TLS read-only register set.
John Baldwin [Wed, 23 Mar 2022 20:33:06 +0000 (13:33 -0700)]
arm,arm64: Add a NT_ARM_TLS read-only register set.

This register set exposes the per-thread TLS register.  It matches the
layout used by Linux on arm64.  Linux does not implement this note for
32-bit arm.

Reviewed by: andrew, markj
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34595

(cherry picked from commit b2cb74c22c4f7087f342cf50b116b040de6bdc6c)

2 years agoUse a regset for NT_ARM_VFP.
John Baldwin [Wed, 23 Mar 2022 20:33:06 +0000 (13:33 -0700)]
Use a regset for NT_ARM_VFP.

This includes adding support for NT_ARM_VFP for 32-bit binaries
running under aarch64 kernels both for ptrace(), and coredumps via the
kernel and gcore.

Reviewed by: andrew, markj
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34448

(cherry picked from commit add00c381e5c9938133061c401dcba764009cafc)

2 years ago<sys/reg.h>: Add ELF32_REGSET.
John Baldwin [Wed, 23 Mar 2022 20:33:06 +0000 (13:33 -0700)]
<sys/reg.h>: Add ELF32_REGSET.

This permits adding a register set for FREEBSD32 ABIs.

While here, include <sys/linker_set.h> to make this header more
self-contained in the kernel.

Reviewed by: andrew, markj
Sponsored by: The University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34536

(cherry picked from commit b1cd03dd2989a125074f049b5795b1d6479ea632)

2 years agoaarch64: Fix get_fpcontext32() to work on non-curthread.
John Baldwin [Wed, 23 Mar 2022 20:33:06 +0000 (13:33 -0700)]
aarch64: Fix get_fpcontext32() to work on non-curthread.

Similar to fill_fpregs(), only invoke vfp_save_state() for curthread.

While here, zero the buffer if FP hasn't been started to avoid leaking
kernel stack memory.

Reviewed by: andrew, markj
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34525

(cherry picked from commit a47fd6929fe2008e28e3e697e449fb0904258d04)

2 years agogcore: Use PT_GETREGSET to fetch NT_PRSTATUS and NT_FPREGSET.
John Baldwin [Thu, 10 Mar 2022 23:40:44 +0000 (15:40 -0800)]
gcore: Use PT_GETREGSET to fetch NT_PRSTATUS and NT_FPREGSET.

Add a elf_putregnote() helper to build the ELF note for a register
set.  Once nice result of this approach is that this reuses the
kernel's support for generating 32-bit register sets for 32-bit
processes avoiding the need to duplicate that logic in elf32core.c.

Reviewed by: markj
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34447

(cherry picked from commit 4965ac059da1ff7f3dac8f9556dd82c619063105)

2 years agoStore core dump notes for all valid register sets for FreeBSD processes.
John Baldwin [Thu, 10 Mar 2022 23:40:19 +0000 (15:40 -0800)]
Store core dump notes for all valid register sets for FreeBSD processes.

In particular, use a generic wrapper around struct regset rather than
requiring per-regset helpers.  This helper replaces the MI
__elfN(note_prstatus) and __elfN(note_fpregset) helpers.  It also
removes the need to explicitly dump NT_ARM_ADDR_MASK in the arm64
__elfN(dump_thread).

Reviewed by: markj, emaste
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34446

(cherry picked from commit 6b71405bfe8dc76834603f8f9e48346c3f49eae0)

Note that this does not remove NT_ARM_ADDR_MASK from the arm64 hook
on stable/13 as NT_ARM_ADDR_MASK is not present in stable/13.

2 years agoelf: Avoid dumping uninitialized bytes in PRSTATUS core dump notes
Mark Johnston [Wed, 23 Mar 2022 16:52:44 +0000 (12:52 -0400)]
elf: Avoid dumping uninitialized bytes in PRSTATUS core dump notes

elf_prstatus_t contains pad space.

Reported by: KMSAN
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34606

(cherry picked from commit 1babcad6bc4093664a10c7ab98b9ebd2d64bcaaf)

2 years agoFix the size returned for NT_FPREGSET.
John Baldwin [Fri, 4 Mar 2022 01:53:06 +0000 (17:53 -0800)]
Fix the size returned for NT_FPREGSET.

Sponsored by: University of Cambridge, Google, Inc.

(cherry picked from commit 0b25cbc79d384ab2b204ff389ea7df99e06a25e6)

2 years agoTrim duplicate code for copying in iovecs for PT_[GS]ETREGSET.
John Baldwin [Mon, 7 Feb 2022 19:49:29 +0000 (11:49 -0800)]
Trim duplicate code for copying in iovecs for PT_[GS]ETREGSET.

Reviewed by: andrew, emaste
Differential Revision: https://reviews.freebsd.org/D34177

(cherry picked from commit 949e3959669f0ca6697ab0d5e8e0b8194de23f81)

2 years agoAdd PT_GETREGSET
Andrew Turner [Mon, 24 Jan 2022 11:24:17 +0000 (11:24 +0000)]
Add PT_GETREGSET

This adds the PT_GETREGSET and PT_SETREGSET ptrace types. These can be
used to access all the registers from a specified core dump note type.
The NT_PRSTATUS and NT_FPREGSET notes are initially supported. Other
machine-dependant types are expected to be added in the future.

The ptrace addr points to a struct iovec pointing at memory to hold the
registers along with its length. On success the length in the iovec is
updated to tell userspace the actual length the kernel wrote or, if the
base address is NULL, the length the kernel would have written.

Because the data field is an int the arguments are backwards when
compared to the Linux PTRACE_GETREGSET call.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19831

(cherry picked from commit 548a2ec49bd4ebf9ab00d362257c6bb4d2d7edbc)

2 years agoCreate sys/reg.h for the common code previously in machine/reg.h
Andrew Turner [Fri, 27 Aug 2021 09:38:40 +0000 (09:38 +0000)]
Create sys/reg.h for the common code previously in machine/reg.h

Move the common kernel function signatures from machine/reg.h to a new
sys/reg.h. This is in preperation for adding PT_GETREGSET to ptrace(2).

Reviewed by: imp, markj
Sponsored by: DARPA, AFRL (original work)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19830

(cherry picked from commit b792434150d66b9b2356fb9a7548f4c7f0a0f16c)

2 years agoAdd infrastructure required for Linux coredump support
Edward Tomasz Napierala [Tue, 29 Jun 2021 07:49:04 +0000 (08:49 +0100)]
Add infrastructure required for Linux coredump support

This adds `sv_elf_core_osabi`, `sv_elf_core_abi_vendor`,
and `sv_elf_core_prepare_notes` fields to `struct sysentvec`,
and modifies imgact_elf.c to make use of them instead
of hardcoding FreeBSD-specific values.  It also updates all
of the ABI definitions to preserve current behaviour.

This makes it possible to implement non-native ELF coredump
support without unnecessary code duplication.  It will be used
for Linux coredumps.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30921

(cherry picked from commit 435754a59ee203c3369f47ff9103f269c81581b7)

2 years agoimgact_elf.c: style, remove unnecessary casts
Edward Tomasz Napierala [Tue, 22 Jun 2021 12:18:49 +0000 (13:18 +0100)]
imgact_elf.c: style, remove unnecessary casts

Remove unnecessary type casts and redundant brackets.
No functional changes.

Suggested By: kib
Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30841

(cherry picked from commit 61b4c62718093fc3a30041bb7fa4d31c7b6c31b2)

2 years agoimgact_elf: compute auxv buffer size instead of using magic value
Edward Tomasz Napierala [Mon, 21 Jun 2021 14:34:19 +0000 (15:34 +0100)]
imgact_elf: compute auxv buffer size instead of using magic value

The new buffer is somewhat larger, but there should be no functional
changes.

Reviewed By: kib, imp
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30821

(cherry picked from commit 06250515cff552217d14145e8932cb1a543a7e07)

2 years agoUnstaticize parts of coredumping code
Edward Tomasz Napierala [Wed, 26 May 2021 09:23:37 +0000 (10:23 +0100)]
Unstaticize parts of coredumping code

This makes it possible to call __elfN(size_segments) and __elfN(puthdr)
from Linux coredump code.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30455

(cherry picked from commit 905d192d6f161496c26db29d0d429525166bfff7)

2 years agoClean up some of the core dumping code.
Edward Tomasz Napierala [Tue, 25 May 2021 10:48:15 +0000 (11:48 +0100)]
Clean up some of the core dumping code.

No functional changes.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30397

(cherry picked from commit 3b9971c8da7532462048062d589ef85cbb904f7e)

2 years agoRefactor core dumping code a bit
Edward Tomasz Napierala [Sat, 22 May 2021 08:58:35 +0000 (09:58 +0100)]
Refactor core dumping code a bit

This makes it possible to use core_write(), core_output(),
and sbuf_drain_core_output(), in Linux coredump code.  Moving
them out of imgact_elf.c is necessary because of the weird way
it's being built.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30369

(cherry picked from commit 33621dfc196e317026aa8b9d916567598a1cedcb)

2 years agomips: Add sv_onexec_old and sv_onexit for COMPAT_FREEBSD32.
John Baldwin [Thu, 12 May 2022 17:49:55 +0000 (10:49 -0700)]
mips: Add sv_onexec_old and sv_onexit for COMPAT_FREEBSD32.

This is a direct commit to stable/13 as MIPS is not present in main.

2 years agofusefs: fix FUSE_CREATE with file handles and fuse protocol < 7.9
Alan Somers [Thu, 28 Apr 2022 21:13:09 +0000 (15:13 -0600)]
fusefs: fix FUSE_CREATE with file handles and fuse protocol < 7.9

Prior to fuse protocol version 7.9, the fuse_entry_out structure had a
smaller size.  But fuse_vnop_create did not take that into account when
working with servers that use older protocols.  The bug does not matter
for servers which don't use file handles or open flags (the only fields
affected).

PR: 263625
Submitted by: Ali Abdallah <ali.abdallah@suse.com>

(cherry picked from commit 45825a12f9851213e627cf41398706bacb793f83)

2 years agoctlstat: add prometheus output
Alan Somers [Wed, 21 Apr 2021 22:56:48 +0000 (16:56 -0600)]
ctlstat: add prometheus output

When invoked by inetd, ctlstat -P will now produce output suitable for
ingestion into Prometheus.

It's a drop-in replacement for https://github.com/Gandi/ctld_exporter,
except that it doesn't report the number of initiators per target, and
it does report time and dma_time.

Sponsored by: Axcient
Relnotes: yes
Reviewed by:  bapt, bcr
Differential Revision: https://reviews.freebsd.org/D29901

(cherry picked from commit 1a7f22d9c211f504f6c48a86401469181a67ec34)

2 years agoprometheus_sysctl_exporter: fix metric aliasing
Alan Somers [Mon, 18 Apr 2022 21:29:37 +0000 (15:29 -0600)]
prometheus_sysctl_exporter: fix metric aliasing

When exporting sysctls to Prometheus, the exporter replaces "." with
"_".  This caused several metrics to alias, confusing the Prometheus
server.  Fix it by:

* Renaming the "tcp_log_bucket" UMA zone to "tcp_log_id_bucket".  Also,
  rename "tcp_log_node" to "tcp_log_id_node" for consistency.

* Not exporting sysctls with "(LEGACY)" in the description.  That is
  used by ZFS sysctls that have been replaced by others, many of which
  alias to the same Prometheus metric name (like "vfs.zfs.arc_max" and
  "vfs.zfs.arc.max").

PR: 259607
Reported by: delphij
Sponsored by: Axcient
Reviewed by: delphij,rew,thj
Differential Revision: https://reviews.freebsd.org/D34952

(cherry picked from commit 8c47d8f53854825d8e8591ccd06e32b2c798f81c)

2 years agofusefs: correctly handle servers that report too much data written
Alan Somers [Mon, 18 Apr 2022 23:03:53 +0000 (17:03 -0600)]
fusefs: correctly handle servers that report too much data written

During a FUSE_WRITE, the kernel requests the server to write a certain
amount of data, and the server responds with the amount that it actually
did write.  It is obviously an error for the server to write more than
it was provided, and we always treated it as such, but there were two
problems:

* If the server responded with a huge amount, greater than INT_MAX, it
  would trigger an integer overflow which would cause a panic.

* When extending the file, we wrongly set the file's size before
  validing the amount written.

PR: 263263
Reported by: Robert Morris <rtm@lcs.mit.edu>
Sponsored by: Axcient
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D34955

(cherry picked from commit 3a1b3c6a1e68063330e897a5a5c94518edae4a3b)

2 years agofusefs: validate servers' error values
Alan Somers [Fri, 15 Apr 2022 19:04:24 +0000 (13:04 -0600)]
fusefs: validate servers' error values

Formerly fusefs would pass up the stack any error value returned by the
fuse server.  However, some values aren't valid for userland, but have
special meanings within the kernel.  One of these, EJUSTRETURN, could
cause a kernel page fault if the server returned it in response to
FUSE_LOOKUP.  Fix by validating all errors returned by the server.

Also, fix a data lifetime bug in the FUSE_DESTROY test.

PR: 263220
Reported by: Robert Morris <rtm@lcs.mit.edu>
Sponsored by: Axcient
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D34931

(cherry picked from commit 155ac516c60f20573d15c54bafabfd0e52d21fa6)

2 years agobwn: eliminate dead writes in BWN_GPL_PHY
Greg V [Wed, 4 May 2022 13:32:59 +0000 (09:32 -0400)]
bwn: eliminate dead writes in BWN_GPL_PHY

This fixes the newly Werror'ed useless write warnings with options
BWN_GPL_PHY.

Reviewed by: markj

(cherry picked from commit 12905b7d50289633a58caf34ba77ff318ba4f0c2)

2 years agostand/zfs: Fix const-qual warnings
Mark Johnston [Fri, 29 Apr 2022 13:19:34 +0000 (09:19 -0400)]
stand/zfs: Fix const-qual warnings

The input buffer is read-only, update casts to match.

No functional change intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8d20f1560d05ef4c96680cd1a0a0b9ac9054700f)

2 years agocxgbei: Support unmapped I/O requests.
John Baldwin [Thu, 10 Mar 2022 23:50:52 +0000 (15:50 -0800)]
cxgbei: Support unmapped I/O requests.

- Add icl_pdu_append_bio and icl_pdu_get_bio methods.

- Add new page pod routines for allocating and writing page pods for
  unmapped bio requests.  Use these new routines for setting up DDP
  for iSCSI tasks with a SCSI I/O CCB which uses CAM_DATA_BIO.

- When ICL_NOCOPY is used to append data from an unmapped I/O request
  to a PDU, construct unmapped mbufs from the relevant pages backing
  the struct bio.  This also requires changes in the t4_push_pdus path
  to support unmapped mbufs.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34383

(cherry picked from commit 2beaefe88443f0644d65b3ae0ac2f1ccff51e748)

2 years agoicl_soft: Use PHYS_TO_DMAP instead of pmap_map_io_transient.
John Baldwin [Fri, 11 Mar 2022 02:20:28 +0000 (18:20 -0800)]
icl_soft: Use PHYS_TO_DMAP instead of pmap_map_io_transient.

The latter API is not actually MI but is only supported on amd64,
arm64, and RISC-V.

Sponsored by: Chelsio Communications

(cherry picked from commit 832acea92fc8cdb55859a6a4b1bc38bf766780f1)

2 years agoiscsi: Support unmapped I/O requests in the default initiator.
John Baldwin [Thu, 10 Mar 2022 23:50:26 +0000 (15:50 -0800)]
iscsi: Support unmapped I/O requests in the default initiator.

- Add icl_pdu_append_bio and icl_pdu_get_bio methods.

- When ICL_NOCOPY is used to append data from an unmapped I/O request
  to a PDU, construct unmapped mbufs from the relevant pages backing
  the struct bio.

- Use m_apply with a helper to compute crc32 digests on mbuf chains
  to handle unmapped mbufs.  Since m_apply requires PMAP_HAS_DMAP
  for unmapped mbufs, only support unmapped requests when PMAP_HAS_DMAP
  is true.

Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D34406

(cherry picked from commit 530e725d8e9ba118ace2f75f010657a4fe4222a6)

2 years agoiscsi: Handle unmapped I/O requests.
John Baldwin [Thu, 10 Mar 2022 23:49:53 +0000 (15:49 -0800)]
iscsi: Handle unmapped I/O requests.

Don't assume that csio->data_ptr is pointer to a data buffer that can
be passed to icl_get_pdu_data and icl_append_data.  For unmapped I/O
requests, csio->data_ptr is instead a pointer to a struct bio as
indicated by CAM_DATA_BIO.  To support these requests, add
icl_pdu_append_bio and icl_pdu_get_bio methods which pass a pointer to
the bio and an offset and length relative to the bio's buffer.

Note that only backends supporting unmapped requests need to implement
these hooks.

Implement simple no-op hooks for the iser backend.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34382

(cherry picked from commit 7aab9c14a462e0871394bbc4e276affb79c8d173)

2 years agoiser: Fix check for opcodes in iser_conn_pdu_append_data.
John Baldwin [Thu, 10 Mar 2022 23:49:37 +0000 (15:49 -0800)]
iser: Fix check for opcodes in iser_conn_pdu_append_data.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34487

(cherry picked from commit c6a43f7f10b183469c3804cfb31b29b6d938621b)

2 years agoiscsi: Use ICL_NOCOPY for SCSI command immediate data and R2T.
John Baldwin [Thu, 10 Mar 2022 23:48:20 +0000 (15:48 -0800)]
iscsi: Use ICL_NOCOPY for SCSI command immediate data and R2T.

The associated csio ccb will not be completed via xpt_done() until
after the associated PDUs are transmitted to the other side and either
the original PDU is acked with a SCSI response, or a response is
received for a subsequent abort CCB (which means the earlier PDU has
also been sent since it would have been sent before the abort PDU).

This does assume that once an I/O request has been aborted, no further
PDUs with data payload are queued for that I/O request.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34405

(cherry picked from commit 9c7a4875bce9d0f8308f92a816abf36af8551914)

2 years agolibpmcstat: Fix a few ARM-specific issues with function symbols.
John Baldwin [Thu, 10 Mar 2022 23:39:53 +0000 (15:39 -0800)]
libpmcstat: Fix a few ARM-specific issues with function symbols.

- Refine the checks for ARM mapping symbols and apply them on arm64 as
  well as 32-bit arm.  In particular, mapping symbols can have
  additional characters and are not strictly limited to just "$a" but
  can append additional characters (e.g. "$a.1").  Add "$x" to the
  list of mapping symbol prefixes.

- Clear the LSB of function symbol addresses.  Thumb function
  addresses set the LSB to enable Thumb mode.  However, the actual
  function starts at the aligned address with LSB clear.  Not clearing
  the LSB can cause pmcannotate to pass misaligned addresses to
  objdump when extracting disassembly.

Reviewed by: andrew
Obtained from: CheriBSD
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34416

(cherry picked from commit a6db407f15ab7d0dbfd83a48173343654106510e)

2 years agobhyve: Remove VM_MAXCPU from the userspace API/ABI.
John Baldwin [Wed, 9 Mar 2022 23:39:28 +0000 (15:39 -0800)]
bhyve: Remove VM_MAXCPU from the userspace API/ABI.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D34494

(cherry picked from commit f1d450ddee669f1e6fef7aefdf8102fc518eef75)

2 years agobhyve: Use vm_get_topology to query kernel's maximum vCPU count.
John Baldwin [Wed, 9 Mar 2022 23:39:23 +0000 (15:39 -0800)]
bhyve: Use vm_get_topology to query kernel's maximum vCPU count.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D34493

(cherry picked from commit c76e4b89d9b87b2450107b29f229d374dc156352)

2 years agobhyve: Don't force an upper bound on vCPUs when parsing pinning.
John Baldwin [Wed, 9 Mar 2022 23:39:16 +0000 (15:39 -0800)]
bhyve: Don't force an upper bound on vCPUs when parsing pinning.

Even today it is possible to specify pinning for a vCPU higher than
the configured number of CPUs but lower than VM_MAXCPU without raising
an error.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D34492

(cherry picked from commit fd6f92946f02b451c792bfdbc94259ff65e49969)

2 years agobhyve: Allocate dynamic arrays to hold per-VCPU state.
John Baldwin [Wed, 9 Mar 2022 23:39:08 +0000 (15:39 -0800)]
bhyve: Allocate dynamic arrays to hold per-VCPU state.

This avoids hardcoding VM_MAXCPU in userspace.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D34491

(cherry picked from commit 7261f82156fb35d4a5e928769041c5987f700cda)

2 years agobhyve: Make the MADT dynamically sized.
John Baldwin [Wed, 9 Mar 2022 23:38:58 +0000 (15:38 -0800)]
bhyve: Make the MADT dynamically sized.

Use basl_ncpu instead of VM_MAXCPU in MADT_SIZE.  Since several of the
offsets are no longer compile time constants, unroll the loop
generating ACPI tables.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D34490

(cherry picked from commit 340a293f9147a37bb71c80a767e37794ca277a28)

2 years agobhyve: Allocate mmio_hint array based on number of guest CPUs.
John Baldwin [Wed, 9 Mar 2022 23:38:49 +0000 (15:38 -0800)]
bhyve: Allocate mmio_hint array based on number of guest CPUs.

This avoids an instance of hardcoding VM_MAXCPU in userspace.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D34489

(cherry picked from commit 730510dc1ab2049d707706241d9a6e73a6952a4e)

2 years agomodule_test: Fix some assignments to errno intended to be tests.
John Baldwin [Mon, 14 Mar 2022 21:05:05 +0000 (14:05 -0700)]
module_test: Fix some assignments to errno intended to be tests.

Reported by: vangyzen
Reviewed by: vangyzen, markj
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34528

(cherry picked from commit 18207579a26bca553ec285f97a98fbe45316223b)

2 years agoAdd simple kyua tests for the mod* system calls.
John Baldwin [Fri, 4 Mar 2022 01:51:45 +0000 (17:51 -0800)]
Add simple kyua tests for the mod* system calls.

Reviewed by: markj
Obtained from: CheriBSD
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34417

(cherry picked from commit 5a1de9c25defdc0e5d08150d5b1877ac117f43e4)

2 years agoGEOM: Fix regression after 7f16b501e25.
Alexander Motin [Wed, 16 Mar 2022 03:58:09 +0000 (23:58 -0400)]
GEOM: Fix regression after 7f16b501e25.

find_geom() in some classes trim leading "/dev/" from geom names.
Lack of that in geom_gettree_geom() broke some existing scripts.

PR: 262554
MFC after: 2 months

(cherry picked from commit bd0f3d34fa20686bac9a418d3a37a3f59c25ab19)

2 years agoGEOM: Introduce partial confxml API
Alexander Motin [Sat, 12 Mar 2022 16:49:37 +0000 (11:49 -0500)]
GEOM: Introduce partial confxml API

Traditionally the GEOM's primary channel of information from kernel to
user-space was confxml, fetched by libgeom through kern.geom.confxml
sysctl.  It is convenient and informative, representing full state of
GEOM in a single XML document.  But problems start to arise on systems
with hundreds of disks, where the full confxml size reaches many
megabytes, taking significant time to first write it and then parse.

This patch introduces alternative solution, allowing to fetch much
smaller XML document, subset of the full confxml, limited to 64KB and
representing only one specified geom and optionally its parents.  It
uses existing GEOM control interface, extended with new "getxml" verb.
In case of any error, such as the buffer overflow, it just transparently
falls back to traditional full confxml.  This patch uses the new API in
user-space GEOM tools where it is possible.

Reviewed by: imp
MFC after: 2 month
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D34529

(cherry picked from commit 7f16b501e25b6c792fefc4535e0d1b8363392fe0)

2 years agortsx: Number of tweaks for RTS5260.
Henri Hennebert [Wed, 27 Apr 2022 01:43:17 +0000 (21:43 -0400)]
rtsx: Number of tweaks for RTS5260.

MFC after: 2 weeks

(cherry picked from commit 8290c144201804d3f01ae16eebe1b9a6b221af54)

2 years agoDisable -Wreturn-type on GCC.
John Baldwin [Mon, 14 Feb 2022 19:48:47 +0000 (11:48 -0800)]
Disable -Wreturn-type on GCC.

GCC is more pedantic than clang about warning when a function doesn't
handle undefined enum values (see GCC bug 87950).  Clang's warning
gives a more pragmatic coverage and should find any real bugs, so
disable the warning for GCC rather than adding __unreachable
annotations to appease GCC.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D34147

(cherry picked from commit 2f6a842484675bb8fe9fafd40d90c06f13e02403)

2 years agoCast pointer to uintptr_t to avoid alignment warnings.
John Baldwin [Sat, 12 Feb 2022 00:04:52 +0000 (16:04 -0800)]
Cast pointer to uintptr_t to avoid alignment warnings.

Both struct ip and struct udphdr both have an aligment of 2, but the
cast from struct ip to a uint32_t pointer confused GCC 9 into raising
the required alignment to 4 and then raising a
-Waddress-of-packed-member error when casting to struct udphdr.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D31941

(cherry picked from commit dba02df30d536922727a7ea509514462452a247a)

2 years agoktls: Write-lock the INP when changing a transmit TLS session.
John Baldwin [Fri, 11 Feb 2022 23:16:25 +0000 (15:16 -0800)]
ktls: Write-lock the INP when changing a transmit TLS session.

The TCP rate pacing code relies on being able to read this pointer
safely while holding an INP lock.  The initial TLS session pointer is
set while holding the write lock already.

Reviewed by: gallatin, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34086

(cherry picked from commit cd0525f615fe8fea750d2078b61026aabe0d0471)

2 years agolinuxkpi xarray: Correct expression in assertion.
John Baldwin [Fri, 11 Feb 2022 21:59:27 +0000 (13:59 -0800)]
linuxkpi xarray: Correct expression in assertion.

Reported by: GCC -Wparantheses
Reviewed by: wulf, hselasky
Differential Revision: https://reviews.freebsd.org/D34197

(cherry picked from commit b0c1600a8c42fc1b2c90714d5fefd3266385225a)

2 years agolinuxkpi: Add parentheses to pacify -Wparentheses warnings from GCC.
John Baldwin [Mon, 7 Feb 2022 21:43:22 +0000 (13:43 -0800)]
linuxkpi: Add parentheses to pacify -Wparentheses warnings from GCC.

Reviewed by: bz, emaste
Differential Revision: https://reviews.freebsd.org/D34145

(cherry picked from commit 7043ca9140d2bf4c42371e25716298d24da54cd0)

2 years agostand/efi: Pass --no-dynamic-linker to ld.bfd >= 2.34.
John Baldwin [Wed, 2 Feb 2022 20:18:43 +0000 (12:18 -0800)]
stand/efi: Pass --no-dynamic-linker to ld.bfd >= 2.34.

ld.bfd in binutils 2.34+ now reports an error in more cases for custom
ldscripts that do not place PHDRs in a LOAD segment.  However, EFI
binaries are not dynamic binaries which need PHDRs, so pass
--no-dynamic-linker to disable this check.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D34124

(cherry picked from commit 8bd5e2f15cc9756e7d6b7feb43ec47f18a38e2bf)

2 years agofstyp: Remove __packed from struct exfat_de_label.
John Baldwin [Tue, 1 Feb 2022 01:33:31 +0000 (17:33 -0800)]
fstyp: Remove __packed from struct exfat_de_label.

This fixes a -Waddress-of-packed-member warning about a possibly
unaligned pointer from GCC 9 when calling convert_label().

__packed has to be removed from struct exfat_dirent as well to fix an
alignment warning when casting from a struct exfat_dirent pointer to a
struct exfat_de_label pointer.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D32144

(cherry picked from commit 58862c0bea66139583f830d21c2f1d98fb844bb0)

2 years agoggatec: Use ANSI C definition for init_initial_buffer_size.
John Baldwin [Tue, 1 Feb 2022 01:12:04 +0000 (17:12 -0800)]
ggatec: Use ANSI C definition for init_initial_buffer_size.

This fixes -Wstrict-prototypes and -Wold-style-definition warnings
from GCC 9.

(cherry picked from commit 6c9ed428284e40f28a49eac2680f06ed33b7cca9)

2 years agohyperv storvsc: Don't abuse struct sglist to hold virtual addresses.
John Baldwin [Tue, 1 Feb 2022 01:11:27 +0000 (17:11 -0800)]
hyperv storvsc: Don't abuse struct sglist to hold virtual addresses.

struct sglist is intended for holding S/G lists of physical address
ranges, not virtual address ranges.  GCC 9.x issues several warnings
due to casts between pointers and integers of different sizes as a
result (vm_paddr_t is 64-bits on i386).  Instead, add a local 'struct
hv_sglist' which uses an array of 'struct iovec' to hold the S/G list
of virtual address ranges.

Differential Revision: https://reviews.freebsd.org/D31933

(cherry picked from commit 53e938e408be78a45c82012ca7a7be50b216159b)

2 years agocryptodev: Use a private malloc type (M_CRYPTODEV) instead of M_XDATA.
John Baldwin [Mon, 24 Jan 2022 23:27:39 +0000 (15:27 -0800)]
cryptodev: Use a private malloc type (M_CRYPTODEV) instead of M_XDATA.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33991

(cherry picked from commit 8f3f3fdf73a98e819d5f73c1da3286bd608e8208)

2 years agoIPsec: Use protocol-specific malloc types instead of M_XDATA.
John Baldwin [Mon, 24 Jan 2022 23:27:39 +0000 (15:27 -0800)]
IPsec: Use protocol-specific malloc types instead of M_XDATA.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33992

(cherry picked from commit 35d9e00dba8cf0c25fbfdbd41ad4d6d1906eed4b)

2 years agomount: Don't pass a NULL format string to xo_err().
John Baldwin [Sat, 25 Sep 2021 18:51:01 +0000 (11:51 -0700)]
mount: Don't pass a NULL format string to xo_err().

This fixes a -Wformat error from GCC 9.

Fixes: e725ee7eb672 mount: add libxo(3) support
(cherry picked from commit 9d324b5ffc8a783ceff2a78dea19602a1d8f045a)

2 years agobhyve: Add an empty case for event types in mevent_kq_fflags().
John Baldwin [Sat, 25 Sep 2021 18:25:25 +0000 (11:25 -0700)]
bhyve: Add an empty case for event types in mevent_kq_fflags().

This fixes a -Wswitch error raised by GCC 9.

Differential Revision: https://reviews.freebsd.org/D31938

(cherry picked from commit 7ecdfc823798a8f7add245651b26d9d900bc9889)

2 years agokernel: Disable errors for -Walloca-larger-than for GCC.
John Baldwin [Sat, 25 Sep 2021 18:24:35 +0000 (11:24 -0700)]
kernel: Disable errors for -Walloca-larger-than for GCC.

GCC complains about the use of alloca() with variable sizes (for XSAVE
state len) in sendsig() for i386.  Modern XSAVE state is probably
getting a bit large for the i386 kstack, but downgrade the error to a
warning.

Reviewed by: kib, emaste
Differential Revision: https://reviews.freebsd.org/D31934

(cherry picked from commit e72c7e2738ca9f5893ba5e5e9dc120dfc82fabfd)

2 years agoarm64: Fix a logic bug in is_load_instr().
John Baldwin [Wed, 15 Sep 2021 16:03:18 +0000 (09:03 -0700)]
arm64: Fix a logic bug in is_load_instr().

Logical and ('&&') was used to join two conditions instead of logical
or ('||') causing some store instructions to not be recognized.

Reported by: GCC 9 -Wparentheses

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D31949

(cherry picked from commit 8753039a8f231ab04c7f3db9eaa5d9144d73440d)

2 years agoarm64: Pass the right label to END() for handle_empty_exception.
John Baldwin [Wed, 15 Sep 2021 16:03:18 +0000 (09:03 -0700)]
arm64: Pass the right label to END() for handle_empty_exception.

GNU as reported an error for the argument to .size not being a constant.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D31950

(cherry picked from commit 857dc1c0ecfbf40509706b87de832a3f6d7338b2)

2 years agoinfiniband: Disable -Wredundant-decl warnings.
John Baldwin [Wed, 15 Sep 2021 16:03:18 +0000 (09:03 -0700)]
infiniband: Disable -Wredundant-decl warnings.

ib_uverbs_flow_resources_free() is declard in two header files in
upstream OFED.  Disable the warning to avoid introducing diffs to fix
the build on GCC 9.

While here, fix the ibcore module to disable the same warnings
disabled in OFED_CFLAGS.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D31943

(cherry picked from commit 44126818d2ec96d8247eafcae9b96905a473a264)

2 years agoAssert that invalid bus widths can't be passed to bus_width_str().
John Baldwin [Wed, 15 Sep 2021 16:03:17 +0000 (09:03 -0700)]
Assert that invalid bus widths can't be passed to bus_width_str().

This appeases a -Wreturn-type warning from GCC.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D31935

(cherry picked from commit d2bc7754a226c031b76184277e32c4d65a763f67)

2 years ago<linux/overflow.h>: Don't use __has_builtin().
John Baldwin [Wed, 15 Sep 2021 16:03:17 +0000 (09:03 -0700)]
<linux/overflow.h>: Don't use __has_builtin().

GCC only added support for __has_builtin in GCC 10.  However, all
supported versions of GCC and clang include these builtins so just use
them unconditionally.

This fixes the build with GCC 9.

Reviewed by: manu, hselasky, imp
Differential Revision: https://reviews.freebsd.org/D31942

(cherry picked from commit 9553c6af881e1f869cecb11b4476279e0ed6c4e0)

2 years agoRemove nonexistent include path for arm64 crypto files.
John Baldwin [Wed, 15 Sep 2021 16:03:17 +0000 (09:03 -0700)]
Remove nonexistent include path for arm64 crypto files.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D31932

(cherry picked from commit 828f257277bd7418bbc0431bbd78569a2f609af1)

2 years agoRemove an always-true check.
John Baldwin [Wed, 15 Sep 2021 16:03:17 +0000 (09:03 -0700)]
Remove an always-true check.

This fixes a -Wtype-limits error from GCC 9.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D31936

(cherry picked from commit 5ac4ac85ca20ce1f00c84502a65a3291bf416c18)

2 years agotop: Remove a duplicate extern declaration for show_args.
John Baldwin [Wed, 15 Sep 2021 16:03:17 +0000 (09:03 -0700)]
top: Remove a duplicate extern declaration for show_args.

This fixes a -Wnested-extern error with GCC 9.  There is an existing
extern declaration in top.h.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D31937

(cherry picked from commit 4c9cb057bd96bd10278f5ce7a735fff4c08e3c30)

2 years agoDisable -Woverflow errors for i386 for GCC 9.
John Baldwin [Mon, 13 Sep 2021 18:00:38 +0000 (11:00 -0700)]
Disable -Woverflow errors for i386 for GCC 9.

GCC 9 warns about floating point constants overflowing for i386.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D26201

(cherry picked from commit 93d6fa53c9951563be3081a347cc4dc1917ad452)

2 years agoUse an ANSI C function declaration for journal_check_space.
John Baldwin [Fri, 23 Jul 2021 22:06:26 +0000 (15:06 -0700)]
Use an ANSI C function declaration for journal_check_space.

GCC6 fails to compile this due to a -Wstrict-prototypes error.

Sponsored by: Chelsio Communications

(cherry picked from commit 58109a87d42b490eba76879f9007a4dbdaf7bb80)

2 years agoiflib: Cast the result of iflib_netmap_txq_init() to void.
John Baldwin [Fri, 19 Feb 2021 20:52:05 +0000 (12:52 -0800)]
iflib: Cast the result of iflib_netmap_txq_init() to void.

This fixes a warning from GCC for kernels without netmap since the
return value is never used.

Reviewed by: vmaffione, erj
Differential Revision: https://reviews.freebsd.org/D28598

(cherry picked from commit 2ccf971ace0bf23a9b27ec886a7f013c47661052)

2 years agoAdd a VA_IS_CLEANMAP() macro.
John Baldwin [Thu, 18 Feb 2021 00:32:11 +0000 (16:32 -0800)]
Add a VA_IS_CLEANMAP() macro.

This macro returns true if a provided virtual address is contained
in the kernel's clean submap.

In CHERI kernels, the buffer cache and transient I/O map are allocated
as separate regions.  Abstracting this check reduces the diff relative
to FreeBSD.  It is perhaps slightly more readable as well.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D28710

(cherry picked from commit 67932460c7b6893a637a47d98d5f29d63e92c727)

2 years agoarm64: Handle 32bits breakpoint exception.
Olivier Houchard [Tue, 21 Sep 2021 13:49:45 +0000 (15:49 +0200)]
arm64: Handle 32bits breakpoint exception.

A different exception is raised when we hit a 32bits breakpoint, rather than
a 64bits one, so handle those as well when COMPAT_FREEBSD32 is defined.
This should fix SIGBUS at least when using breakpoints with thumb2 code.

PR: 256468
MFC After: 1 week

(cherry picked from commit 2734050154927eaa63d3b65de5d46d05569b3a5b)

2 years agoxhci(4): Tweak USB port speed checks to allow newer super speed generations.
Hans Petter Selasky [Tue, 3 May 2022 20:20:27 +0000 (22:20 +0200)]
xhci(4): Tweak USB port speed checks to allow newer super speed generations.

This allows setting the U1 and U2 port timeout values.

Sponsored by: NVIDIA Networking

(cherry picked from commit a1c0442b418b39e57d287750147b0aeae5140766)

2 years agoxhci(4): Properly define all basic USB port speeds.
Hans Petter Selasky [Tue, 3 May 2022 20:19:35 +0000 (22:19 +0200)]
xhci(4): Properly define all basic USB port speeds.

Sponsored by: NVIDIA Networking

(cherry picked from commit d730333c80fe8bc60770d093cbf12f473a065ca4)

2 years agomlx5en(4): Use hard-coded 4K page size for RQ/SQ/CQ.
Hans Petter Selasky [Mon, 2 May 2022 15:14:50 +0000 (17:14 +0200)]
mlx5en(4): Use hard-coded 4K page size for RQ/SQ/CQ.

The page size specified for RQ, SQ and CQ is always in units of 4KBytes.
Make sure we subtract MLX5_ADAPTER_PAGE_SHIFT, 12, instead of PAGE_SHIFT
which may vary. This fixes support for using the mlx5en driver on systems
having non-4K page size.

Linux commit:
68cdf5d6e91068c98d6091b193dc7a5ab7dcf5eb

Sponsored by: NVIDIA Networking

(cherry picked from commit d735d604f063617909d98bd0fc36a6f25a14c699)

2 years agolinuxkpi: Mitigate a seqlock livelock
Mark Johnston [Mon, 25 Apr 2022 13:13:03 +0000 (09:13 -0400)]
linuxkpi: Mitigate a seqlock livelock

Disable preemption in seqlock write sections when using the _irqsave
variant.  This ensures that a writer can't be preempted and subsequently
starved by a reader running in a callout handler on the same CPU.

This fixes occasional display hangs seen when using the i915 driver.

Tested by: emaste, wulf
Reviewed by: wulf, hselasky
Sponsored by: The FreeBSD Foundation

(cherry picked from commit efb8f0b8db8747243f7999b874403d5c86e93b74)

2 years agocross-build: fix some redeclaration warnings during bootstrap
Alex Richardson [Mon, 13 Sep 2021 09:11:47 +0000 (10:11 +0100)]
cross-build: fix some redeclaration warnings during bootstrap

MFC after: 3 days

(cherry picked from commit a89410ef91798859f3fd7a5f675184b4d711ade4)

2 years agoAdd missing const after 6c4f95161d6e
Alex Richardson [Mon, 11 Oct 2021 12:20:36 +0000 (13:20 +0100)]
Add missing const after 6c4f95161d6e

I accidentally didn't include hunk in the committed patch.

Fixes: 6c4f95161d6e ("virtio: make the write_config buffer argument const")
(cherry picked from commit 9017870541daf46358c6cbaa3d4a40e1bffaaaa1)

2 years agovirtio: make the write_config buffer argument const
Alex Richardson [Mon, 11 Oct 2021 10:52:17 +0000 (11:52 +0100)]
virtio: make the write_config buffer argument const

No functional change intended, but noticed that we could add const here
while adding linuxkpi support for virtio.

Reviewed By: bryanv, imp
Differential Revision: https://reviews.freebsd.org/D32370

(cherry picked from commit 6c4f95161d6e38ba3fd50ca1cceee3110cbfa02e)

2 years agolinuxkpi: implement ida_alloc()
Alex Richardson [Fri, 8 Oct 2021 08:36:30 +0000 (09:36 +0100)]
linuxkpi: implement ida_alloc()

Needed for the virtio-gpu driver.

Reviewed By: #linuxkpi, manu, bz, hselasky
Differential Revision: https://reviews.freebsd.org/D32366

(cherry picked from commit d98f2712c7f5e4636afa65c8c3875bbb5ff981cf)

2 years agolinuxkpi: Allow BUILD_BUG_ON in if statements without braces
Alex Richardson [Fri, 8 Oct 2021 08:35:31 +0000 (09:35 +0100)]
linuxkpi: Allow BUILD_BUG_ON in if statements without braces

I got a compilation failure in virtio-gpu without this change.

Reviewed By: #linuxkpi, manu, bz, hselasky
Differential Revision: https://reviews.freebsd.org/D32366

(cherry picked from commit 6d15ccde4d9579ad2a77f93630695804a7efcbc4)

2 years agolinuxkpi: Add sg_init_one
Alex Richardson [Fri, 8 Oct 2021 08:32:46 +0000 (09:32 +0100)]
linuxkpi: Add sg_init_one

Needed for the virtio-gpu driver.

Reviewed By: #linuxkpi, manu, bz, hselasky
Differential Revision: https://reviews.freebsd.org/D32366

(cherry picked from commit 2686b10db41c79dd1a0a0c33a7e0c0b67e0701cc)

2 years agoAdd missing dep patterns for .pieo
Alex Richardson [Mon, 13 Sep 2021 12:22:07 +0000 (13:22 +0100)]
Add missing dep patterns for .pieo

While adding sanitizer support, I noticed that all other extensions were
handled but .pieo was missing.

Reviewed By: emaste, imp
MFC after: 1 week

Differential Revision: https://reviews.freebsd.org/D31040

(cherry picked from commit 2d78130185b5518e0bdb4a2f3c5d5ede6773312d)

2 years agoAdd a test for https://reviews.freebsd.org/D31858 (PR 258310)
Alex Richardson [Mon, 13 Sep 2021 09:16:05 +0000 (10:16 +0100)]
Add a test for https://reviews.freebsd.org/D31858 (PR 258310)

This test (based on https://github.com/jiixyj/epoll-shim/pull/32#issuecomment-891276654)
fails reproducibly on QEMU with KVM and `-smp 2` prior to D31858 (committed
as 98168a6e6c12dab8f608f6b5f5b0b175d2b87ef0) and passes with the patch applied.

Reviewed By: kib, imp
Differential Revision: https://reviews.freebsd.org/D31862

(cherry picked from commit d7d962ead0b6e5e8a39202d0590022082bf5bfb6)

2 years agoExport _mmap and __sys_mmap from libc.so
Alex Richardson [Thu, 9 Sep 2021 10:46:53 +0000 (11:46 +0100)]
Export _mmap and __sys_mmap from libc.so

Unlike the other syscalls these two symbols were missing from the
version script. I noticed this while looking into the compiler-rt
runtime libraries for CHERI.

Reviewed by: brooks
Obtained from: https://github.com/CTSRD-CHERI/cheribsd/pull/1063
MFC after: 3 days

(cherry picked from commit 395db99f32bc615a3df2cd469e9537938d022c88)

2 years agoRemove stray .Pp from WITH_LOADER_EFI_SECUREBOOT description
Ed Maste [Mon, 2 May 2022 19:42:32 +0000 (15:42 -0400)]
Remove stray .Pp from WITH_LOADER_EFI_SECUREBOOT description

MFC after: 3 days
Fixes: 13ea0450a9c8 ("Extend libsecureboot(old libve) to...")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 729ee789117026e980487d0de19ce98ad064af1c)

2 years agoCorrect markup in WITH_/WITHOUT_UNIFIED_OBJDIR descriptions
Ed Maste [Sat, 30 Apr 2022 19:39:21 +0000 (15:39 -0400)]
Correct markup in WITH_/WITHOUT_UNIFIED_OBJDIR descriptions

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 60b08330a503b5a3380b5f68c2aa4c1c4f610a85)

2 years agoUpdate UNIFIED_OBJDIR descriptions
Ed Maste [Mon, 2 May 2022 17:53:30 +0000 (13:53 -0400)]
Update UNIFIED_OBJDIR descriptions

src.conf(5) previously stated they would be removed before FreeBSD 12.0,
but that did not happen.  Change it to "a future version of FreeBSD."

Also pick up LOADER_KBOOT change (enabled on x86) in src.conf regen.

Reported by: jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b7f53cdcf8d5025bf5bb04f60602e6f2bb4ae7ae)

2 years agoUpdate WITH_PROFILE description as it is yet removed
Ed Maste [Sat, 30 Apr 2022 19:25:35 +0000 (15:25 -0400)]
Update WITH_PROFILE description as it is yet removed

GCC still wants to link against (for example) libc_p.a when -pg is in
use, and it's unclear when and how this will be addressed.  Change the
WITH_PROFILE option description to claim that it may be removed from an
unspecified future version of FreeBSD, rather than FreeBSD 14.

Reported by: Steve Kargl
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f768ecf247b7acd98fd0ee395522e559769e3e51)

2 years agonfs: do not panic on bootpc_init when no interfaces are found
Alfredo Dal'Ava Junior [Thu, 7 Apr 2022 22:33:26 +0000 (19:33 -0300)]
nfs: do not panic on bootpc_init when no interfaces are found

Replaces panic with a warning message to allow kernel continue
when no bootp eligible network interfaces are found.

This avoids having to build a custom kernel when using a local root
file system on targets like powerpcspe that expects bootp/NFS by
default.

Reviewed by: rmacklem
MFC after: 2 weeks
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D34567

(cherry picked from commit 0b1b30d66450b20bf18fb4ab39bc6d4f5a6a28fe)

2 years agoclockcalib: Fix an overflow bug
Mark Johnston [Thu, 20 Jan 2022 13:23:38 +0000 (08:23 -0500)]
clockcalib: Fix an overflow bug

tc_counter_mask is an unsigned int and in the TSC timecounter is equal
to UINT_MAX, so the addition tc->tc_counter_mask + 1 can overflow to 0,
resulting in a hang during boot.

Fixes: c2705ceaeb09 ("x86: Speed up clock calibration")
Reviewed by: cperciva
Sponsored by: The FreeBSD Foundation

(cherry picked from commit c3196306f092e46008d5ffa626fbafe1f8a94848)

2 years agosubr_unit.c: make userspace tests buildable
Konstantin Belousov [Thu, 28 Apr 2022 00:00:14 +0000 (03:00 +0300)]
subr_unit.c: make userspace tests buildable

(cherry picked from commit 6fe78ad434557a713ebf5159ac6ac4052ef3da1c)

2 years agounr(9): allow to avoid internal locking
Konstantin Belousov [Wed, 20 Apr 2022 22:14:37 +0000 (01:14 +0300)]
unr(9): allow to avoid internal locking

(cherry picked from commit e59b940dcb45b887974aeae8d8f86665aed2c913)

2 years agoinit_unrhdr(): make it usable by initializing everything
Konstantin Belousov [Wed, 20 Apr 2022 21:58:22 +0000 (00:58 +0300)]
init_unrhdr(): make it usable by initializing everything

(cherry picked from commit c4be460e84b48f2c76e27768ee8132a1d639ebc2)

2 years agoLinuxKPI: 802.11: fill in two more TODOs
Bjoern A. Zeeb [Sat, 30 Apr 2022 08:00:04 +0000 (08:00 +0000)]
LinuxKPI: 802.11: fill in two more TODOs

Implement ieee80211_is_data_present() and a subset of
ieee80211_is_bufferable_mmpdu() which hopefully is good enough in
the compat code for now.
This is partly in preparation for some TXQ changes coming up soon.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 00614c9c2ddc34f3f9061e87542efb4edbd936a9)

2 years agoLinuxKPI: 802.11: use ieee80211_beacon_miss()
Bjoern A. Zeeb [Sat, 30 Apr 2022 07:57:34 +0000 (07:57 +0000)]
LinuxKPI: 802.11: use ieee80211_beacon_miss()

In ieee80211_beacon_loss() call into net80211::ieee80211_beacon_miss()
rather than manually bouncing our state.  That should give us the
ability to send a probereq and see if the AP is till there rather than
right away going to scan.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 3540911bfdd83ce69d1c436f6773becefef403fa)