]>
CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
Dmitry Chagin [Sat, 14 May 2022 11:07:20 +0000 (14:07 +0300)]
sysvsem: Fix a typo
Per jamie@ rpr can be NULL if the jail is created with sysvsem=disable.
But at least it doesn't appear to be fatal, since rpr is never dereferenced
but is only compared to other prison pointers.
Reviewed by: jamie
Differential revision: https://reviews.freebsd.org/D35198
MFC after: 2 weeks
(cherry picked from commit
cb2ae6163174b90e999326ecec3699ee093a5d43 )
Dmitry Chagin [Sat, 14 May 2022 11:06:58 +0000 (14:06 +0300)]
sysvsem: Style(9)
MFC after: 2 weeks
(cherry picked from commit
b6c8f461f09ea48d0369dba513e411e8a93e261a )
Dmitry Chagin [Sat, 14 May 2022 11:06:40 +0000 (14:06 +0300)]
sysvsem: Trim traiing whitespace
MFC after: 2 weeks
(cherry picked from commit
f0b0fdf15efee38ee6989ec2b1668f065704c7df )
Dmitry Chagin [Fri, 13 May 2022 17:52:14 +0000 (20:52 +0300)]
fusefs tests: Remove an unused variable.
Reviewed by: asomers
Differential revision: https://reviews.freebsd.org/D35185
MFC after: 2 weeks
(cherry picked from commit
d966efcc08071380cf89c46a167d5193043b6752 )
Dmitry Chagin [Thu, 12 May 2022 19:14:41 +0000 (22:14 +0300)]
tests: Get rid of invalid since
3e11d3f6 testcase
MFC after: 2 weeks
(cherry picked from commit
e4a257058c95beca39aecebc70604ec5d8e37938 )
Dmitry Chagin [Thu, 12 May 2022 17:06:13 +0000 (20:06 +0300)]
Fixed the value returned by sched_getaffinity().
On success gnu libc sched_getaffinity() should return 0, unlike underlying
Linux syscall which returns the size of CPU mask copied to user.
PR: 263939
MFC after: 2 weeks
(cherry picked from commit
3e11d3f61ae2b2b8a8ffeff4ef32067d95c065a1 )
Dmitry Chagin [Wed, 11 May 2022 18:00:54 +0000 (21:00 +0300)]
linux(4): Revert
c7ef7c3 as it's wrong at all.
Reported by: trasz
(cherry picked from commit
5326ebfd05c57b9432cb1ea7268f789559ba1e25 )
Dmitry Chagin [Wed, 11 May 2022 07:40:39 +0000 (10:40 +0300)]
kdump: Decode cpuset_t.
Reviewed by: jhb
Differential revision: https://reviews.freebsd.org/D34982
MFC after: 2 weeks
(cherry picked from commit
586ed321068b883e33df0e41ca913c074e6ea53d )
Dmitry Chagin [Wed, 11 May 2022 07:39:18 +0000 (10:39 +0300)]
Add tests for affinity syscalls.
MFC after: 2 weeks
(cherry picked from commit
c8b5c478f66d155a092b8d0c6fd689546736dae7 )
Dmitry Chagin [Fri, 17 Jun 2022 19:35:14 +0000 (22:35 +0300)]
cpuset: Byte swap cpuset for compat32 on big endian architectures
Summary:
BITSET uses long as its basic underlying type, which is dependent on the
compile type, meaning on 32-bit builds the basic type is 32 bits, but on
64-bit builds it's 64 bits. On little endian architectures this doesn't
matter, because the LSB is always at the low bit, so the words get
effectively concatenated moving between 32-bit and 64-bit, but on
big-endian architectures it throws a wrench in, as setting bit 0 in
32-bit mode is equivalent to setting bit 32 in 64-bit mode. To
demonstrate:
32-bit mode:
BIT_SET(foo, 0): 0x00000001
64-bit sees: 0x0000000100000000
cpuset is the only system interface that uses bitsets, so solve this
by swapping the integer sub-components at the copyin/copyout points.
Reviewed by: kib
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D35225
(cherry picked from commit
47a57144af25a7bd768b29272d50a36fdf2874ba )
Fix the build after
47a57144
(cherry picked from commit
89737eb8290a10d96b77afac1b68e4740b43353b )
cpuset: Fix the KASAN and KMSAN builds
Rename the "copyin" and "copyout" fields of struct cpuset_copy_cb to
something less generic, since sanitizers define interceptors for
copyin() and copyout() using #define.
Reported by: syzbot+
2db5d644097fc698fb6f @syzkaller.appspotmail.com
Fixes: 47a57144af25 ("cpuset: Byte swap cpuset for compat32 on big endian architectures")
Sponsored by: The FreeBSD Foundation
(cherry picked from commit
4a3e51335e86cee02569c04b9f1e95ca9abcb170 )
Use Linux semantics for the thread affinity syscalls.
Linux has more tolerant checks of the user supplied cpuset_t's.
Minimum cpuset_t size that the Linux kernel permits in case of
getaffinity() is the maximum CPU id, present in the system / NBBY,
the maximum size is not limited.
For setaffinity(), Linux does not limit the size of the user-provided
cpuset_t, internally using only the meaningful part of the set, where
the upper bound is the maximum CPU id, present in the system, no larger
than the size of the kernel cpuset_t.
Unlike FreeBSD, Linux ignores high bits if set in the setaffinity(),
so clear it in the sched_setaffinity() and Linuxulator itself.
Reviewed by: Pau Amma (man pages)
In collaboration with: jhb
Differential revision: https://reviews.freebsd.org/D34849
MFC after: 2 weeks
(cherry picked from commit
f35093f8d6d8155ab2e56c11ee03d474688b16a2 )
Dmitry Chagin [Fri, 17 Jun 2022 19:35:11 +0000 (22:35 +0300)]
linux(4): Regen for prctl fix.
MFC after: 2 weeks
(cherry picked from commit
7b76c79b0b3aa2b769e4c6b058243ec65278f361 )
Dmitry Chagin [Mon, 9 May 2022 18:45:51 +0000 (21:45 +0300)]
linux(4): Fix
039e98e6 .
The patch was about an year in my local queue and I still screwed up...
MFC after: 2 weeks
(cherry picked from commit
bfae7fbaa2af43800589b666ac45897d513f4482 )
Dmitry Chagin [Mon, 9 May 2022 18:16:48 +0000 (21:16 +0300)]
linux(4); Style.
MFC after: 2 weeks
(cherry picked from commit
109c2bd212574a12a472eed7f6e11196ce456e53 )
Dmitry Chagin [Mon, 9 May 2022 18:16:31 +0000 (21:16 +0300)]
linux(4): Return native error from futex_atomic_op to avoid conversion by the caller.
MFC after: 2 weeks
(cherry picked from commit
07d108932ab5b5bc25221be4916ebf8874cd256f )
Dmitry Chagin [Mon, 9 May 2022 18:11:37 +0000 (21:11 +0300)]
linux(4): Fixed offset miscalculation in the preadv/pwritev syscalls.
MFC after: 2 weeks
(cherry picked from commit
b17446281d21311cc4f9d522c5d18337a9f786bc )
Dmitry Chagin [Fri, 17 Jun 2022 19:35:05 +0000 (22:35 +0300)]
linux(4): Regen for prctl syscall.
MFC after: 2 weeks
(cherry picked from commit
e76857671873f0c9037dcc9c546b490714096c73 )
Dmitry Chagin [Mon, 9 May 2022 18:09:39 +0000 (21:09 +0300)]
linux(4): Change prctl syscall definition to match Linux actual one.
Otherwise argX conversion leads to an unexpected behaviour.
MFC after: 2 weeks
(cherry picked from commit
039e98e60cb193fb0f8a86f23a26c049c46c27bd )
Dmitry Chagin [Mon, 9 May 2022 18:08:59 +0000 (21:08 +0300)]
linux(4): The futex_wait operation should restart.
It's ok from the futex_wait perspective as umtxq_sleep method uses
absolute sleep timeout.
MFC after: 2 weeks
(cherry picked from commit
5eec19c8eb0e1afafd7290325c61611c9a13b621 )
Dmitry Chagin [Sun, 8 May 2022 14:20:52 +0000 (17:20 +0300)]
linux(4): Use the right function to get the bit index in vdso binuptime.
This is modeled after
a1f93266 (by kib@).
MFC after: 2 weeks
(cherry picked from commit
c6df21760381c3e48bcd412705de6f0ded9e4aae )
Dmitry Chagin [Sun, 8 May 2022 14:20:52 +0000 (17:20 +0300)]
linux(4): Implement vdso getcpu for x86.
This is modeled after
f2395455 (by kib@).
MFC after: 2 weeks
(cherry picked from commit
5a6a4fb284b1a9c4b4105fd6ab8143356f3ef3f7 )
Dmitry Chagin [Sun, 8 May 2022 14:20:51 +0000 (17:20 +0300)]
linux(4): Refactor vdso_gettc_x86 includes.
Factor out includes from common vdso_gettc_x86 file to the corresponding
MD files.
MFC after: 2 weeks
(cherry picked from commit
332eca05b557f4f9d108480688d9c0933f6ed06b )
Dmitry Chagin [Sun, 8 May 2022 13:16:47 +0000 (16:16 +0300)]
linux(4): Add a helper intended for copying timespec's from the userspace.
There are many places where we copyin Linux timespec from the userspace
and then convert it to the kernel timespec. To avoid code duplication
add a tiny halper for doing this.
MFC after: 2 weeks
(cherry picked from commit
707e567a4061669b7643ddbe8a1ad9c4e6545a75 )
Dmitry Chagin [Sun, 8 May 2022 12:39:09 +0000 (15:39 +0300)]
linux(4): Prevent time_t overflows on i386.
As native i386 time_t is still 32-bit, check that the user-provided 64-bit
tv_sec value fits to the kernel time_t, return EOVERFLOW if not.
MFC after: 2 weeks
(cherry picked from commit
3dc2a06752b593acd1a76e784b169f3d60e81d00 )
Dmitry Chagin [Sun, 8 May 2022 12:38:19 +0000 (15:38 +0300)]
linux(4): Zero out high order bits of nanoseconds in the compat mode.
Assuming the kernel would use random data, the 64-bit Linux kernel ignores
upper 32 bits of tv_nsec of struct timespec64 for 32-bit binaries.
MFC after: 2 weeks
(cherry picked from commit
1579b320f1a4d555250b82fa74a391d963e7ae13 )
Dmitry Chagin [Sun, 8 May 2022 12:37:27 +0000 (15:37 +0300)]
linux(4): Add a helper intended for copying timespec's to the userspace.
There are many places where we convert natvie timespec and copyout it to
the userspace. To avoid code duplication add a tiny halper for doing this.
MFC after: 2 weeks
(cherry picked from commit
9a9482f87490bcbb054ba1799d69fdab7cdb6dc9 )
Dmitry Chagin [Fri, 17 Jun 2022 19:34:58 +0000 (22:34 +0300)]
linux(4): Regen for ppoll_time64 syscall.
MFC after: 2 weeks
(cherry picked from commit
61f45f6733d7536c442d14b30b435cfa6cd2f7cc )
Dmitry Chagin [Sun, 8 May 2022 10:37:48 +0000 (13:37 +0300)]
linux(4): Fix ppoll_time64 syscall definition.
Fixed my typo in
ed61e0ce1d . Here tsp is a pointer to the 64-bit timespec.
MFC after: 2 weeks
(cherry picked from commit
94f5f150ef59d8e985bd529b0a6dea52ae8a7def )
Dmitry Chagin [Fri, 6 May 2022 17:02:59 +0000 (20:02 +0300)]
linux(4): Implement semtimedop syscalls.
On i386 are two semtimedop. The old one is called via multiplexor and
uses 32-bit timespec, and new semtimedop_tim64, which is uses 64-bit
timespec.
MFC after: 2 weeks
(cherry picked from commit
3245a2ecea21ace3d97cec1266fbe29c88ba1a59 )
Dmitry Chagin [Fri, 17 Jun 2022 19:34:53 +0000 (22:34 +0300)]
linux(4): Regen for semtimedop syscalls.
MFC after: 2 weeks
(cherry picked from commit
430460d7178285a26087d294177627e6c88ad369 )
Dmitry Chagin [Fri, 6 May 2022 17:01:43 +0000 (20:01 +0300)]
linux(4): Change semtimedop syscall definition to match Linux actual one.
MFC after: 2 weeks
(cherry picked from commit
f19c4e23413d9e2661d09120bb5434c54593bb8e )
Dmitry Chagin [Fri, 6 May 2022 17:00:13 +0000 (20:00 +0300)]
linux(4): Retire linux_semop implementation.
In i386 Linux semop called via ipc() multiplexor, so use kern_semop
directly from multiplexor.
MFC after: 2 weeks
(cherry picked from commit
f48a68874bf4503a18c0c55887a028dab0a4600f )
Dmitry Chagin [Fri, 17 Jun 2022 19:34:47 +0000 (22:34 +0300)]
linux(4): Regen for semop syscall.
MFC after: 2 weeks
(cherry picked from commit
cd875998dc236eb531753bba7296a834de57d99d )
Dmitry Chagin [Fri, 6 May 2022 16:58:53 +0000 (19:58 +0300)]
linux(4): Call semop directly.
As the Linux semop syscall is not defined in i386, and as it is equal
to the native semop syscall, call it directly.
Fix semop definition to match Linux actual one - nsops is size_t type.
MFC after: 2 weeks
(cherry picked from commit
f686092664ee6c2c287f77f716db4d72e451c780 )
Dmitry Chagin [Fri, 6 May 2022 16:51:48 +0000 (19:51 +0300)]
sysvsem: Add a timeout argument to the semop.
For future use in the Linux emulation layer for the semtimedop syscall
split the sys_semop syscall into two counterparts and add
struct timespec *timeout argument to the last one.
Reviewed by: jhb, kib
Differential revision: https://reviews.freebsd.org/D35121
MFC after: 2 weeks
(cherry picked from commit
f04534f5c84e58009efbb7f378803da3f33585b9 )
Dmitry Chagin [Wed, 4 May 2022 10:06:53 +0000 (13:06 +0300)]
linux(4): Implement recvmmsg_time64 syscall.
MFC after: 2 weeks
(cherry picked from commit
1744f14e26c99af704650922e19e6934aa9a1271 )
Dmitry Chagin [Fri, 17 Jun 2022 19:34:42 +0000 (22:34 +0300)]
linux(4): Regen for recvmmsg_time64 syscall.
MFC after: 2 weeks
(cherry picked from commit
79695e9585fafb4fd7240d8183839852f6c5d43a )
Dmitry Chagin [Wed, 4 May 2022 10:06:52 +0000 (13:06 +0300)]
linux(4): Change recvmmsg_time64 syscall definition to match Linux actual one.
MFC after: 2 weeks
(cherry picked from commit
17ccda0039229d884b9f624815775893889d161e )
Dmitry Chagin [Wed, 4 May 2022 10:06:52 +0000 (13:06 +0300)]
linux(4): Implement timerfd_gettime64 syscall.
MFC after: 2 weeks
(cherry picked from commit
ce9f8d6ab00c491f84a021b23a28a1484ef817d8 )
Dmitry Chagin [Fri, 17 Jun 2022 19:34:36 +0000 (22:34 +0300)]
linux(4): Regen for timerfd_gettime64 syscall.
MFC after: 2 weeks
(cherry picked from commit
ac80ae931323411c8a034624b0369eb6c0fe0934 )
Dmitry Chagin [Wed, 4 May 2022 10:06:51 +0000 (13:06 +0300)]
linux(4): Change timerfd_gettime64 syscall definition to match Linux actual one.
MFC after: 2 weeks
(cherry picked from commit
16aefe5ba3923991088f1a46e9d493664421a0a2 )
Dmitry Chagin [Wed, 4 May 2022 10:06:50 +0000 (13:06 +0300)]
linux(4): Implement timerfd_settime64 syscall.
MFC after: 2weeks
(cherry picked from commit
b1f0b08d932005a574411c829422e81223df14da )
Dmitry Chagin [Fri, 17 Jun 2022 19:34:31 +0000 (22:34 +0300)]
linux(4): Regen for timerfd_settime64 syscall.
MFC after: 2 weeks
(cherry picked from commit
f4228fbb4eb85601e4e857446642372f7d74d6e9 )
Dmitry Chagin [Wed, 4 May 2022 10:06:50 +0000 (13:06 +0300)]
linux(4): Change timerfd_settime64 syscall definition to match Linux actual one.
MFC after: 2 weeks
(cherry picked from commit
8545bcff313f39665fbb26dbc2a727fd481018b2 )
Dmitry Chagin [Wed, 4 May 2022 10:06:49 +0000 (13:06 +0300)]
linux(4): Implement timer_settime64 syscall.
MFC after: 2 weeks
(cherry picked from commit
a1fd2911ddb06c1a2d23ebb636a46bc20ca498e7 )
Dmitry Chagin [Fri, 17 Jun 2022 19:34:26 +0000 (22:34 +0300)]
linux(4): Regen for timer_settime64 syscall.
MFC after: 2 weeks
(cherry picked from commit
9038a0b74cf74c73cea635ae2fff51706cc9ab33 )
Dmitry Chagin [Wed, 4 May 2022 10:06:48 +0000 (13:06 +0300)]
linux(4): Change timer_settime64 syscall definition to match Linux actual one.
MFC after: 2 weeks
(cherry picked from commit
1508b1b6a022592e214a2ed2ed52e6100e84de35 )
Dmitry Chagin [Wed, 4 May 2022 10:06:48 +0000 (13:06 +0300)]
linux(4): Implement timer_gettime64 syscall.
MFC after: 2 weeks
(cherry picked from commit
783c1bd8cb0cf02f2cfb95418b0a115ed975086a )
Dmitry Chagin [Fri, 17 Jun 2022 19:34:20 +0000 (22:34 +0300)]
linux(4): Regen for timer_gettime64 syscall.
MFC after: 2 weeks
(cherry picked from commit
1cccef6dff13f4854ac75c243c36317ccd4defc1 )
Dmitry Chagin [Wed, 4 May 2022 10:06:47 +0000 (13:06 +0300)]
linux(4): Change timer_gettime64 syscall definition to match Linux actual one.
MFC after: 2 weeks
(cherry picked from commit
ccec96033c5aa2f1dfd6c736daf3e493c2272af3 )
Dmitry Chagin [Wed, 4 May 2022 10:06:47 +0000 (13:06 +0300)]
linux(4): Implement sched_rr_get_interval_time64 syscall.
MFC after: 2 weeks
(cherry picked from commit
8c84ca657bb343b73f315520ac3cabc43c5a67ec )
Dmitry Chagin [Fri, 17 Jun 2022 19:34:15 +0000 (22:34 +0300)]
linux(4): Regen for sched_rr_get_interval_time64 syscall.
MFC after: 2 weeks
(cherry picked from commit
cdddbb77c30b7f518f7ac78b113a823c3ca0cd11 )
Dmitry Chagin [Wed, 4 May 2022 10:06:45 +0000 (13:06 +0300)]
linux(4): Change sched_rr_get_interval_time64 syscall definition to match Linux actual one.
MFC after: 2 weeks
(cherry picked from commit
7b520c0b3c50a1a0025ee6cdbd457a1b6e6c2a0c )
Dmitry Chagin [Tue, 26 Apr 2022 16:40:59 +0000 (19:40 +0300)]
Remove dead code.
is_physical_memory() dead since
235a54de .
Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35056
MFC after: 2 weeks
(cherry picked from commit
fe2c9f83a6dc1cc62da177a765ce8a265894b2cd )
Dmitry Chagin [Tue, 26 Apr 2022 16:35:59 +0000 (19:35 +0300)]
linux(4): Add epoll_pwai2 syscall.
MFC after: 2 weeks
(cherry picked from commit
e00aad1042e7163865763b42d8d72137eeb9df63 )
Dmitry Chagin [Fri, 17 Jun 2022 19:34:09 +0000 (22:34 +0300)]
linux(4): Regen for epoll_pwait2 syscall.
(cherry picked from commit
df377f1fb8dd92a1839bc578aac46d2cdf1b5b84 )
Dmitry Chagin [Tue, 26 Apr 2022 16:35:57 +0000 (19:35 +0300)]
linux(4): Change epoll_pwait2 syscall definition to match Linux actual one.
MFC after: 2 weeks
(cherry picked from commit
81b0b7dc0c624c2e086943822beda0b08a12e252 )
Dmitry Chagin [Tue, 26 Apr 2022 16:35:57 +0000 (19:35 +0300)]
linux(4): Add copyin_sigset() helper.
MFC after: 2 weeks
(cherry picked from commit
3923e632094a7e4cc66cd8e68964b9cb495119e2 )
Dmitry Chagin [Tue, 26 Apr 2022 16:35:56 +0000 (19:35 +0300)]
linux(4): Add linux_epoll_pwait_ts() helper for future use.
MFC after: 2 weeks
(cherry picked from commit
27a25179c8356d58b5df6303d850050122f020c6 )
Dmitry Chagin [Tue, 26 Apr 2022 16:35:56 +0000 (19:35 +0300)]
linux(4): Copyout pselect timeout.
According to pselect6 manual, on error timeout becomes undefined, by fact
Linux modifies the timeout and ignore EFAULT error if so.
MFC after: 2 weeks
(cherry picked from commit
5171ed79f6d1fc3948a7ebfb32b02d698224c29b )
Dmitry Chagin [Tue, 26 Apr 2022 16:35:56 +0000 (19:35 +0300)]
linux(4): Add a simple rseq syscall implementation.
To avoid annoyng messages from glibc-2.35 test suite add the simple
implementation of rseq syscall which is do nothing for now.
I plan to implement it if and when the API stabilizes.
MFC after: 2 weeks
(cherry picked from commit
ee55d560e89ac8de37def993a13d2582638273b7 )
Dmitry Chagin [Fri, 17 Jun 2022 19:34:03 +0000 (22:34 +0300)]
linux(4): Regen for rseq syscall.
(cherry picked from commit
75e409495f67a39114e09224b8915cb0ecc481c4 )
Dmitry Chagin [Tue, 26 Apr 2022 16:35:54 +0000 (19:35 +0300)]
linux(4): Change rseq syscall definition to match Linux actual one.
MFC after: 2 weeks
(cherry picked from commit
f202f35db00cb9908b143a5a67f58ee95310f419 )
Dmitry Chagin [Mon, 25 Apr 2022 11:45:05 +0000 (14:45 +0300)]
Fix build after
128b9bf9
MFC after: 2 weeks
(cherry picked from commit
0ced2aef06760bfc57248482045c997be718b207 )
Dmitry Chagin [Fri, 17 Jun 2022 19:33:56 +0000 (22:33 +0300)]
Add tests for sigwait family syscalls.
MFC after: 2 weeks
(cherry picked from commit
128b9bf96cae36c33b45a4d418ff502497bbb834 )
Dmitry Chagin [Mon, 25 Apr 2022 07:23:15 +0000 (10:23 +0300)]
sigtimedwait: Prevent timeout math overflows.
Our kern_sigtimedwait() calculates absolute sleep timo value as 'uptime+timeout'.
So, when the user specifies a big timeout value (LONG_MAX), the calculated
timo can be less the the current uptime value.
In that case kern_sigtimedwait() returns EAGAIN instead of EINTR, if
unblocked signal was caught.
While here switch to a high-precision sleep method.
Reviewed by: mav, kib
In collaboration with: mav
Differential revision: https://reviews.freebsd.org/D34981
MFC after: 2 weeks
(cherry picked from commit
4a700f3c329a48f3a20fd576900820e293c8cad7 )
Dmitry Chagin [Mon, 25 Apr 2022 07:22:51 +0000 (10:22 +0300)]
linux(4): Refactor signal send methods.
Created a couple of helpers to send signals to the specific thread or to
the whole process. Use helpers in the corresponding syscalls.
This fixes the confusion where a signal destined for a whole process
was sent to a specific thread and vice versa.
There is an exclusion for the linux_kill() syscall that takes a pid
argument and should send a signal to the whole process, but I know
at least one example where kill() takes tid.
MFC after: 2 weeks
(cherry picked from commit
6201a50d0d6d98633dba3db12dea2dfe95295e0e )
Dmitry Chagin [Mon, 25 Apr 2022 07:21:51 +0000 (10:21 +0300)]
linux(4): Check that the thread tid in the thread group pid in linux_tdfind().
MFC after: 2 weeks
(cherry picked from commit
fe894a370556e5b173a8893cdcde6323ff79cc57 )
Dmitry Chagin [Mon, 25 Apr 2022 07:21:20 +0000 (10:21 +0300)]
linux(4): Microoptimize bsd_to_linux_sockaddr().
Differential Revision: https://reviews.freebsd.org/D34725
MFC after: 2 weeks
(cherry picked from commit
bbddd5881d1826a366d09d1e156ec6b64d3715e5 )
Dmitry Chagin [Mon, 25 Apr 2022 07:20:54 +0000 (10:20 +0300)]
Add timespecvalid_interval macro and use it.
Reviewed by: jhb, imp (early rev)
Differential revision: https://reviews.freebsd.org/D34848
MFC after: 2 weeks
(cherry picked from commit
91e7bdcdcf10684098e213e311cdafcd7a0ac983 )