]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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 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 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)

2 years agolinux(4): Avoid direct manipulation of td_sigmask
Dmitry Chagin [Mon, 30 May 2022 16:48:20 +0000 (19:48 +0300)]
linux(4): Avoid direct manipulation of td_sigmask

Use kern_sigprocmask() instead of direct manipulation of td_sigmask
to reschedule newly blocked signals.

MFC after: 2 weeks

(cherry picked from commit 2ab9b59faafb68402dbebc285b424cfb06b59cf3)

2 years agolinux(4): Reduce duplication between MD parts of the Linuxulator
Dmitry Chagin [Mon, 30 May 2022 16:47:26 +0000 (19:47 +0300)]
linux(4): Reduce duplication between MD parts of the Linuxulator

Move sigprocmask actions defines under compat/linux,
they are identical across all Linux architectures.

MFC after: 2 weeks

(cherry picked from commit 2ca34847e7288fba6b2a15e64648238bc12e4960)

2 years agolinux(4): Handle multiple mbufs in a control message chain in recvmsg
Dmitry Chagin [Sat, 28 May 2022 20:48:45 +0000 (23:48 +0300)]
linux(4): Handle multiple mbufs in a control message chain in recvmsg

PR: 230274
MFC after: 2 weeks

(cherry picked from commit 3735f9cff1e8a7ce7079b957bc3b37f0f886caed)

2 years agolinux(4): Ratelimit message about unupported cmsg
Dmitry Chagin [Sat, 28 May 2022 20:48:16 +0000 (23:48 +0300)]
linux(4): Ratelimit message about unupported cmsg

MFC after: 2 weeks

(cherry picked from commit 31d7f3e9ce2d0d69123f3d20453f4fa41ac434d7)

2 years agolinux(4): Handle IP_ORIGDSTADDR socket option for IPPROTO_IP protocol level
Dmitry Chagin [Sat, 28 May 2022 20:47:40 +0000 (23:47 +0300)]
linux(4): Handle IP_ORIGDSTADDR socket option for IPPROTO_IP protocol level

MFC after: 2 weeks

(cherry picked from commit f8a6615064badb76b6cb301163697cf99ac4f180)

2 years agolinux(4): Add LINUX_RATELIMIT_MSG_OPT2 for future use
Dmitry Chagin [Sat, 28 May 2022 20:47:23 +0000 (23:47 +0300)]
linux(4): Add LINUX_RATELIMIT_MSG_OPT2 for future use

MFC after: 2 weeks

(cherry picked from commit 4f02a4f48c080ad56f0d7c745ace4d2f7dacf928)

2 years agolinux(4): Overwrite SO_TIMESTAMP counterpart
Dmitry Chagin [Sat, 28 May 2022 20:46:38 +0000 (23:46 +0300)]
linux(4): Overwrite SO_TIMESTAMP counterpart

A socket cannot mix SO_TIMESTAMP and SO_TIMESTAMPNS: the two modes
are mutually exclusive.

MFC after: 2 weeks

(cherry picked from commit 53494b918d63a5b31793ce7f66569d4bd03f5817)

2 years agolinux(4): Refactor linux_common_recvmsg()
Dmitry Chagin [Sat, 28 May 2022 20:46:22 +0000 (23:46 +0300)]
linux(4): Refactor linux_common_recvmsg()

To improve readability lower nesting level, better naming for variables.
No functional changes.

MFC after: 2 weeks

(cherry picked from commit 0eda2ceab7820aeba79029b59b3fe9b28a66c766)

2 years agolinux(4): Handle SO_TIMESTAMPNS socket option
Dmitry Chagin [Sat, 28 May 2022 20:46:05 +0000 (23:46 +0300)]
linux(4): Handle SO_TIMESTAMPNS socket option

The SO_TIMESTAMPNS enables or disables the receiving of the SCM_TIMESTAMPNS
control message. The cmsg_data field is a struct timespec.
To distinguish between SO_TIMESTAMP and SO_TIMESTAMPNS in the recvmsg()
map the last one to the SO_BINTIME and convert bintime to the timespec.
In the rest, implementation is identical to the SO_TIMESTAMP.

MFC after: 2 weeks

(cherry picked from commit 71bc8bcf660b437b99af1e3d382f7bfdaea5fa9c)

2 years agolinux(4): Handle 64-bit SO_TIMESTAMP for 32-bit binaries
Dmitry Chagin [Sat, 28 May 2022 20:45:39 +0000 (23:45 +0300)]
linux(4): Handle 64-bit SO_TIMESTAMP for 32-bit binaries

