]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agolivedump: add event handler hooks
Mitchell Horne [Thu, 6 Jan 2022 19:40:16 +0000 (15:40 -0400)]
livedump: add event handler hooks

Add three hooks to the livedump process: before, after, and for each
block of dumped data. This allows, for example, quiescing the system
before the dump begins or protecting data of interest to ensure its
consistency in the final output.

Reviewed by: markj, kib (previous version)
Reviewed by: debdrup (manpages)
Reviewed by: Pau Amma <pauamma@gundo.com> (manpages)
MFC after: 3 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34067

(cherry picked from commit eb9d205fa6918bad40bdbf66fe3d52931ae3d6ce)

2 years agoAdd new vnode dumper to support live minidumps
Mitchell Horne [Tue, 23 Mar 2021 20:47:14 +0000 (17:47 -0300)]
Add new vnode dumper to support live minidumps

This dumper can instantiate and write the dump's contents to a
file-backed vnode.

Unlike existing disk or network dumpers, the vnode dumper should not be
invoked during a system panic, and therefore is not added to the global
dumper_configs list. Instead, the vnode dumper is constructed ad-hoc
when a live dump is requested using the new ioctl on /dev/mem. This is
similar in spirit to a kgdb session against the live system via
/dev/mem.

As described briefly in the mem(4) man page, live dumps are not
guaranteed to result in a usuable output file, but offer some debugging
value where forcefully panicing a system to dump its memory is not
desirable/feasible.

A future change to savecore(8) will add an option to save a live dump.

Reviewed by: markj, Pau Amma <pauamma@gundo.com> (manpages)
Discussed with: kib
MFC after: 3 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D33813

(cherry picked from commit c9114f9f86f92742eacd1d802c34009a57e81055)

2 years agoSplit out dumper allocation from list insertion
Mitchell Horne [Mon, 9 Aug 2021 17:21:07 +0000 (14:21 -0300)]
Split out dumper allocation from list insertion

Add a new function, dumper_create(), to allocate a dumper.
dumper_insert() will call this function and retains the existing
behaviour.

This is desirable for performing live dumps of the system. Here, there
is a need to allocate and configure a dumper structure that is invoked
outside of the typical debugger context. Therefore, it should be
excluded from the list of panic-time dumpers.

free_single_dumper() is made public and renamed to dumper_destroy().

Reviewed by: kib, markj
MFC after: 1 week
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34068

(cherry picked from commit 59c27ea18c32f5db2c2f9e8213b3ed4219e70704)

2 years agonetdump: send key before dump, in case dump fails
Eric van Gyzen [Fri, 6 Aug 2021 15:38:51 +0000 (10:38 -0500)]
netdump: send key before dump, in case dump fails

Previously, if an encrypted netdump failed, such as due to a timeout or
network failure, the key was not saved, so a partial dump was
completely useless.

Send the key first, so the partial dump can be decrypted, because even a
partial dump can be useful.

Reviewed by: bdrewery, markj
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D31453

(cherry picked from commit 13a58148de1730f851d37513913fae547e53a512)

2 years agonetdump: Fix leaking debugnet state on errors.
Bryan Drewery [Mon, 26 Jul 2021 23:27:07 +0000 (16:27 -0700)]
netdump: Fix leaking debugnet state on errors.

Reviewed by: cem, markj
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D31319

(cherry picked from commit a573243370d3f4ffad81c740591004851f2beb45)

2 years agokevent.2: Add an xref to listen.2
Mark Johnston [Mon, 20 Jun 2022 16:19:40 +0000 (12:19 -0400)]
kevent.2: Add an xref to listen.2

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6405997f45974bf6d25412f03c069ae048d74d51)

2 years agobpf: Correct a comment
Mark Johnston [Mon, 20 Jun 2022 16:02:59 +0000 (12:02 -0400)]
bpf: Correct a comment

Sponsored by: The FreeBSD Foundation

(cherry picked from commit c88f6908b40ce1bc0450db71f7fde141951d4c44)

2 years agobpf: Zero pad bytes preceding BPF headers
Mark Johnston [Mon, 20 Jun 2022 16:03:37 +0000 (12:03 -0400)]
bpf: Zero pad bytes preceding BPF headers

BPF headers are word-aligned when copied into the store buffer.  Ensure
that pad bytes following the preceding packet are cleared.

Reported by: KMSAN
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 60b4ad4b6b561ac2d9129a3576a74db3607ad90c)

2 years agorc.conf.5: Add missing Ns macros
Mateusz Piotrowski [Fri, 24 Jun 2022 09:31:56 +0000 (11:31 +0200)]
rc.conf.5: Add missing Ns macros

MFC after: 3 days

(cherry picked from commit 356913f5d8e91d8d17c382bce1ca7c64a6bf9bcd)

2 years agoibcore: Fix sysfs registration error flow
Hans Petter Selasky [Tue, 21 Jun 2022 09:07:06 +0000 (11:07 +0200)]
ibcore: Fix sysfs registration error flow

The kernel commit cited below restructured ib device management
so that the device kobject is initialized in ib_alloc_device.

As part of the restructuring, the kobject is now initialized in
procedure ib_alloc_device, and is later added to the device hierarchy
in the ib_register_device call stack, in procedure
ib_device_register_sysfs (which calls device_add).

However, in the ib_device_register_sysfs error flow, if an error
occurs following the call to device_add, the cleanup procedure
device_unregister is called. This call results in the device object
being deleted -- which results in various use-after-free crashes.

The correct cleanup call is device_del -- which undoes device_add
without deleting the device object.

The device object will then (correctly) be deleted in the
ib_register_device caller's error cleanup flow, when the caller invokes
ib_dealloc_device.

Linux commit:
b312be3d87e4c80872cbea869e569175c5eb0f9a

PR: 264472
Sponsored by: NVIDIA Networking

(cherry picked from commit 55d183367104e3efcdaa936f65e4f82303871271)

2 years agoiommu_gas: restrict tree search to promising paths
Doug Moore [Mon, 6 Jun 2022 21:26:01 +0000 (16:26 -0500)]
iommu_gas: restrict tree search to promising paths

