]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoPrevent running sigwait tests in parallel
Olivier Cochard [Tue, 17 May 2022 21:28:56 +0000 (23:28 +0200)]
Prevent running sigwait tests in parallel

test_sig_discard_ign_* could not run at the same time.

Approved by: dchagin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35236

2 years agopowerpc: enable supported sanitizers on powerpc64*
Piotr Kubaj [Tue, 17 May 2022 06:39:29 +0000 (08:39 +0200)]
powerpc: enable supported sanitizers on powerpc64*

1. Merge LLVM's 315d792130258a9b7250494be8d002ebb427b08f, adding support
for FreeBSD/powerpc64*.
2. Add sanitizer list to lib/libclang_rt/Makefile, taken from the list of
libraries that llvm-devel port builds.
3. powerpc64le supports the same sanitizers that powerpc64, but powerpc64le
also supports xray* sanitizers.
4. lib/libclang_rt/xray/Makefile hardcodes amd64-specific files, so that needs
to be conditionalized.
5. Sanitizers are not enabled for powerpc, because powerpc supports only
builtins and profile.

Reviewed by: dim
Differential Revision: https://reviews.freebsd.org/D35228
Relnotes: yes
MFC after: 3 days

2 years agotruss: add ppoll(2) argument decoding
Christian Weisgerber [Tue, 17 May 2022 18:20:53 +0000 (20:20 +0200)]
truss: add ppoll(2) argument decoding

PR: 264029
Approved by: emaste
MFC after: 3 days

2 years agosockbuf: improve sbcreatecontrol()
Gleb Smirnoff [Tue, 17 May 2022 17:10:42 +0000 (10:10 -0700)]
sockbuf: improve sbcreatecontrol()

o Constify memory pointer.  Make length unsigned.
o Make it never fail with M_WAITOK and assert that length is sane.

2 years agosockbuf: merge two versions of sbcreatecontrol() into one
Gleb Smirnoff [Tue, 17 May 2022 17:10:42 +0000 (10:10 -0700)]
sockbuf: merge two versions of sbcreatecontrol() into one

No functional change.

2 years agounix: garbage collect unp_dispose_mbuf() for brevity
Gleb Smirnoff [Tue, 17 May 2022 17:10:41 +0000 (10:10 -0700)]
unix: garbage collect unp_dispose_mbuf() for brevity

2 years agounix: fix mbuf leak on close of socket with data
Gleb Smirnoff [Tue, 17 May 2022 17:10:41 +0000 (10:10 -0700)]
unix: fix mbuf leak on close of socket with data

Fixes: 1f32cef47189403e9e70b1893c731c68b97b964e

2 years agopf: allocate krule->timestamp in pf_krule_alloc()
Kristof Provost [Tue, 17 May 2022 12:41:25 +0000 (14:41 +0200)]
pf: allocate krule->timestamp in pf_krule_alloc()

There are three calls which can allocate a new rule. DIOCADDRULE,
DIOCADDRULENV and DIOCCHANGERULE. The first two call pf_ioctl_addrule(),
but DIOCCHANGERULE does not. As a result rules created through
DIOCCHANGERULE do not have the timestamp per-cpu memory allocated, and
we panic when the rule is exported with pf_krule_to_nvrule().

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoLinuxKPI: Switch irq_work implementation back to standard taskqueue
Vladimir Kondratyev [Tue, 17 May 2022 12:10:20 +0000 (15:10 +0300)]
LinuxKPI: Switch irq_work implementation back to standard taskqueue

from fast one as dmabuf does not run callbacks from critical sections
since drm-kmod 5.7.
Consumers which requires fair irq_work like drm-kmod 5.4 must #define
LKPI_IRQ_WORK_USE_FAST_TQ somewhere in source file before linux/irq_work.h
inclusion to enable old behavior.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35052

2 years agoLinuxKPI: Do not use forward declaration for struct llist_node
Vladimir Kondratyev [Tue, 17 May 2022 12:10:20 +0000 (15:10 +0300)]
LinuxKPI: Do not use forward declaration for struct llist_node

in linux/irq_work.h as irq_work structure contains full version of
llist_node rather than reference to it.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35052

2 years agoLinuxKPI: IRQ work add TASKQUEUE_FAIL_IF_PENDING flag to taskqueue_enqueue
Vladimir Kondratyev [Tue, 17 May 2022 12:10:20 +0000 (15:10 +0300)]
LinuxKPI: IRQ work add TASKQUEUE_FAIL_IF_PENDING flag to taskqueue_enqueue

call to match Linux.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35052

2 years agoLinuxKPI: Implement kthread_worker related functions
Vladimir Kondratyev [Tue, 17 May 2022 12:10:20 +0000 (15:10 +0300)]
LinuxKPI: Implement kthread_worker related functions

Kthread worker is a single thread workqueue which can be used in cases
where specific kthread association is necessary, for example, when it
should have RT priority or be assigned to certain cgroup.

This change implements Linux v4.9 interface which mostly hides kthread
internals from users thus allowing to use ordinary taskqueue(9) KPI.
As kthread worker prohibits enqueueing of already pending or canceling
tasks some minimal changes to taskqueue(9) were done.
taskqueue_enqueue_flags() was added to taskqueue KPI which accepts extra
flags parameter. It contains one or more of the following flags:

TASKQUEUE_FAIL_IF_PENDING - taskqueue_enqueue_flags() fails if the task
    is already scheduled to execution. EEXIST is returned and the
    ta_pending counter value remains unchanged.
TASKQUEUE_FAIL_IF_CANCELING - taskqueue_enqueue_flags() fails if the
    task is in the canceling state and ECANCELED is returned.