To solve y2k38 problem in the recvmsg syscall the new SO_TIMESTAMP
constant were added on v5.1 Linux kernel. So, old 32-bit binaries
that knows only 32-bit time_t uses the old value of the constant,
and binaries that knows 64-bit time_t uses the new constant.

To determine what size of time_t type is expected by the user-space,
store requested value (SO_TIMESTAMP) in the process emuldata structure.

MFC after: 2 weeks

(cherry picked from commit 0e26e54bdfa2859908150011a4a165e9dd3de9ac)

2 years agolinux(4): For future use replace malloc type for l_sockaddr by M_LINUX
Dmitry Chagin [Sat, 28 May 2022 20:44:48 +0000 (23:44 +0300)]
linux(4): For future use replace malloc type for l_sockaddr by M_LINUX

MFC after: 2 weeks

(cherry picked from commit 6335583990d8691ab01cd4fa92390f82f07e3d75)

2 years agolinux(4): Improve recvmsg() readability
Dmitry Chagin [Sat, 28 May 2022 20:44:02 +0000 (23:44 +0300)]
linux(4): Improve recvmsg() readability

To improve recvmsg() readability SCM_ handlers moved to a separate
functions.

MFC after: 2 weeks

(cherry picked from commit b408788d6b7edf91a6c4b9e2e8d1b34fe5d41525)

2 years agolinux(4): For future use move SCM definitions below socket options
Dmitry Chagin [Sat, 28 May 2022 20:42:23 +0000 (23:42 +0300)]
linux(4): For future use move SCM definitions below socket options

MFC after: 2 weeks

(cherry picked from commit f409a7c5386a30edccf2b26a5612cab99fdff045)

2 years agolinux(4): Avoid EISCONN if addr is specified for sendto()
Dmitry Chagin [Sat, 28 May 2022 20:42:09 +0000 (23:42 +0300)]
linux(4): Avoid EISCONN if addr is specified for sendto()

If the socket is in a connected state, the target address should be
ignored.

MFC after: 2 weeks

(cherry picked from commit db48fa8319825b4428795fcef9fb5458ac34c1a9)

2 years agolinux(4): Fix SO_LINGER l_onoff value
Dmitry Chagin [Sat, 28 May 2022 20:31:06 +0000 (23:31 +0300)]
linux(4): Fix SO_LINGER l_onoff value

On Linux l_onoff should be 1 when linger is used.

MFC after: 2 weeks

(cherry picked from commit e8d9d8082be339d046826e543e8e835c61e2d4b0)

2 years agolinux(4): Add a helper to copyout getsockopt value
Dmitry Chagin [Sat, 28 May 2022 20:30:22 +0000 (23:30 +0300)]
linux(4): Add a helper to copyout getsockopt value

For getsockopt(), optlen is a value-result argument, which is modified
on return to indicate the actual size of the value returned.
For some cases this was missed, fixed.

MFC after: 2 weeks

(cherry picked from commit e92b9a9eaa646bc1037af2a838270c43ea607d55)

2 years agolinux(4): Check the socket before any others sanity checks
Dmitry Chagin [Sat, 28 May 2022 20:29:12 +0000 (23:29 +0300)]
linux(4): Check the socket before any others sanity checks

Strictly speaking, this check is performed by the kern_recvit(), but in
the Linux emulation layer before calling the kernel we do other sanity
checks and conversions from Linux types to the native types. This changes
an order of the error returning that is critical for some buggy Linux
applications.

For recvmmsg() syscall this fixes a panic in case when the user-supplied
vlen value is 0, then error is not initialized and garbage passed to the
bsd_to_linux_errno().

MFC after: 2 weeks

(cherry picked from commit 3a99aac66f8d12386e8382aaf29d2e82e6b5353b)

2 years agoFinish cpuset_getaffinity() after f35093f8
Dmitry Chagin [Sat, 28 May 2022 17:53:08 +0000 (20:53 +0300)]
Finish cpuset_getaffinity() after f35093f8

Split cpuset_getaffinity() into a two counterparts, where the
user_cpuset_getaffinity() is intended to operate on the cpuset_t from
user va, while kern_cpuset_getaffinity() expects the cpuset from kernel
va.
Accordingly, the code that clears the high bits is moved to the
user_cpuset_getaffinity(). Linux sched_getaffinity() syscall returns
the size of set copied to the user-space and then glibc wrapper clears
the high bits.

MFC after: 2 weeks