In iommu_gas_lowermatch and iommu_gas_uppermatch, a subtree search is
quickly terminated if the largest available free space in the subtree
is below a limit, where that limit is related to the size of the
allocation request. However, that limit is too small; it does not
account for both of the guard pages that will surround the allocated
space, but only for one of them. Consequently, it permits the search
to proceed through nodes that cannot produce a successful allocation
for all the requested space. Fix that limit to improve search
performance.

Reviewed by: alc, kib
Submitted by: Weixi Zhu (wxzhu@rice.edu)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35414

(cherry picked from commit b831865fe3b8f66281b39a9cb567c92dc285a1da)

2 years agobusdma_iommu: simplify split logic
Doug Moore [Thu, 2 Jun 2022 20:59:57 +0000 (15:59 -0500)]
busdma_iommu: simplify split logic

iommu_bus_dmamap_load_something1 includes code for handling the
possibility of splitting a buffer that is needlessly complex.
Simplify it.

Reviewed by: alc, kib
MFC after: 3 weeks
Tested by: pho (previous revisions)
Differential Revision: https://reviews.freebsd.org/D35232

(cherry picked from commit 04e86ae357b21fce238a90f31198b25975d0f479)

2 years agotest_diskread(): detect end of the disk
Toomas Soome [Wed, 1 Jun 2022 07:28:43 +0000 (10:28 +0300)]
test_diskread(): detect end of the disk

Detect the end of the disk condition. This may happpen when
disk image is truncated and the reads are addressing blocks past
image end.

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

(cherry picked from commit 942e52f776e6bbe016a3e920c96a1cd4dbddf7e3)

2 years agoloader.efi: fix panic() after BS off
Toomas Soome [Wed, 8 Sep 2021 00:14:51 +0000 (03:14 +0300)]
loader.efi: fix panic() after BS off

panic() is using multiple services - attempting to read
keyboard, accessing time functions and finally, exiting the loader.

Protect all the accessed listed above. Note, when BS are off,
we really can not just exit the loader, we only can reboot.

(cherry-picked from commit a2e02d9d8e100bc41cf99b8fd04738954e48a94e)

2 years agoloader: abstract boot services exiting to libefi function
Warner Losh [Sun, 21 Nov 2021 16:05:07 +0000 (09:05 -0700)]
loader: abstract boot services exiting to libefi function

Move direct call of ExitBootServices to efi_exit_boot_services.  This
function sets boot_services_active to false so callers don't have to do
it everywhere (though currently only loader/bootinfo.c is affected).

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32226

(cherry picked from commit 77e3db07898461de458caece30f42adceff222a9)

2 years agoefi: switch boot_services_gone to boot_services_active
Warner Losh [Thu, 4 Nov 2021 15:34:20 +0000 (09:34 -0600)]
efi: switch boot_services_gone to boot_services_active

Turn the presence or absence of boot services into a positive bool (and
change its type to bool). Move declaration to efi.h in the global
variables section.

Sponsored by: Netflix

Reviewed by: tsoome, kib
Differential Revision: https://reviews.freebsd.org/D31814

(cherry picked from commit 305ef653bcf349c7dea83c90add6f2d97910e545)

2 years agouserboot is missing vdisk_dev
Toomas Soome [Thu, 9 Jun 2022 06:56:19 +0000 (09:56 +0300)]
userboot is missing vdisk_dev

Add vdisk device support in userboot configuration.

(cherry picked fromcommit e368fb6eb6eb3041fa9f4c608377ddf90d33f11e)

2 years agowpa: Disable P2P in WPS
Cy Schubert [Thu, 23 Jun 2022 03:51:27 +0000 (20:51 -0700)]
wpa: Disable P2P in WPS

Disable P2P in WPS as it is not supported by FreeBSD. Also, it is not
enabled in wpa_supplicant so the WPS P2P code is redundant.

PR: 264238
Reported by: adrian

(cherry picked from commit 3e8eb5c7f4909209c042403ddee340b2ee7003a5)

2 years agowpa: Restore missing patch
Cy Schubert [Mon, 20 Jun 2022 14:21:55 +0000 (07:21 -0700)]
wpa: Restore missing patch

In December after a failed MFV due to a now understood issue I had with
git -- git aborts with extremely large MFV -- this patch was removed
during the revert. Restore this patch.

PR: 264238
Fixes: 4b72b91a7132df1f77bbae194e1071ac621f1edb

(cherry picked from commit 3b2956781048f300c081952150d515573a274620)

2 years agozfs: merge openzfs/zfs@6c3c5fcfb (zfs-2.1-release) into stable/13
Martin Matuska [Sat, 25 Jun 2022 07:13:20 +0000 (09:13 +0200)]
zfs: merge openzfs/zfs@6c3c5fcfb (zfs-2.1-release) into stable/13

OpenZFS release 2.1.5

Notable upstream pull requeset merges:
  #12575 Reject zfs send -RI with nonexistent fromsnap
  #12687 Skip spacemaps reading in case of pool readonly import
  #12746 Default to zfs_dmu_offset_next_sync=1
  #13277 FreeBSD: Use NDFREE_PNBUF if available
  #13311 Fix error handling in FreeBSD's get/putpages VOPs
  #13345 FreeBSD: Fix translation from ABD to physical pages
  #13373 zfs: holds: dequadratify
  #13375 Corrected edge case in uncompressed ARC->L2ARC handling
  #13405 Reduce dbuf_find() lock contention
  #13406 FreeBSD: use zero_region instead of allocating a dedicated page
  #13499 zed: Take no action on scrub/resilver checksum errors
  #13484 FreeBSD: libspl: Add locking around statfs globals
  #13513 Remove wrong assertion in log spacemap
  #13537 Improve sorted scan memory accounting

Obtained from: OpenZFS
OpenZFS tag: zfs-2.1.5
OpenZFS commit: 6c3c5fcfbe27d9193cd131753cc7e47ee2784621
Relnotes: yes

2 years agostruct kinfo_file changes needed for lsof to work using only usermode APIs`
Damjan Jovanovic [Fri, 17 Jun 2022 13:37:40 +0000 (16:37 +0300)]
struct kinfo_file changes needed for lsof to work using only usermode APIs`