Required by: drm-kmod 5.10

MFC after: 1 week
Reviewed by: hselasky, Pau Amma (docs)
Differential Revision: https://reviews.freebsd.org/D35051

2 years agoLinuxKPI: Implement sched_set_fifo(_low) functions
Vladimir Kondratyev [Tue, 17 May 2022 12:10:20 +0000 (15:10 +0300)]
LinuxKPI: Implement sched_set_fifo(_low) functions

Required by: drm-kmod

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D35050

2 years agoLinuxKPI: Add some pollution required by drm-kmod to linux/sched.h
Vladimir Kondratyev [Tue, 17 May 2022 12:10:20 +0000 (15:10 +0300)]
LinuxKPI: Add some pollution required by drm-kmod to linux/sched.h

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D35050

2 years agoLinuxKPI: Add cpu_latency_qos_request_active stub to linux/pm_qos.h
Vladimir Kondratyev [Tue, 17 May 2022 12:10:20 +0000 (15:10 +0300)]
LinuxKPI: Add cpu_latency_qos_request_active stub to linux/pm_qos.h

Required by: drm-kmod 5.10

MFC after: 1 week
Reviewers: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D35049

2 years agoLinuxKPI: Fix typo in cond_resched_lock
Vladimir Kondratyev [Tue, 17 May 2022 12:10:20 +0000 (15:10 +0300)]
LinuxKPI: Fix typo in cond_resched_lock

Lock must be released rather than acquired around mi_switch call.

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D35048

2 years agoLinuxKPI: Convert lkpi-shrinker lock to sx.
Vladimir Kondratyev [Tue, 17 May 2022 12:10:20 +0000 (15:10 +0300)]
LinuxKPI: Convert lkpi-shrinker lock to sx.

This fixes "might_sleep() with the following non-sleepable locks held:
exclusive sleep mutex lkpi-shrinker" warnings.

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D35047

2 years agoLinuxKPI: Allow lkpi_iic driver to be a child of drm device.
Vladimir Kondratyev [Tue, 17 May 2022 12:10:19 +0000 (15:10 +0300)]
LinuxKPI: Allow lkpi_iic driver to be a child of drm device.

i915kms exposes "AUX #/port #" I2C adapters as drm children

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D35046

2 years agoigc: Increase rx_buffer_size local variable to 32b
Kevin Bowling [Tue, 17 May 2022 03:15:34 +0000 (20:15 -0700)]
igc: Increase rx_buffer_size local variable to 32b

Apply 6987c47569b377f4b6eba9966afdedfb1b39fca8 to igc. This is not
expected to have any benefit on current parts with current observed PBA
sizes but will avoid surprises if they are increased in future chips.

Approved by: grehan
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D35217

2 years agotests/unix_dgram: account for size of sender address in the filling cycle
Gleb Smirnoff [Tue, 17 May 2022 02:04:02 +0000 (19:04 -0700)]
tests/unix_dgram: account for size of sender address in the filling cycle

This fixes test failure with large net.local.dgram.recvspace values.

2 years agomakefs: fix calculation of file sizes
Alan Somers [Mon, 16 May 2022 22:32:10 +0000 (16:32 -0600)]
makefs: fix calculation of file sizes

When a new FS image is created we need to calculate how much space each
file is going to consume.
Fix two bugs in that logic:

1) Count the space needed for indirect blocks for large files.
1) Normally the trailing data of a file is written to a block of frag
   size, 4 kB by default.

However for files that use indirect blocks a full block is allocated,
32kB by default.  Take that into account.

Adjust size calculations to match what is done in ffs_mkfs routine:

* Depending on the UFS version the superblock is stored at a different
  offset. Take that into account.
* Add the cylinder group block size.
* All of the above has to be aligned to the block size.

Finally, Remove "ncg" variable. It's always 1 and it was used to
multiply stuff.

PR: 229929
Reviewed by: mckusick
MFC after: 2 weeks
Sponsored by: Semihalf
Submitted by: Kornel DulÄ™ba <mindal@semihalf.com>
Differential Revision: https://reviews.freebsd.org/D35131
Differential Revision: https://reviews.freebsd.org/D35132

2 years agoriscv: also enable includes, stats and stats_client in libclang_rt
Piotr Kubaj [Mon, 18 Apr 2022 18:26:40 +0000 (20:26 +0200)]
riscv: also enable includes, stats and stats_client in libclang_rt

Reviewed by: dim (earlier version)
Differential Revision: https://reviews.freebsd.org/D34735
MFC after: 3 days

2 years agolinux(4): Fix arm64 syscalls.master layout
Dmitry Chagin [Mon, 16 May 2022 19:53:38 +0000 (22:53 +0300)]
linux(4): Fix arm64 syscalls.master layout

MFC after: 2 weeks

2 years agolibsysdecode: Fix decoding of SCHED_ flags
Dmitry Chagin [Mon, 16 May 2022 18:57:48 +0000 (21:57 +0300)]
libsysdecode: Fix decoding of SCHED_ flags

Use sys/sched.h where SCHED_ flags are defined.

Reviewed by: emaste
Differential revision: https://reviews.freebsd.org/D35208
MFC after: 2 weeks

2 years agoiwlwifi: import two fixes from linux v5.18-rc7
Bjoern A. Zeeb [Mon, 16 May 2022 18:07:36 +0000 (18:07 +0000)]
iwlwifi: import two fixes from linux v5.18-rc7

Import two changes from torvalds/linux.git at tag: v5.18-rc7:
b20bdd9cc9740ac1f2138adab25ddd51245c67be
    iwlwifi: mvm: Don't fail if PPAG isn't supported
