390c9ea0 dchagin May 15, 2022, 6:12 p.m.
MFC after:	2 weeks
cgit
c56480a8 dchagin May 15, 2022, 6:10 p.m.
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
cgit
08e201a3 dchagin May 15, 2022, 6:08 p.m.
MFC after:		2 weeks
cgit
8f9635dc dchagin May 15, 2022, 6:08 p.m.
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
cgit
6e826d27 dchagin May 15, 2022, 6:06 p.m.
To reduce sendsig code difference and to avoid confusing me,
rename sf_sc to sf_uc to match the content.

MFC after:		2 weeks
cgit
af557e64 dchagin May 15, 2022, 6:05 p.m.
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
cgit
21f24617 dchagin May 15, 2022, 6:03 p.m.
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
cgit
ba279bcd dchagin May 15, 2022, 6 p.m.
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
cgit
0b5d5dc3 dchagin May 15, 2022, 5:58 p.m.
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
cgit
3bae1cd6 dchagin May 15, 2022, 5:49 p.m.
It's mostly modeled like the Linux does.

Differential revision:	https://reviews.freebsd.org/D35154
MFC after:		2 weeks
cgit
f210e4fb tuexen May 14, 2022, 6:30 a.m.
MFC after:	3 days
cgit
aab6e5bd tuexen May 14, 2022, 6:07 a.m.
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
cgit
9312ba23 tuexen May 14, 2022, 6:05 a.m.
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
cgit
9b2a35b3 tuexen May 14, 2022, 4:28 a.m.
No functional change intended.

MFC after:	3 days
cgit
0817c8dc dim May 14, 2022, 8:07 p.m.
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
cgit