(cherry picked from commit 8c309d48aabf1cb469334c7716033f177a2715c0)

2 years agoKERN_LOCKF: report kl_file_fsid consistently with stat(2)
Damjan Jovanovic [Fri, 17 Jun 2022 13:28:16 +0000 (16:28 +0300)]
KERN_LOCKF: report kl_file_fsid consistently with stat(2)

PR: 264723

(cherry picked from commit 8ae769491303715c68e79aaf0e4e2f5c639151f9)

2 years agoreap_kill_proc(): avoid singlethreading any other process if we are exiting
Konstantin Belousov [Mon, 16 May 2022 23:47:20 +0000 (02:47 +0300)]
reap_kill_proc(): avoid singlethreading any other process if we are exiting

Tested by: pho (whole series MFC)

(cherry picked from commit 1575804961d2ba1768c9a6b28438d364421718f3)

2 years agoreap_kill_subtree(): hold the reaper when entering it into the queue to handle later
Konstantin Belousov [Sun, 15 May 2022 22:52:09 +0000 (01:52 +0300)]
reap_kill_subtree(): hold the reaper when entering it into the queue to handle later

(cherry picked from commit e0343eacf36588bf503c7a59c0cc436294223839)

2 years agoreap_kill_subtree_once(): handle proctree_lock unlock in reap_kill_proc()
Konstantin Belousov [Mon, 9 May 2022 21:41:23 +0000 (00:41 +0300)]
reap_kill_subtree_once(): handle proctree_lock unlock in reap_kill_proc()

(cherry picked from commit 1d4abf2cfa6e71f4e29ab1f1a6d366d11f3d6027)

2 years agoreap_kill_proc: do not retry on thread_single() failure
Konstantin Belousov [Tue, 3 May 2022 19:49:37 +0000 (22:49 +0300)]
reap_kill_proc: do not retry on thread_single() failure

(cherry picked from commit addf103ce6b38583762bcb066f6ac3b160e826bb)

2 years agoMake stop_all_proc_block interruptible to avoid deadlock with parallel suspension
Konstantin Belousov [Sat, 30 Apr 2022 23:29:25 +0000 (02:29 +0300)]
Make stop_all_proc_block interruptible to avoid deadlock with parallel suspension

(cherry picked from commit 008b2e65442a0d65bc5be9ca625616ddfa6f9ce2)

2 years agothread_single_end(): consistently maintain p_boundary_count for ALLPROC mode
Mark Johnston [Thu, 9 Jun 2022 04:17:32 +0000 (07:17 +0300)]
thread_single_end(): consistently maintain p_boundary_count for ALLPROC mode

(cherry picked from commit 2d5ef216b679e0a8d9958f8ce2e2bfc021f5d252)

2 years agothread_unsuspend(): do not unuspend the suspended leader thread doing SINGLE_ALLPROC
Konstantin Belousov [Wed, 8 Jun 2022 01:27:30 +0000 (04:27 +0300)]
thread_unsuspend(): do not unuspend the suspended leader thread doing SINGLE_ALLPROC

(cherry picked from commit 1b4701fe1e840f9ce5dae557b4dd99bda8a85735)

2 years agothread_single(): remove already checked conditional expression
Konstantin Belousov [Thu, 12 May 2022 11:47:40 +0000 (14:47 +0300)]
thread_single(): remove already checked conditional expression

(cherry picked from commit b9009b1789b4641f5dbc9537eb0ca4759e22668e)

2 years agoDo not single-thread itself when the process single-threaded some another process
Konstantin Belousov [Sun, 15 May 2022 21:55:32 +0000 (00:55 +0300)]
Do not single-thread itself when the process single-threaded some another process

(cherry picked from commit 4493a13e3bfbbdf8488993843281ec688057ee0f)

2 years agoweed_inhib(): correct the condition to re-suspend a thread
Konstantin Belousov [Tue, 10 May 2022 23:37:58 +0000 (02:37 +0300)]
weed_inhib(): correct the condition to re-suspend a thread

(cherry picked from commit dd883e9a7e8045d86774fa3f944b53a4f78d0fd0)

2 years agoweed_inhib(): do not double-suspend already suspended thread if the loop reiterates
Konstantin Belousov [Sat, 30 Apr 2022 23:30:13 +0000 (02:30 +0300)]
weed_inhib(): do not double-suspend already suspended thread if the loop reiterates

(cherry picked from commit b9893b353312cc3c75a0ab2ff7ca69dc55864bea)

2 years agothread_single: wait for P_STOPPED_SINGLE to pass
Konstantin Belousov [Tue, 3 May 2022 19:48:50 +0000 (22:48 +0300)]
thread_single: wait for P_STOPPED_SINGLE to pass

(cherry picked from commit d7a9e6e74067f70eeec74dcd64a9bcc851503a6e)

2 years agoissignal(): ignore signals when process is single-threading for exit
Konstantin Belousov [Thu, 26 May 2022 19:18:57 +0000 (22:18 +0300)]
issignal(): ignore signals when process is single-threading for exit

(cherry picked from commit 02a2aacbe2c81be455811fa9d4200101f70a86d2)

2 years agoP2_WEXIT: avoid thread_single() for exiting process earlier
Konstantin Belousov [Wed, 4 May 2022 23:57:26 +0000 (02:57 +0300)]
P2_WEXIT: avoid thread_single() for exiting process earlier

(cherry picked from commit d3000939c7b94fc887f23dd8946861cf0fa1b73b)

2 years agoFix another race between fork(2) and PROC_REAP_KILL subtree
Konstantin Belousov [Thu, 21 Apr 2022 22:39:58 +0000 (01:39 +0300)]
Fix another race between fork(2) and PROC_REAP_KILL subtree

(cherry picked from commit 709783373e57069cc014019a14a806b580e1d62f)

2 years agoFix a race between fork(2) and PROC_REAP_KILL subtree
Konstantin Belousov [Wed, 20 Apr 2022 21:33:51 +0000 (00:33 +0300)]
Fix a race between fork(2) and PROC_REAP_KILL subtree