7635a1ad8d92dcc8247b53f949e37795154b5b6f
    iwlwifi: iwl-dbg: Use del_timer_sync() before freeing

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoiwlwifi: update firmware
Bjoern A. Zeeb [Mon, 16 May 2022 16:14:25 +0000 (16:14 +0000)]
iwlwifi: update firmware

Update to the latest iwlwifi firmware based on
 linux-firmware at b19cbdca78ab2adfd210c91be15a22568e8b8cae
 (tag: 20220509)
and update firmware module Makefiles accordingly.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoiwlwifi: update driver from iwlwifi-next
Bjoern A. Zeeb [Mon, 16 May 2022 15:54:57 +0000 (15:54 +0000)]
iwlwifi: update driver from iwlwifi-next

Import code update from iwlwifi-next
 at e89600ebeeb14d18c0b062837a84196f72542830.

This amongst other things removes the deprecated BCAST_FILTERING option,
which we had disabled before due to firmware issues.
Also prepares us for the next firmware update.

The "enable_ini" module option has become an integer with a
sysctl proc equivalent handler.  Disable the module parameter changing
for the moment until we'll have working LinuxKPI support or implement
it as SYSCTL_PROC in FreeBSD directly.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoLinuxKPI: 802.11 add rfkill_soft_blocked()
Bjoern A. Zeeb [Mon, 16 May 2022 15:38:31 +0000 (15:38 +0000)]
LinuxKPI: 802.11 add rfkill_soft_blocked()

Add rfkill_soft_blocked() to the list of things to implement in
preparation for an iwlwifi update.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoigc: Fix typo in PCI ID define usage
Kevin Bowling [Sun, 15 May 2022 23:13:06 +0000 (16:13 -0700)]
igc: Fix typo in PCI ID define usage

Reported by: jenkins
Fixes: bf0aa72f1f59 igc: Update PCI IDs
MFC after: 3 days

2 years agoigc: Update PCI IDs
Kevin Bowling [Sun, 15 May 2022 22:07:59 +0000 (15:07 -0700)]
igc: Update PCI IDs

I226-K PCI ID got clarified by intel. Add a new I226 ID while here.

Approved by: grehan
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D35218

2 years agoReduce code nesting in readsuper().
Kirk McKusick [Sun, 15 May 2022 22:01:14 +0000 (15:01 -0700)]
Reduce code nesting in readsuper().

No functional change.

2 years agosctp: use sb_avail() when accessing sb_acc for reading
Michael Tuexen [Sat, 14 May 2022 10:38:43 +0000 (12:38 +0200)]
sctp: use sb_avail() when accessing sb_acc for reading

This is a cleanup to simplify a patch for PR 260116.

PR: 260116
MFC after: 3 days

2 years agokrpc: Fix NFS-over-TLS for KTLS1.3
Rick Macklem [Sun, 15 May 2022 18:51:56 +0000 (11:51 -0700)]
krpc: Fix NFS-over-TLS for KTLS1.3

When NFS-over-TLS uses KTLS1.3, the client can receive
post-handshake handshake records.  These records can be
safely thown away, but are not handled correctly via the
rpctls_ct_handlerecord() upcall to the daemon.

Commit 373511338d95 changed soreceive_generic() so that it
will only return ENXIO for Alert records when MSG_TLSAPPDATA
is specified.  As such, the post-handshake handshake
records will be returned to the krpc.

This patch modifies the krpc so that it will throw
these records away, which seems sufficient to make
NFS-over-TLS work with KTLS1.3.  This change has
no effect on the use of KTLS1.2, since it does not
generate post-handshake handshake records.

MFC after: 2 weeks

2 years agolinux(4): Add AT_MINSIGSTKSZ to arm64 port
Dmitry Chagin [Sun, 15 May 2022 18:12:03 +0000 (21:12 +0300)]
linux(4): Add AT_MINSIGSTKSZ to arm64 port

MFC after: 2 weeks

2 years agolinux(4): Implement signal trampoline for arm64 in a FreeBSD-way
Dmitry Chagin [Sun, 15 May 2022 18:10:50 +0000 (21:10 +0300)]
linux(4): Implement signal trampoline for arm64 in a FreeBSD-way

The implemenation differs from others Linuxulators.
For unwinders Linux ucontext_t is stored, however native machine context
is used to store/restore process state to avoid code duplication.

As DWARF Aarch64 does not define a register number for PC and provides no
direct way to encode the PC of the previous frame, CFI cannot describe a
signal trampoline frame. So, modified the vdso linker script to discard
unused sections.

Extensions are not implemented.

MFC after: 2 weeks

2 years agolinux(4): Retire unused include
Dmitry Chagin [Sun, 15 May 2022 18:08:45 +0000 (21:08 +0300)]
linux(4): Retire unused include

MFC after: 2 weeks

2 years agolinux(4): Retire handmade DWARF annotations from signal trampolines
Dmitry Chagin [Sun, 15 May 2022 18:08:12 +0000 (21:08 +0300)]
linux(4): Retire handmade DWARF annotations from signal trampolines

The Linux exports __kernel_sigreturn and __kernel_rt_sigreturn from the
vdso. Modern glibc's sigaction sets the sa_restorer field of sigaction
to the corresponding vdso __sigreturn, and sets the SA_RESTORER.
Our signal trampolines uses the FreeBSD-way to call a signal handler,
so does not use the sigaction's sa_restorer.

However, as glibc's runtime linker depends on the existment of the vdso
__sigreturn symbols, for all Linuxulators was added separate trampolines
named __sigcode with DWARF anotations and left separate __sigreturn
methods, which are exported.

MFC after: 2 weeks