(cherry picked from commit d46174cd8838b86b9fe956b80c82bd238c302b2e)

2 years agosysent: Get rid of bogus sys/sysent.h include.
Dmitry Chagin [Sat, 28 May 2022 17:52:17 +0000 (20:52 +0300)]
sysent: Get rid of bogus sys/sysent.h include.

Where appropriate hide sysent.h under proper condition.

MFC after: 2 weeks

(cherry picked from commit 31d1b816fe139f46083f8609c34b7d129a6e2ee0)

2 years agolinux(4): Fix unlinkat() after a125ed50
Dmitry Chagin [Mon, 23 May 2022 10:19:34 +0000 (13:19 +0300)]
linux(4): Fix unlinkat() after a125ed50

MFC after: 2 weeks

(cherry picked from commit 1bb3faed29cf1f451bcdc396eaa4f8cc476f9159)

2 years agolinux(4); Move vdso_selector_x86.c to the linux_common module
Dmitry Chagin [Mon, 23 May 2022 10:19:07 +0000 (13:19 +0300)]
linux(4); Move vdso_selector_x86.c to the linux_common module

MFC after: 2 weeks

(cherry picked from commit 2b378d59a98a4eb1dab173c4db3b48f385c47728)

2 years agolinux(4): Deduplicate execve
Dmitry Chagin [Fri, 17 Jun 2022 19:35:30 +0000 (22:35 +0300)]
linux(4): Deduplicate execve

As linux_execve is common across archs, except amd64 32-bit Linuxulator,
move it under compat/linux.

Noted by:               andrew@
MFC after:              2 weeks

(cherry picked from commit 26700ac0c4d0466c00f944bde9613d18625d1f91)

2 years agolinux(4): Fix unlink() after a125ed50
Dmitry Chagin [Mon, 23 May 2022 10:18:07 +0000 (13:18 +0300)]
linux(4): Fix unlink() after a125ed50

MFC after: 2 weeks

(cherry picked from commit e0aef0d62d2b14e754f25ef4f3582ae5faf8579c)

2 years agolinux(4): Fix execve() on amd64/linux32 after a125ed50
Dmitry Chagin [Mon, 23 May 2022 10:17:39 +0000 (13:17 +0300)]
linux(4): Fix execve() on amd64/linux32 after a125ed50

MFC after: 2 weeks

(cherry picked from commit 53726a1f1ed75a6788f5235833597e78781fffba)

2 years agolinux(4): Deduplicate bsd_to_linux_trapcode()
Dmitry Chagin [Mon, 23 May 2022 10:16:58 +0000 (13:16 +0300)]
linux(4): Deduplicate bsd_to_linux_trapcode()

As bsd_to_linux_trapcode() is common for x86 Linuxulators,
move it under x86/linux.

MFC after: 2 weeks

(cherry picked from commit 9016ec056ae3896522798ead39bb2f3ff4f68809)

2 years agolinux(4): Deduplicate translate_traps()
Dmitry Chagin [Mon, 23 May 2022 10:16:26 +0000 (13:16 +0300)]
linux(4): Deduplicate translate_traps()

As translate_traps() is common for x86 Linuxulators,
move it under x86/linux.

MFC after: 2 weeks

(cherry picked from commit 2434137f690dabc35586ab45fc4c4ecc5b71184f)

2 years agoRetire sv_transtrap
Dmitry Chagin [Fri, 20 May 2022 11:54:03 +0000 (14:54 +0300)]
Retire sv_transtrap

Call translate_traps directly from sendsig().

MFC after: 2 weeks

(cherry picked from commit eca368ecb6e00e9db7e1c090e98a29439d255895)

2 years agolinux(4): Retire unneeded translate_traps from arm64
Dmitry Chagin [Fri, 20 May 2022 11:19:51 +0000 (14:19 +0300)]
linux(4): Retire unneeded translate_traps from arm64

MFC after: 2 weeks

(cherry picked from commit f34a9180ae881dc77ea42ab38e992828b1567a5d)

2 years agolinux(4): To improve readability use FUTEX_UNOWNED instead of 0
Dmitry Chagin [Thu, 19 May 2022 18:42:38 +0000 (21:42 +0300)]
linux(4): To improve readability use FUTEX_UNOWNED instead of 0

MFC after: 2 weeks

(cherry picked from commit b04f5d18b5faad004a10f054d9c9072fcf31c29b)