(cherry picked from commit 39794d80ad900915e5c4940e9917ba5cb59a8634)

2 years agokern_procctl: add possibility to take stop_all_proc_block() around exec
Konstantin Belousov [Wed, 27 Apr 2022 21:18:34 +0000 (00:18 +0300)]
kern_procctl: add possibility to take stop_all_proc_block() around exec

(cherry picked from commit d1df34736888f43e8fe1cdc460eac134d625c777)

2 years agoAdd stop_all_proc_block(9)
Konstantin Belousov [Sat, 23 Apr 2022 22:55:04 +0000 (01:55 +0300)]
Add stop_all_proc_block(9)

(cherry picked from commit 2e7595ef2f53f6debec3c3d89bb9e0cd10394ed3)

2 years agoreap_kill(): split children and subtree killers into helpers
Konstantin Belousov [Wed, 20 Apr 2022 21:12:05 +0000 (00:12 +0300)]
reap_kill(): split children and subtree killers into helpers

(cherry picked from commit 54a11adbd9c2b1fa9b42181ac883ed6ed2a6998c)

2 years agoreap_kill(): rename the reap variable to reaper
Konstantin Belousov [Mon, 25 Apr 2022 22:10:16 +0000 (01:10 +0300)]
reap_kill(): rename the reap variable to reaper

(cherry picked from commit 134529b11b5343aed09e220b49147873d052e4bf)

2 years agoreap_kill(): de-inline LIST_FOREACH(), twice
Konstantin Belousov [Mon, 25 Apr 2022 21:57:13 +0000 (00:57 +0300)]
reap_kill(): de-inline LIST_FOREACH(), twice

(cherry picked from commit e4ce431e2a0255751fee0ad14b08bd006759ce4f)

2 years agoreaper_abandon_children(): upgrade proctree_lock assert to exclusive
Konstantin Belousov [Tue, 26 Apr 2022 14:44:48 +0000 (17:44 +0300)]
reaper_abandon_children(): upgrade proctree_lock assert to exclusive

(cherry picked from commit b9294a3e152b2524497678c8089e2c4abbdceb31)

2 years agovmm: move bumping VMEXIT_USERSPACE stat to the right place
Vitaliy Gusev [Thu, 9 Jun 2022 12:57:25 +0000 (08:57 -0400)]
vmm: move bumping VMEXIT_USERSPACE stat to the right place

Statistic for "number of vm exits handled in userspace" should be
increased in vm_run() instead of vmx_run() because in some cases
vm_run() doesn't exit to userspace and keeps entering the guest.

Also svm_run's implementation even wrongly misses that stat.

Reviewed by: markj

(cherry picked from commit e7d34aeda4e6fba68343dfcaf5e4aeed83a0ec87)

2 years agopam_exec: fix segfault when authtok is null
Yan Ka Chiu [Sun, 22 May 2022 16:33:02 +0000 (12:33 -0400)]
pam_exec: fix segfault when authtok is null

According to pam_exec(8), the `expose_authtok` option should be ignored
when the service function is `pam_sm_setcred`. Currently `pam_exec` only
prevent prompt for anth token when `expose_authtok` is set on
`pam_sm_setcred`. This subsequently led to segfault when there isn't an
existing auth token available.

Bug reported on this: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263893

After reading https://reviews.freebsd.org/rS349556 I am not sure if the
default behaviour supposed to be simply not prompt for authentication
token, or is it to ignore the option entirely as stated in the man page.

This patch is therefore only adding an additional NULL check on the item
`pam_get_item` provide, and exit with `PAM_SYSTEM_ERR` when such item is
NULL.

MFC after: 1 week
Reviewed by: des, khng
Differential Revision: https://reviews.freebsd.org/D35169

(cherry picked from commit b75e0eed345d2ab047a6b1b00a9a7c3bf92e992c)

2 years agomodules: Only build MAC modules if options MAC is set
Mitchell Horne [Tue, 14 Jun 2022 16:07:30 +0000 (13:07 -0300)]
modules: Only build MAC modules if options MAC is set

They are not loadable otherwise.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35369

(cherry picked from commit 648a47b85476ed0f8e3c61800b134bd3bb6001ee)

2 years agoddb: namespacing of struct command
Mitchell Horne [Tue, 14 Jun 2022 16:09:11 +0000 (13:09 -0300)]
ddb: namespacing of struct command

'command' is too generic for something specific to the kernel debugger;
change this so it is less likely to collide with local variable names.
Also rename struct command_table to struct db_command_table.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35367

(cherry picked from commit 4ef7db5a7e5c06cd8788e6f653ee955ace44b6c9)

2 years agoUse KERNEL_PANICKED() in more places
Mitchell Horne [Thu, 2 Jun 2022 13:14:41 +0000 (10:14 -0300)]
Use KERNEL_PANICKED() in more places

This is slightly more optimized than checking panicstr directly. For
most of these instances performance doesn't matter, but let's make
KERNEL_PANICKED() the common idiom.

Reviewed by: mjg
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D35373

(cherry picked from commit 35eb9b10c265a27ce1f80a6eb74887240c7f4305)

2 years agoObsoleteFiles.inc: fixup after zpool-features.7.gz got re-introduced
Martin Matuska [Sun, 27 Jun 2021 00:53:51 +0000 (02:53 +0200)]
ObsoleteFiles.inc: fixup after zpool-features.7.gz got re-introduced

PR: 256852
MFC after: 3 days

(cherry picked from commit 2be4a7d508b02a980904378ca7c798fdf8c300d5)

2 years agorelease: arm - increase IMAGE_SIZE
Glen Barber [Wed, 22 Jun 2022 18:23:39 +0000 (14:23 -0400)]
release: arm - increase IMAGE_SIZE

For some reason, while 3072M is sufficient for 14-CURRENT, it is not
for 13-STABLE.  Notably, previous investigations suggest that there
are changes to makefs(8) in main that do not exist in stable/13,
in which 14-CURRENT seems perfectly happy to ignore the target image
size is smaller than the data being populated to it.