2 years agolinux(4): Better naming for ucontext field of struct rt_sigframe
Dmitry Chagin [Sun, 15 May 2022 18:06:47 +0000 (21:06 +0300)]
linux(4): Better naming for ucontext field of struct rt_sigframe

To reduce sendsig code difference and to avoid confusing me,
rename sf_sc to sf_uc to match the content.

MFC after: 2 weeks

2 years agolinux(4): Rework the definition of struct siginfo to match Linux actual one
Dmitry Chagin [Sun, 15 May 2022 18:05:01 +0000 (21:05 +0300)]
linux(4): Rework the definition of struct siginfo to match Linux actual one

Rework the defintion of struct siginfo so that the array padding
struct siginfo to SI_MAX_SIZE can be placed in a union along side of the
rest of the struct siginfo members.  The result is that we no longer need
the __ARCH_SI_PREAMBLE_SIZE or SI_PAD_SIZE definitions.

Move struct siginfo definition under /compat/linux to reduce MD part.
To avoid headers polution include linux_siginfo.h in the MD linux.h

MFC after: 2 weeks

2 years agolinux(4): Move sigframe definitions to separate headers
Dmitry Chagin [Sun, 15 May 2022 18:03:01 +0000 (21:03 +0300)]
linux(4): Move sigframe definitions to separate headers

The signal trampoine-related definitions are used only in the MD part
of code, wherefore moved from everywhere used linux.h to separate MD
headers.

MFC after: 2 weeks

2 years agolinux(4): Cleanup signal trampolines
Dmitry Chagin [Sun, 15 May 2022 18:00:05 +0000 (21:00 +0300)]
linux(4): Cleanup signal trampolines

This is the first stage of a signal trampolines refactoring.

From trampolines retired emulation of the 'call' instruction, which is
replaced by direct call of a signal handler. The signal handler address
is in the register.

The previous trampoline implemenatation used semi-Linux-way to call
a signal handler via the 'jmp' instruction. Wherefore the trampoline
emulated a 'call' instruction to into the stack the return address for
signal handler's 'ret' instruction.  Wherefore handmade DWARD annotations
was used.

While here rephrased and removed excessive comments.

MFC after: 2 weeks

2 years agolinux(4): Retire unneeded initialization
Dmitry Chagin [Sun, 15 May 2022 17:58:47 +0000 (20:58 +0300)]
linux(4): Retire unneeded initialization

Both uc_flags and uc_link are zeroed above. On amd64 and i386 the
uc_link field is not used at all. The UC_FP_XSTATE bit should be set
in the uc_flags if OS xsave knob is turned on (and xsave is implemented).

MFC after: 2 weeks

2 years agolinux(4): Implement futex_op for arm64.
Dmitry Chagin [Sun, 15 May 2022 17:49:42 +0000 (20:49 +0300)]
linux(4): Implement futex_op for arm64.

It's mostly modeled like the Linux does.

Differential revision: https://reviews.freebsd.org/D35154
MFC after: 2 weeks

2 years agosctp: cleanup, no functional change intended
Michael Tuexen [Sat, 14 May 2022 06:30:41 +0000 (08:30 +0200)]
sctp: cleanup, no functional change intended

MFC after: 3 days

2 years agosctp: improve path verification
Michael Tuexen [Sat, 14 May 2022 06:07:28 +0000 (08:07 +0200)]
sctp: improve path verification

Ensure that a HB can be sent faster than a HB.Interval when performing
path verification of a reachable peer address.

Thanks to Alexander Funke for finding the issue and proposing a fix.

MFC after: 3 days

2 years agosctp: improve path verification
Michael Tuexen [Sat, 14 May 2022 06:05:03 +0000 (08:05 +0200)]
sctp: improve path verification

When sending path confirmation heartbeats, do not take HB.interval
into account when the path is still reachable.

Thanks to Alexander Funke for finding the issue and suggesting a fix.

MFC after: 3 days

2 years agosctp: improve consistency
Michael Tuexen [Sat, 14 May 2022 04:28:19 +0000 (06:28 +0200)]
sctp: improve consistency

No functional change intended.

MFC after: 3 days

2 years agoAvoid adding -d to kernel module link command lines for lld >= 14
Dimitry Andric [Sat, 14 May 2022 20:07:01 +0000 (22:07 +0200)]
Avoid adding -d to kernel module link command lines for lld >= 14

Since 0b3178a45cd0 we have added '-d' to the link command line for
kernel modules, so if any unexpected common symbols turn up (even though
we use -fno-common in CFLAGS), storage will be allocated in in the
module itself.

However, with lld this option did not have any effect since ~2017, and
as of lld 14 it warns: "-d, -dc, -dp, and --[no-]define-common will be
removed. See https://github.com/llvm/llvm-project/issues/53660"

Add a linker type and version check, to avoid adding the option for lld
14 and later.

Reported by: bz
MFC after: 2 weeks

2 years agouipc_socket.c: Modify MSG_TLSAPPDATA to only do Alert Records
Rick Macklem [Sat, 14 May 2022 19:56:50 +0000 (12:56 -0700)]
uipc_socket.c: Modify MSG_TLSAPPDATA to only do Alert Records

Without this patch, the MSG_TLSAPPDATA flag would cause
soreceive_generic() to return ENXIO for any non-application
data record in a TLS receive stream.

This works ok for TLS1.2, since Alert records appear to be
the only non-application data records received.
However, for TLS1.3, there can be post-handshake handshake
records, such as NewSessionKey sent to the client from the
server. These handshake records cannot be handled by the
upcall which does an SSL_read() with length == 0.

It appears that the client can simply throw away these
NewSessionKey records, but to do so, it needs to receive
them within the kernel.