2 years agolinux(4): Convert the native kernel signal codes into the Linux codes
Dmitry Chagin [Thu, 19 May 2022 16:56:50 +0000 (19:56 +0300)]
linux(4): Convert the native kernel signal codes into the Linux codes

MFC after: 2 weeks

(cherry picked from commit a6f85b12bbe8e50243350c77b0c5879d9e72f85b)

2 years agolinux(4): Add kernel signal code definitions
Dmitry Chagin [Thu, 19 May 2022 16:55:56 +0000 (19:55 +0300)]
linux(4): Add kernel signal code definitions

In the next commit I'll convert the native signal codes into the Linux codes,
since they are not 1:1 mapped.

MFC after: 2 weeks

(cherry picked from commit 30301975637f85172fe18b73c863dabd8ad28296)

2 years agolinux(4): Move signal codes definitions to the appropriate header
Dmitry Chagin [Thu, 19 May 2022 16:55:20 +0000 (19:55 +0300)]
linux(4): Move signal codes definitions to the appropriate header

In the Linux the struct siginfo related bits are placed into the siginfo.h
header.

MFC after: 2 weeks

(cherry picked from commit 9386e18b395dd62f6d0cccad67af51e3ad1d2429)

2 years agoarm64: Enable the floating-point exception traps
Dmitry Chagin [Thu, 19 May 2022 16:53:56 +0000 (19:53 +0300)]
arm64: Enable the floating-point exception traps

To enable it user-space needs to call feenableexcept().

FPE_FLTIDO has been added as the IDF bit can't be mapped to any existing
FPE code.

Reviewed by: andrew@
Differential revision: https://reviews.freebsd.org/D35247
MFC after: 2 weeks

(cherry picked from commit 6e2caba7a1297eeda4f43e6377667d2e049f24f9)

2 years agolinux(4): Handle cas failure on ll/sc operations
Dmitry Chagin [Thu, 19 May 2022 16:52:18 +0000 (19:52 +0300)]
linux(4): Handle cas failure on ll/sc operations

Follow the 11a6ecd4. Check and handle the case when the ll/sc casu fails
even when the compare succeeds.

For more details PR/263825, https://reviews.freebsd.org/D35150.

Obtained from: Andrew@
MFC after: 2 weeks

(cherry picked from commit 2cd662064a0cd8d179cbb5a06378fce0ec458747)

2 years agokqueue: Trim trailing whitespace
Dmitry Chagin [Thu, 19 May 2022 16:52:02 +0000 (19:52 +0300)]
kqueue: Trim trailing whitespace

MFC after: 1 week

(cherry picked from commit 2479e381cd5fe21c1f1c516ee42dfdd1fcc9abfc)

2 years agoPrevent running sigwait tests in parallel
Dmitry Chagin [Fri, 17 Jun 2022 19:35:24 +0000 (22:35 +0300)]
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

(cherry picked from commit c678572e7675c8de6d19fa925284a50f58358f35)

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

(cherry picked from commit 3020bfe1b8f53d70aa110b72227fa64f678e7307)

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

(cherry picked from commit 41068268ec480e58811a86787b60914709375b3f)

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

(cherry picked from commit 390c9ea029fdd3fb2ce61fc6b48617f0f7cd8754)

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

(cherry picked from commit c56480a832354aff995f9d0bc5da4ccf27dfe78a)

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

(cherry picked from commit 08e201a3b4624d84f67f4587ab21b4b4abf61e76)

2 years agolinux(4): Retire handmade DWARF annotations from signal trampolines
Dmitry Chagin [Fri, 17 Jun 2022 19:35:21 +0000 (22:35 +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

(cherry picked from commit 8f9635dc99f571a0ae4e613b9a0439e68da7b160)

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

(cherry picked from commit 6e826d27c340fa29e166d06e5d8553f6c63c409e)

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

(cherry picked from commit af557e649cf229e45a83767c3c4a7daeb92f0b01)

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

(cherry picked from commit 21f246174184742ba8952aeb1dadbf58d48d54b4)

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

(cherry picked from commit ba279bcd6d75aa236bcb9ccf11aeb6f51a2f8514)

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

(cherry picked from commit 0b5d5dc3767fcf2f0198f0f9549cb23983e0ee3e)

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

(cherry picked from commit 3bae1cd68a2ac3e2c37d54cf550e01257dfb1a04)

2 years agokqueue: Fix kqueue(2) man page.
Dmitry Chagin [Fri, 17 Jun 2022 19:35:18 +0000 (22:35 +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

(cherry picked from commit 14c99b43ef69beafa01a1574641c4cf19ecf2b9d)