I have no futher investigative details at the moment, but as this had
caused arm failures for the past three weeks, this is the more hasty
measure, hence the MFC timeframe noted.

MFC after: 10 minutes
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit cf83038cec6874aafacf56a1cac531d079af016b)

2 years agoarm64: Print per-CPU cache summary
Justin Hibbits [Mon, 13 Jun 2022 19:04:29 +0000 (14:04 -0500)]
arm64: Print per-CPU cache summary

Summary:
It can be useful to see a summary of CPU caches on bootup.  This is done
for most platforms already, so add this to arm64, in the form of (taken
from Apple M1 pro test):

  L1 cache: 192KB (instruction), 128KB (data)
  L2 cache: 12288KB (unified)

This is printed out per-CPU, only under bootverbose.

Future refinements could instead determine if a cache level is shared
with other cores (L2 is shared among cores on some SoCs, for instance),
and perform a better calculation to the full true cache sizes.  For
instance, it's known that the M1 pro, on which this test was done, has 2
12MB L2 clusters, for a total of 24MB.  Seeing each CPU with 12288KB L2
would make one think that there's 12MB * NCPUs, for possibly 120MB
cache, which is incorrect.

Sponsored by: Juniper Networks, Inc.
Reviewed by: #arm64, andrew
Differential Revision: https://reviews.freebsd.org/D35366

(cherry picked from commit 139ba152c9c91fad9b63ccd2382a80f753f217b9)

2 years agolinux: plug a set-but-not-used var
Mateusz Guzik [Tue, 19 Apr 2022 12:29:46 +0000 (12:29 +0000)]
linux: plug a set-but-not-used var

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

(cherry picked from commit 93494e425b95e3b08e11389c877b71298b6a244e)

2 years agoTag zfs-2.1.5
Tony Hutter [Tue, 21 Jun 2022 17:55:02 +0000 (10:55 -0700)]
Tag zfs-2.1.5

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
2 years agoOpenSSL: Regen manual pages for OpenSSL 1.1.1p
Jung-uk Kim [Tue, 21 Jun 2022 18:22:28 +0000 (14:22 -0400)]
OpenSSL: Regen manual pages for OpenSSL 1.1.1p

(cherry picked from commit b4bdc8f9253d9db46f598f17cc546c2fe0f8038d)

2 years agoOpenSSL: Regen assembly file for OpenSSSL 1.1.1p
Jung-uk Kim [Tue, 21 Jun 2022 18:20:33 +0000 (14:20 -0400)]
OpenSSL: Regen assembly file for OpenSSSL 1.1.1p

(cherry picked from commit ec4d9b059ededda578be479c1d043c921907ed11)

2 years agoOpenSSL: Merge OpenSSL 1.1.1p
Jung-uk Kim [Tue, 21 Jun 2022 17:33:01 +0000 (13:33 -0400)]
OpenSSL: Merge OpenSSL 1.1.1p

Merge commit '54ae8e38f717f22963c2a87f48af6ecefc6b3e9b'

(cherry picked from commit 83eaf7ae0a7b502de1b08850324b447591bd6916)

2 years agoAdd a whole bunch of missed obsolete manpages to ObsoleteFiles.inc
Dimitry Andric [Mon, 3 May 2021 20:24:27 +0000 (22:24 +0200)]
Add a whole bunch of missed obsolete manpages to ObsoleteFiles.inc

(cherry picked from commit b9ec6f2ef9d6e3783a66e9e954b58226f06f565c)

2 years agoRemove usr/lib/libssp.a.
John Baldwin [Thu, 13 Jan 2022 22:49:14 +0000 (14:49 -0800)]
Remove usr/lib/libssp.a.

GNU's libssp installed this (in addition to libssp_nonshared.a), but
the libc-based libssp does not.

Reviewed by: kevans, emaste
Fixes: cd0d51baaa45 Provide libssp based on libc
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33852

(cherry picked from commit 900a792250c2e8824ce7ebc49fef59ba6e82c9a4)

2 years agoRemove install of zfs-load-module.service for dracut
Matthew Thode [Tue, 21 Jun 2022 17:37:20 +0000 (12:37 -0500)]
Remove install of zfs-load-module.service for dracut

The zfs-load-module.service service is not currently provided by
the OpenZFS repository so we cannot safely assume it exists.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matthew Thode <mthode@mthode.org>
Closes #13574

2 years agoAdd a few missed gnuregex libraries to ObsoleteFiles.inc
Dimitry Andric [Mon, 3 May 2021 20:40:11 +0000 (22:40 +0200)]
Add a few missed gnuregex libraries to ObsoleteFiles.inc

(cherry picked from commit d134e496151e8103ca8acc7bb1696babe07576a7)

2 years agoBump __FreeBSD_version after linuxkpi mfc
Emmanuel Vadot [Tue, 21 Jun 2022 15:23:27 +0000 (17:23 +0200)]
Bump __FreeBSD_version after linuxkpi mfc

2 years agolinuxkpi: Acquire giant when adding/removing i2c adapters
Emmanuel Vadot [Tue, 14 Jun 2022 11:23:26 +0000 (13:23 +0200)]
linuxkpi: Acquire giant when adding/removing i2c adapters

We need Giant as we run in a taskqueue_thread via linux_work.
This fix detaching amdgpu and i915kms.

Reviewed by: bz, hselasky, imp
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35478

(cherry picked from commit d87fad36330b6faf657e7ee8faaa52feeaaff68a)

2 years agolinuxkpi: Rework detach function
Emmanuel Vadot [Fri, 13 May 2022 11:56:36 +0000 (13:56 +0200)]
linuxkpi: Rework detach function

We need to detach the matching i2c adapter so look for the right one.
While here add some locks to protect multiple add/del at the same time.

Fixes: 1961a14a47 ("linuxkpi: Add i2c support")
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 25d21a845223ffad189fd2a7831ebf5e298b628a)

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

(cherry picked from commit f49cddbda67d6f49f1794c93270d3d923140d620)