This patch modifies the semantics of MSG_TLSAPPDATA slightly,
so that it only applies to Alert records and not Handshake
records. It is needed to allow the krpc to work with KTLS1.3.

Reviewed by: hselasky
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35170

2 years agodumpon: warn if the configured netdump link is down
Mitchell Horne [Sat, 14 May 2022 13:25:21 +0000 (10:25 -0300)]
dumpon: warn if the configured netdump link is down

Previously we expected the DIOCSKERNELDUMP ioctl to return ENXIO if the
interface was down, but it does not actually do this. Grab the link
status using getifaddrs(3) instead, and downgrade this case from an
error to a warning; the user might bring the link back up at a later
time.

Reviewed by: cem
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35196

2 years agonetdump: check the support status of the interface
Mitchell Horne [Sat, 14 May 2022 13:23:58 +0000 (10:23 -0300)]
netdump: check the support status of the interface

If the interface does not support debugnet(4) we should bail early,
rather than having the user find this out at the time of the panic.
dumpon(8) already expects this return value and will print a helpful
error message.

Reviewed by: cem, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35180

2 years agodebugnet: fix an errant assertion
Mitchell Horne [Sat, 14 May 2022 13:23:08 +0000 (10:23 -0300)]
debugnet: fix an errant assertion

We may call debugnet_free() before g_debugnet_pcb_inuse is true,
specifically in the cases where the interface is down or does not
support debugnet. pcb->dp_drv_input is used to hold the real driver
if_input callback while debugnet is in use, so we can check the status
of this field in the assertion.

This can be triggered trivially by trying to configure netdump on an
unsupported interface at the ddb prompt.

Initializing the dp_drv_input field to NULL explicitly is not necessary
but helps display the intent.

PR: 263929
Reported by: Martin Filla <freebsd@sysctl.cz>
Reviewed by: cem, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35179

2 years agokqueue: Fix kqueue(2) man page.
Dmitry Chagin [Sat, 14 May 2022 11:52:51 +0000 (14:52 +0300)]
kqueue: Fix kqueue(2) man page.

Remove bogus BUGS note about timeout limit to 24 hours, that's not true
since callouting project import.

Reviewed by: mav
Differential revision: https://reviews.freebsd.org/D35206
MFC after: 2 weeks

2 years agoMerge llvm-project release/14.x llvmorg-14.0.3-0-g1f9140064dfb
Dimitry Andric [Thu, 28 Apr 2022 18:32:24 +0000 (20:32 +0200)]
Merge llvm-project release/14.x llvmorg-14.0.3-0-g1f9140064dfb

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.3-0-g1f9140064dfb.

PR: 261742
MFC after: 2 weeks

2 years agoApply libc++ fix for <ranges> not compiling at all
Dimitry Andric [Thu, 7 Apr 2022 20:04:53 +0000 (22:04 +0200)]
Apply libc++ fix for <ranges> not compiling at all