2 years agolinuxkpi: Remove write only variable from lkpi_iicbb_reset
Warner Losh [Tue, 5 Apr 2022 05:05:52 +0000 (23:05 -0600)]
linuxkpi: Remove write only variable from lkpi_iicbb_reset

Sponsored by: Netflix
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34770

(cherry picked from commit 58e6719ca06991a92b67630b634ddd25a9c2c3bf)

2 years agolinuxkpi: i2c: Add MODULE_DEPEND for iicbus
Emmanuel Vadot [Wed, 26 Jan 2022 09:42:20 +0000 (10:42 +0100)]
linuxkpi: i2c: Add MODULE_DEPEND for iicbus

MFC after: 1 month
MFC with: 1961a14a4743
Fixes: 1961a14a4743 ("linuxkpi: Add i2c support")
Reported by: GregV
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 81de556105b2fb0f85ece868b2289c53b8c3e6ca)

2 years agolinuxkpi: Add i2c support
Emmanuel Vadot [Thu, 4 Nov 2021 09:42:37 +0000 (10:42 +0100)]
linuxkpi: Add i2c support

Add i2c support to linuxkpi. This is needed by drm-kmod.
For every i2c_adapter added by i2c_add_adapter we add a child to the
device named "lkpi_iic". This child handle the conversion between
Linux i2c_msgs to FreeBSD iic_msgs.
For every i2c_adapter added by i2c_bit_add_bus we add a child to the
device named "lkpi_iicbb". This child handle the conversion between
Linux i2c_msgs to FreeBSD iic_msgs.
With the help of iic(4), this expose the i2c controller to userspace
allowing a user to query DDC information from a monitor.
e.g.: i2c -f /dev/iic0 -a 0x28 -c 128 -d r
will query the standard EDID from the monitor if plugged.

The bitbang part (lkpi_iicbb) isn't tested at all for now as I don't have
compatible hardware (all my hardware have native i2c controller).

Tested on: Intel (SandyBridge, Skylake, ApolloLake)
Tested on: AMD (Picasso, Polaris (amd64 and arm64))

MFC after: 1 month
Reviewed by: hselasky
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33053

(cherry picked from commit 1961a14a47437595fb7fcdc20e327440e3eb51e2)

2 years agoCreate wrapper for Giant taken for newbus
Warner Losh [Fri, 10 Dec 2021 00:04:45 +0000 (17:04 -0700)]
Create wrapper for Giant taken for newbus

Create a wrapper for newbus to take giant and for busses to take it too.
bus_topo_lock() should be called before interacting with newbus routines
and unlocked with bus_topo_unlock(). If you need the topology lock for
some reason, bus_topo_mtx() will provide that.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D31831

(cherry picked from commit c6df6f5322f7004c71216391e1c0b374d853704a)

2 years agorip6: Fix a lock order reversal in rip6_bind()
Mark Johnston [Tue, 14 Jun 2022 15:27:38 +0000 (11:27 -0400)]
rip6: Fix a lock order reversal in rip6_bind()

See also commit 71a1539e3783.

Reported by: syzbot+9b461b6a07a83cc10daa@syzkaller.appspotmail.com
Reported by: syzbot+b6ce0aec16f5fdab3282@syzkaller.appspotmail.com
Reviewed by: glebius
Sponsored by: The FreeBSD Foundation

(cherry picked from commit a14465e1b9a53d6abf58f42e113c1888ffeebe42)

2 years agovm_object: Use the vm_object_(set|clear)_flag() helpers
Mark Johnston [Tue, 14 Jun 2022 15:35:20 +0000 (11:35 -0400)]
vm_object: Use the vm_object_(set|clear)_flag() helpers

... rather than setting and clearing flags inline.  No functional change
intended.

Reviewed by: alc, kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 630f633f2a7618e7726ceb6ff4bff1c442919250)

2 years agonull_vptocnp(): busy nullfs mp instead of refing it
Konstantin Belousov [Fri, 10 Jun 2022 11:35:45 +0000 (14:35 +0300)]
null_vptocnp(): busy nullfs mp instead of refing it

(cherry picked from commit 7fd37611b92b5f365f33435bb725b335c2f10ba8)

2 years agoifconfig.8: reflect removal of FDDI and Token Ring
Zhenlei Huang [Wed, 15 Jun 2022 17:49:27 +0000 (18:49 +0100)]
ifconfig.8: reflect removal of FDDI and Token Ring

Reviewed By: pauamma
Differential Revision: https://reviews.freebsd.org/D35409

(cherry picked from commit 030f3ee99583bc367b37c43c921cd9220667185e)

2 years agovmm: add tunable to trap WBINVD
Corvin Köhne [Mon, 30 May 2022 08:02:52 +0000 (10:02 +0200)]
vmm: add tunable to trap WBINVD

x86 is cache coherent. However, there are special cases where cache
coherency isn't ensured (e.g. when switching the caching mode). In these
cases, WBINVD can be used. WBINVD writes all cache lines back into main
memory and invalidates the whole cache.

Due to the invalidation of the whole cache, WBINVD is a very heavy
instruction and degrades the performance on all cores. So, we should
minimize the use of WBINVD as much as possible.

In a virtual environment, the WBINVD call is mostly useless. The guest
isn't able to break cache coherency because he can't switch the physical
cache mode. When using pci passthrough WBINVD might be useful.

Nevertheless, trapping and ignoring WBINVD is an unsafe operation. For
that reason, we implement it as tunable.

Reviewed by: jhb
Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35253

(cherry picked from commit 3ba952e1a2179c232402c82d5c7587159b15a8dd)

2 years agobhyve: use bhyve_config for SMBIOS strings
Corvin Köhne [Mon, 30 May 2022 08:01:36 +0000 (10:01 +0200)]
bhyve: use bhyve_config for SMBIOS strings

Some software uses SMBIOS entries to identify the system on which it's
running. In order to make it possible to use such software inside a VM,
SMBIOS entries should be configurable. Therefore, bhyve_config can be
used. While only a few SMBIOS entries might be of interest, it makes
sense that all SMBIOS entries are configurable. This way all SMBIOS
tables are build the same way and there's no special handling for some
tables.

Reviewed by: jhb
Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34465

(cherry picked from commit 8284799a232941c164acec425a881b5abb976751)

2 years agopkg-bootstrap: use latest package set on arm64 stable branches
Ed Maste [Thu, 9 Jun 2022 23:53:24 +0000 (19:53 -0400)]
pkg-bootstrap: use latest package set on arm64 stable branches

As with i386 and amd64, "latest" packages are available on stable
branches for arm64/aarch64.

Reviewed by: manu
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35445

(cherry picked from commit f92e0d6acda3abd16c6d411bf90ef26c4e3c40c4)

2 years agomlx5ib: Fix memory leak in clean_mr() error path
Hans Petter Selasky [Mon, 13 Jun 2022 14:46:47 +0000 (16:46 +0200)]
mlx5ib: Fix memory leak in clean_mr() error path

In the clean_mr() error path the 'mr' should be freed.

Linux commit:
5942d8ae411775b76e5e1ab0cce57b0666516f2d

PR: 264653
Sponsored by: NVIDIA Networking

(cherry picked from commit e4d178d093281419c5ad9dea1c497bceb54d0018)

2 years agoibcore: Fix use-after-free access in ucma_close()
Hans Petter Selasky [Mon, 13 Jun 2022 14:55:14 +0000 (16:55 +0200)]
ibcore: Fix use-after-free access in ucma_close()

The error in ucma_create_id() left ctx in the list of contexts belong
to ucma file descriptor. The attempt to close this file descriptor causes
to use-after-free accesses while iterating over such list.

Linux commit:
ed65a4dc22083e73bac599ded6a262318cad7baf

PR: 264650
Sponsored by: NVIDIA Networking

(cherry picked from commit 66a0bc2105e43e54abfaa9f48b76c28371fa2d62)

2 years agouchcom(4): Add new USB ID.
Hans Petter Selasky [Sun, 12 Jun 2022 14:40:36 +0000 (16:40 +0200)]
uchcom(4): Add new USB ID.

PR: 260783
PR: 264634
Sponsored by: NVIDIA Networking

(cherry picked from commit f25a0a0f21183a52eeb4a860a88114aebec5f249)

2 years agorb_tree: drop needless tests from rb_next, rb_prev
Doug Moore [Fri, 10 Jun 2022 21:53:16 +0000 (16:53 -0500)]
rb_tree: drop needless tests from rb_next, rb_prev

In RB_NEXT, when there is no RB_RIGHT node, the search must proceed
through the parent node.

There is code written to handle the case when the parent is non-NULL
and the current element is the left child of that parent. If you
assume that the current element is either the left child of its
parent, or the right child of its parent, but not both, then this test
is not necessary. Instead of assigning RB_PARENT(elm, field) to elm
when elm == RB_LEFT, removing the test has the code assign
RB_PARENT(elm, field) to elm when elm != RB_RIGHT. There's no need to
examine the RB_LEFT field at all.

This change removes that needless RB_LEFT test, and makes a similar
change to the RB_PREV implementation.

Reviewed by: alc
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35450

(cherry picked from commit 36447829aee545ad9eafbfff3a783ee58cfb28fd)

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
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

(cherry picked from commit ecdc04d006de93eb343ce3b77208abd937d4f8ac)

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>
Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D35128

(cherry picked from commit 0bef4927ea858bb18b6f679bc0a36cff264dc842)

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.

Reviewed by:    pfg

(cherry picked from commit 8b582b16402102df10a715c626e212bbbc8e9d7c)

2 years agopf tests: pfsync and route_to test case
Thomas Pasqualini [Sat, 4 Jun 2022 10:43:48 +0000 (12:43 +0200)]
pf tests: pfsync and route_to test case

Test pfsync in a more realistic scenario with carp and route_to rules.

Build this topology and initiate a single ping session from client to
server:
   ┌──────┐
   │client│
   └───┬──┘
       │
   ┌───┴───┐
   │bridge0│
   └┬─────┬┘
    │     │
   ┌────────────────┴─┐ ┌─┴────────────────┐
   │gw_route_to_master├─┤gw_route_to_backup│
   └────────────────┬─┘ └─┬────────────────┘
    │     │
   ┌┴─────┴┐
   │bridge1│
   └┬─────┬┘
    │     │
   ┌────────────────┴─┐ ┌─┴────────────────┐
   │gw_reply_to_master├─┤gw_reply_to_backup│
   └────────────────┬─┘ └─┬────────────────┘
    │     │
   ┌┴─────┴┐
   │bridge2│
   └───┬───┘
       │
   ┌───┴──┐
   │server│
   └──────┘

gw* jails forward traffic through pf route-to rules, not fib lookups.
If backup_promotion arg is given (as in the pfsync_pbr test case), a
carp failover event occurs during the ping session on both gateways.

Verify that ping messages still go where we expect them to go.

MFC after: 2 weeks
Sponsored by: Orange Business Services

(cherry picked from commit 536e1da18bae91c74561498b3f484b27a89e13d7)

2 years agopf: Improve route-to handling of pfsync'd states
Kristof Provost [Sat, 4 Jun 2022 10:38:40 +0000 (12:38 +0200)]
pf: Improve route-to handling of pfsync'd states

When a state if pfsync’d to a different host it doesn’t get all of the
expected pointers, including the pointer to the struct pfi_kif / struct
ifnet rt_kif pointer. (I.e. the interface to route out on).

That in turn means that pf_route() ends up dropping the packet.

Use the rule's struct pfi_kif pointer so we can still route out of the
expected interface.

MFC after: 2 weeks
Sponsored by: Orange Business Services

(cherry picked from commit 81ef217ad428c29be669aac2166d194db31817a7)

2 years agoFix e013e369 mismerge which is causes i386 LINT fails to build.
Dmitry Chagin [Sat, 18 Jun 2022 07:06:58 +0000 (10:06 +0300)]
Fix e013e369 mismerge which is causes i386 LINT fails to build.

This is a direct commit to the stable/13.