Merge commit 44cdca37c01a from llvm git (by Arthur O'Dwyer):

  [libc++] Define `namespace views` in its own detail header.

  Discovered in the comments on D118748: we would like this namespace
  to exist anytime Ranges exists, regardless of whether concepts syntax
  is supported. Also, we'd like to fully granularize the <ranges> header,
  which means not putting any loose declarations at the top level.

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

2 years agoMerge llvm-project release/14.x llvmorg-14.0.0-2-g3f43d803382d
Dimitry Andric [Tue, 29 Mar 2022 20:16:50 +0000 (22:16 +0200)]
Merge llvm-project release/14.x llvmorg-14.0.0-2-g3f43d803382d

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-2-g3f43d803382d.

PR: 261742
MFC after: 2 weeks

2 years agoMerge llvm-project release/14.x llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a
Dimitry Andric [Thu, 17 Mar 2022 19:16:00 +0000 (20:16 +0100)]
Merge llvm-project release/14.x llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a.

PR: 261742
MFC after: 2 weeks

2 years agoApply libc++ fix for firefox visibility push/pop issue
Dimitry Andric [Tue, 15 Mar 2022 20:32:06 +0000 (21:32 +0100)]
Apply libc++ fix for firefox visibility push/pop issue

Merge commit 7ab1ab0db401 from llvm git (by Dimitry Andric):

  [libc++] Make __dir_stream visibility declaration consistent

  The class `__dir_stream` is currently declared in two places: as a
  top-level forward declaration in `directory_iterator.h`, and as a friend
  declaration in class `directory_entry`, in `directory_entry.h`.

  The former has a `_LIBCPP_HIDDEN` attribute, but the latter does not,
  causing the Firefox build to complain about the visibility not matching
  the previous declaration. This is because Firefox plays games with
  pushing and popping visibility.

  Work around this by making both `__dir_stream` declarations consistently
  use `_LIBCPP_HIDDEN`.

  Reviewed By: ldionne, philnik, #libc

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

2 years agoMerge llvm-project release/14.x llvmorg-14.0.0-rc2-12-g09546e1b5103
Dimitry Andric [Sat, 5 Mar 2022 14:16:17 +0000 (15:16 +0100)]
Merge llvm-project release/14.x llvmorg-14.0.0-rc2-12-g09546e1b5103

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-rc2-12-g09546e1b5103.

PR: 261742
MFC after: 2 weeks

2 years agoMerge llvm-project release/14.x llvmorg-14.0.0-rc1-74-g4dc3cb8e3255
Dimitry Andric [Fri, 18 Feb 2022 22:41:20 +0000 (23:41 +0100)]
Merge llvm-project release/14.x llvmorg-14.0.0-rc1-74-g4dc3cb8e3255

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-rc1-74-g4dc3cb8e3255.

PR: 261742
MFC after: 2 weeks

2 years agoApply fix for asm constraint error in www/php80-opcache
Dimitry Andric [Thu, 17 Feb 2022 21:49:39 +0000 (22:49 +0100)]
Apply fix for asm constraint error in www/php80-opcache

Merge commit 027c16bef4b7 from llvm git (by Nick Desaulniers):

  [X86ISelLowering] permit BlockAddressSDNode "i" constraints for PIC

  When building 32b x86 code as PIC, the existing handling of "i"
  constraints is conservative since generally we have to go through the
  GOT to find references to functions.

  But generally, BlockAddresses from C code refer to the Function in the
  current TU.  Permit BlockAddresses to be used with the "i" constraint
  for those cases.

  I regressed this in
  commit 4edb9983cb8c ("[SelectionDAG] treat X constrained labels as i for asm")

Fixes: https://github.com/llvm/llvm-project/issues/53868
  Reviewed By: efriedma, MaskRay

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

2 years agoMerge llvm-project release/14.x llvmorg-14-init-18315-g190be5457c90
Dimitry Andric [Sat, 5 Feb 2022 22:51:07 +0000 (23:51 +0100)]
Merge llvm-project release/14.x llvmorg-14-init-18315-g190be5457c90

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-18315-g190be5457c90.

PR: 261742
MFC after: 2 weeks

2 years agoMerge llvm-project main llvmorg-14-init-18294-gdb01b123d012
Dimitry Andric [Sat, 5 Feb 2022 20:07:43 +0000 (21:07 +0100)]
Merge llvm-project main llvmorg-14-init-18294-gdb01b123d012

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-18294-gdb01b123d012, the last commit before
the upstream release/14.x branch was created.

PR: 261742
MFC after: 2 weeks

2 years agoMerge llvm-project main llvmorg-14-init-17616-g024a1fab5c35
Dimitry Andric [Thu, 27 Jan 2022 22:17:16 +0000 (23:17 +0100)]
Merge llvm-project main llvmorg-14-init-17616-g024a1fab5c35

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-17616-g024a1fab5c35.

PR: 261742
MFC after: 2 weeks

2 years agoMerge llvm-project main llvmorg-14-init-13186-g0c553cc1af2e
Dimitry Andric [Sat, 25 Dec 2021 22:36:56 +0000 (23:36 +0100)]
Merge llvm-project main llvmorg-14-init-13186-g0c553cc1af2e

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-13186-g0c553cc1af2e.

PR: 261742
MFC after: 2 weeks

2 years agoMerge llvm-project main llvmorg-14-init-11187-g222442ec2d71
Dimitry Andric [Thu, 2 Dec 2021 21:49:08 +0000 (22:49 +0100)]
Merge llvm-project main llvmorg-14-init-11187-g222442ec2d71

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-11187-g222442ec2d71.

PR: 261742
MFC after: 2 weeks

2 years agoMerge llvm-project main llvmorg-14-init-10223-g401b76fdf2b3
Dimitry Andric [Sat, 20 Nov 2021 17:39:12 +0000 (18:39 +0100)]
Merge llvm-project main llvmorg-14-init-10223-g401b76fdf2b3

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-10223-g401b76fdf2b3.

PR: 261742
MFC after: 2 weeks

2 years agoMerge llvm-project main llvmorg-14-init-10186-gff7f2cfa959b
Dimitry Andric [Sun, 20 Mar 2022 11:40:34 +0000 (12:40 +0100)]
Merge llvm-project main llvmorg-14-init-10186-gff7f2cfa959b

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-10186-gff7f2cfa959b.

PR: 261742
MFC after: 2 weeks

2 years agosysvsem: Fix a typo
Dmitry Chagin [Sat, 14 May 2022 11:07:20 +0000 (14:07 +0300)]
sysvsem: Fix a typo

Per jamie@ rpr can be NULL if the jail is created with sysvsem=disable.
But at least it doesn't appear to be fatal, since rpr is never dereferenced
but is only compared to other prison pointers.

Reviewed by: jamie
Differential revision: https://reviews.freebsd.org/D35198
MFC after: 2 weeks

2 years agosysvsem: Style(9)
Dmitry Chagin [Sat, 14 May 2022 11:06:58 +0000 (14:06 +0300)]
sysvsem: Style(9)

MFC after: 2 weeks

2 years agosysvsem: Trim traiing whitespace
Dmitry Chagin [Sat, 14 May 2022 11:06:40 +0000 (14:06 +0300)]
sysvsem: Trim traiing whitespace

MFC after: 2 weeks

2 years agolibm: Add feenableexcept and fedisableexcept to library on powerpc
Justin Hibbits [Fri, 13 May 2022 22:18:25 +0000 (17:18 -0500)]
libm: Add feenableexcept and fedisableexcept to library on powerpc

Summary:
These functions are missing from the library itself, and exist solely in
the header.  This breaks a few ports that expect libm to have the
symbols in the library itself.

Questions on MFC-ability: Can this be MFC'd to 13.2, and how?

Reviewers: imp, emaste, kib

Reviewed By: kib

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

2 years agosysv test: properly wait for children
Eric van Gyzen [Thu, 12 May 2022 14:50:02 +0000 (09:50 -0500)]
sysv test: properly wait for children

In the msg and shm tests, if the child exited before the parent
entered sigsuspend(), the test would hang and time out.  This was
also a problem in the sem test, but the misuse of atf_tc_pass()
masked it.  Adding a short sleep before the sigsuspend() calls made
the hang 100% reliable.  With the same sleep in the new version,
the test passes reliably.

Remove calls to atf_tc_pass().  The call in the sem test broke the test
by exiting prematurely, after only one child out of five had finished.
The other two were harmless but unhelpful.

Reduce a one-second sleep to a more reasonable duration so I can quickly
run many iterations of the test.

Where feasible, assert that wait() returns the child PID.  While I'm here,
use the more succinct ATF_REQUIRE* instead of if/atf_tc_fail/else.

Flush stdout before forking to avoid double-flush.

Use errx() when errno is irrelevant.

Don't use ATF_REQUIRE* in children.  Apparently, the output doesn't
get saved.  The exit status works, so it fails correctly, but silently.

Re-enable the test in CI.

PR: 233649
Reviewed by: markj (previous version)
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D35187

2 years agoipfw.8: spell "layer2" consistently throughout the manual page
Eugene Grosbein [Fri, 13 May 2022 21:30:29 +0000 (04:30 +0700)]
ipfw.8: spell "layer2" consistently throughout the manual page

MFC after: 1 week

2 years agombuf: remove PH_vt alias for mbuf packet header persistent shared data
Gleb Smirnoff [Fri, 13 May 2022 20:32:43 +0000 (13:32 -0700)]
mbuf: remove PH_vt alias for mbuf packet header persistent shared data

Mechanical sed change s/PH_vt\.vt_nrecs/vt_nrecs/g

2 years agortsock: fix a stack overflow
Kurosawa Takahiro [Fri, 13 May 2022 17:58:11 +0000 (19:58 +0200)]
rtsock: fix a stack overflow

struct sockaddr is not sufficient for buffer that can hold any
sockaddr_* structure. struct sockaddr_storage should be used.

Test:
ifconfig epair create
ifconfig epair0a inet6 add 2001:db8::1 up
ndp -s 2001:db8::2 02:86:98:2e:96:0b proxy # this triggers kernel stack overflow

Reviewed by: markj, kp
Differential Revision: https://reviews.freebsd.org/D35188

2 years agofusefs tests: Remove an unused variable.
Dmitry Chagin [Fri, 13 May 2022 17:52:14 +0000 (20:52 +0300)]
fusefs tests: Remove an unused variable.

Reviewed by: asomers
Differential revision: https://reviews.freebsd.org/D35185
MFC after: 2 weeks

2 years agobsdinstall: allow whitelabeling the installer
Brad Davis [Fri, 13 May 2022 16:35:43 +0000 (10:35 -0600)]
bsdinstall: allow whitelabeling the installer

Override OSNAME to change the name of the OS in the installer.

This is a first step, the shell changes will be separate.

Reviewed by: allanjude
Approved by: allanjude
Differential Revision: https://reviews.freebsd.org/D34878
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agobsdinstall: add missing init of fd variable
Brad Davis [Fri, 13 May 2022 15:06:02 +0000 (09:06 -0600)]
bsdinstall: add missing init of fd variable

Missed breaking this commit into smaller pieces

Approved by: kp

2 years agobsdinstall: Filter out devices that cannot be opened
Brad Davis [Fri, 13 May 2022 14:33:21 +0000 (08:33 -0600)]
bsdinstall: Filter out devices that cannot be opened

Devices that cannot be opened are most likely the install media and
should not be listed as destinations.

Reviewed by: allanjude
Approved by: allanjude
Differential Revision: https://reviews.freebsd.org/D34879
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agokerneldump: remove physical from dump routines
Mitchell Horne [Fri, 13 May 2022 13:40:05 +0000 (10:40 -0300)]
kerneldump: remove physical from dump routines

It is unused, especially now that the underlying d_dumper methods do not
accept the argument.

Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35174

2 years agokerneldump: remove physical argument from d_dumper
Mitchell Horne [Fri, 13 May 2022 13:39:29 +0000 (10:39 -0300)]
kerneldump: remove physical argument from d_dumper

The physical address argument is essentially ignored by every dumper
method. In addition, the dump routines don't actually pass a real
address; every call to dump_append() passes a value of zero for
physical.

Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35173

2 years agoDrop d_dump from struct cdevsw
Mitchell Horne [Fri, 13 May 2022 13:38:54 +0000 (10:38 -0300)]
Drop d_dump from struct cdevsw

It appears to be unused. These days struct disk has a d_dump member,
which is what gets passed to the kernel dump framework.

Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35172

2 years agoarm64: disable the EL2 MMU before dropping to EL1
Kyle Evans [Fri, 13 May 2022 03:03:32 +0000 (22:03 -0500)]
arm64: disable the EL2 MMU before dropping to EL1

An earlier stage may have set HCR_EL2.E2H, the clearing of which may
break address translation.  We don't need the EL2 MMU at this point, so
we can avoid re-enabling it for now and just drop to EL1 as usual.

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

2 years agosockets: fix build, convert missed sbreserve_locked() calls
Gleb Smirnoff [Thu, 12 May 2022 21:27:45 +0000 (14:27 -0700)]
sockets: fix build, convert missed sbreserve_locked() calls

Fixes: 4328318445ae

2 years agofusefs: handle evil servers that return illegal inode numbers
Alan Somers [Wed, 4 May 2022 23:36:17 +0000 (17:36 -0600)]
fusefs: handle evil servers that return illegal inode numbers

* If during FUSE_CREATE, FUSE_MKDIR, etc the server returns the same
  inode number for the new file as for its parent directory, reject it.
  Previously this would triggers a recurse-on-non-recursive lock panic.

* If during FUSE_LINK the server returns a different inode number for
  the new name as for the old one, reject it.  Obviously, that can't be
  a hard link.

* If during FUSE_LOOKUP the server returns the same inode number for the
  new file as for its parent directory, reject it.  Nothing good can
  come of this.

PR: 263662
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 2 weeks
Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D35128

2 years agofusefs: make the mknod.cc tests a bit more general.
Alan Somers [Tue, 3 May 2022 22:53:20 +0000 (16:53 -0600)]
fusefs: make the mknod.cc tests a bit more general.

MFC after:      2 weeks
Reviewed by:    pfg

2 years agounix: microoptimize unp_connectat() - one less lock on success
Gleb Smirnoff [Thu, 12 May 2022 20:22:39 +0000 (13:22 -0700)]
unix: microoptimize unp_connectat() - one less lock on success

This change is also a preparation for further optimization to
allow locked return on success.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35182

2 years agounix: make unp_connect2() void
Gleb Smirnoff [Thu, 12 May 2022 20:22:39 +0000 (13:22 -0700)]
unix: make unp_connect2() void

Assert that sockets are of the same type.  unp_connectat() already did
this check.  Add the check to uipc_connect2().

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35181

2 years agosockets: use socket buffer mutexes in struct socket directly
Gleb Smirnoff [Thu, 12 May 2022 20:22:12 +0000 (13:22 -0700)]
sockets: use socket buffer mutexes in struct socket directly

Since c67f3b8b78e the sockbuf mutexes belong to the containing socket,
and socket buffers just point to it.  In 74a68313b50 macros that access
this mutex directly were added.  Go over the core socket code and
eliminate code that reaches the mutex by dereferencing the sockbuf
compatibility pointer.

This change requires a KPI change, as some functions were given the
sockbuf pointer only without any hint if it is a receive or send buffer.

This change doesn't cover the whole kernel, many protocols still use
compatibility pointers internally.  However, it allows operation of a
protocol that doesn't use them.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35152

2 years agopf: fix pf_rule_to_actions()
Kristof Provost [Wed, 11 May 2022 16:51:21 +0000 (18:51 +0200)]
pf: fix pf_rule_to_actions()

If we already had a pipe set in the actions struct we need to take care
to clear the flag if we're overwriting it with a queue.

This can happen if we've got Ethernet rules setting a dummynet pipe.
It does this indirectly, by adding the dummynet information to a pf_mtag
associated with the mbuf.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf tests: test dummynet on route-to'd packets
Kristof Provost [Mon, 9 May 2022 10:36:53 +0000 (12:36 +0200)]
pf tests: test dummynet on route-to'd packets

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35161

2 years agopf tests: factor out common dummynet check
Kristof Provost [Mon, 9 May 2022 10:14:00 +0000 (12:14 +0200)]
pf tests: factor out common dummynet check

Reviewed by: glebius
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35160

2 years agopf: tag dummynet'd route-to packets with their real destination
Kristof Provost [Tue, 10 May 2022 07:23:36 +0000 (09:23 +0200)]
pf: tag dummynet'd route-to packets with their real destination

If we delay route-to/dup-to/reply-to through dummynet we are eventually
returned to pf_test(). At that point we no longer have the context for
the route-to destination. We'd just skip the pf_test() and continue
processing. This means that route-to did not work as expected.

Extend pf_mtag to carry the route-to destination so we can apply it when
we re-enter pf_test().

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35159

2 years agopf: also apply dummynet to route-to/dup-to packets
Kristof Provost [Mon, 9 May 2022 09:11:42 +0000 (11:11 +0200)]
pf: also apply dummynet to route-to/dup-to packets

If packets are processed by a route-to/dup-to/reply-to rule (i.e. they
pass through pf_route(6)) dummynet was not applied to them.
This is because pf_route(6) passes packets directly to ifp->if_output(),
so the dummynet functions were never called.

Factor out the dummynet code and call dummynet prior to
ifp->if_output(). This has a secondary benefit of reducing some code
duplication between the IPv4 and IPv6 paths.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35158

2 years agosqlite3: Vendor import of sqlite3 3.38.5
Cy Schubert [Thu, 12 May 2022 19:25:36 +0000 (12:25 -0700)]
sqlite3: Vendor import of sqlite3 3.38.5

Changes at https://www.sqlite.org/releaselog/3_38_5.html.

Obtained from https://www.sqlite.org/2022/sqlite-autoconf-3380500.tar.gz.

Merge commit 'b562e59e27efbea397bdc8782dfceaa3c0e23542'

2 years agotests: Get rid of invalid since 3e11d3f6 testcase
Dmitry Chagin [Thu, 12 May 2022 19:14:41 +0000 (22:14 +0300)]
tests: Get rid of invalid since 3e11d3f6 testcase

MFC after: 2 weeks

2 years agounix/dgram: uipc_listen() is specific for SOCK_STREAM and SOCK_SEQPACKET
Gleb Smirnoff [Thu, 12 May 2022 18:04:40 +0000 (11:04 -0700)]
unix/dgram: uipc_listen() is specific for SOCK_STREAM and SOCK_SEQPACKET

Rely on pr_usrreqs_init() to init SOCK_DGRAM to pru_listen_notsupp().

2 years agounix/dgram: pru_rcvd never called since PR_WANTRCVD not set
Gleb Smirnoff [Thu, 12 May 2022 18:04:40 +0000 (11:04 -0700)]
unix/dgram: pru_rcvd never called since PR_WANTRCVD not set

2 years agosockets: delete stale comment from sofree()
Gleb Smirnoff [Thu, 12 May 2022 18:02:50 +0000 (11:02 -0700)]
sockets: delete stale comment from sofree()

First  paragraph refers to old past "we used to" and is no longer
important today.  Second paragraph has just a wrong statement that
socket buffer is destroyed before pru_detach.