2 years agoCut out leftover of the sv_transtrap hook from the struct sysentvec on
Dmitry Chagin [Fri, 17 Jun 2022 21:35:52 +0000 (00:35 +0300)]
Cut out leftover of the sv_transtrap hook from the struct sysentvec on
mips. The hook is deleted by commit eca368ec from the main, but since
mips is retired from main, it is left after merge.

This is a direct commit to the stable/13.

2 years agovfs: Consistently validate AT_* flags in kern_* functions.
John Baldwin [Tue, 9 Nov 2021 17:42:12 +0000 (09:42 -0800)]
vfs: Consistently validate AT_* flags in kern_* functions.

Some syscalls checked for invalid AT_* flags in sys_* and others in
kern_*.

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

(cherry picked from commit 57093f9366b7eeb48054ff2fa77b9d01d2b3cfc2)

2 years agolinux(4): bump osrelease to 4.4.0.
Edward Tomasz Napierala [Mon, 19 Apr 2021 10:37:47 +0000 (11:37 +0100)]
linux(4): bump osrelease to 4.4.0.

This is required for the current Arch Linux binaries to work.

PR: 254112
Reviewed By: emaste
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29218

(cherry picked from commit 156da725d3ef6bbafdb0389aada57cf268f44b1e)

2 years agolinux(4): Return EINVAL when the clockid has invalid bits are set
Dmitry Chagin [Tue, 31 May 2022 08:46:15 +0000 (11:46 +0300)]
linux(4): Return EINVAL when the clockid has invalid bits are set

Linux forbids PERTHREAD bit set for CLOCKFD clock.

MFC after: 2 weeks

(cherry picked from commit 539fadb493d34e6607f7492f018365bdc2abc23a)

2 years agolinux(4): Return ENOTSUP for unsupported clockid
Dmitry Chagin [Tue, 31 May 2022 08:43:00 +0000 (11:43 +0300)]
linux(4): Return ENOTSUP for unsupported clockid

It's much better from the user perspective to get a sane error code.

MFC after: 2 weeks

(cherry picked from commit 452f4636c3ba1f51f2f549ccc31fd4177254fb6d)

2 years agolinprocfs: Add /proc/vm/max_map_count
Dmitry Chagin [Tue, 31 May 2022 08:42:06 +0000 (11:42 +0300)]
linprocfs: Add /proc/vm/max_map_count

On Linux this limits the number of maps per mm struct.
We don't limit mappings, return a suitable large value.

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

(cherry picked from commit 7e2a451119373b7d3f2b3fd062d4ccb099dde022)

2 years agolinux(4): Properly restore the thread signal mask after signal delivery on i386
Dmitry Chagin [Mon, 30 May 2022 17:03:49 +0000 (20:03 +0300)]
linux(4): Properly restore the thread signal mask after signal delivery on i386

Replace sigframe sf_extramask by native sigset_t and use it to
store/restore the thread signal mask without conversion to/from
Linux signal mask.

Pointy hat to: dchagin
MFC after: 2 weeks

(cherry picked from commit 4a6c2d075da0c5105269e6edcbe57bf6aaa0a0ae)

2 years agolinux(4): Prefer sizeof(object) vs sizeof(type)
Dmitry Chagin [Mon, 30 May 2022 17:03:14 +0000 (20:03 +0300)]
linux(4): Prefer sizeof(object) vs sizeof(type)

MFC after: 2 weeks

(cherry picked from commit 2722e515ac8d0232cd80e5e8848715e27d222902)

2 years agolinux(4): Error is not a bool, use proper comparison
Dmitry Chagin [Mon, 30 May 2022 17:00:30 +0000 (20:00 +0300)]
linux(4): Error is not a bool, use proper comparison

MFC afer: 2 weeks

(cherry picked from commit 5573143777dd45d77163e208dc54426ac93896af)

2 years agolinux(4): Use the copyin_sigset() in the remaining places
Dmitry Chagin [Mon, 30 May 2022 16:59:45 +0000 (19:59 +0300)]
linux(4): Use the copyin_sigset() in the remaining places

MFC after: 2 weeks

(cherry picked from commit 5e872c279aecd169df34602669ee9c86ae9e9f18)

2 years agolinux(4): Refactor SIGPWR mapping
Dmitry Chagin [Mon, 30 May 2022 16:55:49 +0000 (19:55 +0300)]
linux(4): Refactor SIGPWR mapping

Map Linux RT signals to the native RT signals starting from SIGRTMIN,
and Linux SIGPWR signal map to after the last RT signal.

MFC after: 2 weeks

(cherry picked from commit 7a7cee558501a27e5b7437d012a1139ca77d97f2)

2 years agolinux(4): Fix the type of a constant in the signal mask macro
Dmitry Chagin [Mon, 30 May 2022 16:53:52 +0000 (19:53 +0300)]
linux(4): Fix the type of a constant in the signal mask macro

Since l_sigset_t is 64-bit unsigned on all Linuxulators, fix the type
of a constant in the signal mask manipulation macro.
The suffix L indicates type long which is 32-bit on i386, therefore,
bitwise operations between a 32-bit constant and 64-bit signal mask
lead to the wrong result.

Pointy hat to: dchagin
MFC after: 2 weeks

(cherry picked from commit 669516a1a16efe51f85ef203c3b93e6db7a3ed51)

2 years agolinux(4): Properly build argument list for the signal handler
Dmitry Chagin [Mon, 30 May 2022 16:53:12 +0000 (19:53 +0300)]
linux(4): Properly build argument list for the signal handler

Provide arguments 2 and 3 if signal handler installed with SA_SIGINFO.

MFC after: 2 weeks

(cherry picked from commit 109fd18ad96957c25cfaa78da2f825c729e33fef)

2 years agolinux(4): Microoptimize rt_sendsig(), convert signal mask once
Dmitry Chagin [Mon, 30 May 2022 16:49:45 +0000 (19:49 +0300)]
linux(4): Microoptimize rt_sendsig(), convert signal mask once

On amd64 Linux saves the thread signal mask in both contexts, in the machine
dependent and in the machine independent. Both contexts are user accessible.
Convert the mask once, then copy it.

MFC after: 2 weeks

(cherry picked from commit c30a767c6fd6d3f19e897fb800513e75175249b9)