Commit graph

140486 commits

Author SHA1 Message Date
Dmitry Chagin
ff95f72dee linux(4): Regen for timer_gettime64 syscall.
MFC after:      2 weeks

(cherry picked from commit 1cccef6dff)
2022-06-17 22:34:20 +03:00
Dmitry Chagin
f925361540 linux(4): Change timer_gettime64 syscall definition to match Linux actual one.
MFC after:		2 weeks

(cherry picked from commit ccec96033c)
2022-06-17 22:34:16 +03:00
Dmitry Chagin
b2f336bb73 linux(4): Implement sched_rr_get_interval_time64 syscall.
MFC after:		2 weeks

(cherry picked from commit 8c84ca657b)
2022-06-17 22:34:15 +03:00
Dmitry Chagin
5c06b4de43 linux(4): Regen for sched_rr_get_interval_time64 syscall.
MFC after:      2 weeks

(cherry picked from commit cdddbb77c3)
2022-06-17 22:34:15 +03:00
Dmitry Chagin
4b05f04fb1 linux(4): Change sched_rr_get_interval_time64 syscall definition to match Linux actual one.
MFC after:		2 weeks

(cherry picked from commit 7b520c0b3c)
2022-06-17 22:34:11 +03:00
Dmitry Chagin
cca86d9418 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 fe2c9f83a6)
2022-06-17 22:34:10 +03:00
Dmitry Chagin
9d4b1eba0e linux(4): Add epoll_pwai2 syscall.
MFC after:	2 weeks

(cherry picked from commit e00aad1042)
2022-06-17 22:34:10 +03:00
Dmitry Chagin
4b4dac6ce8 linux(4): Regen for epoll_pwait2 syscall.
(cherry picked from commit df377f1fb8)
2022-06-17 22:34:09 +03:00
Dmitry Chagin
7a865d8861 linux(4): Change epoll_pwait2 syscall definition to match Linux actual one.
MFC after:	2 weeks

(cherry picked from commit 81b0b7dc0c)
2022-06-17 22:34:05 +03:00
Dmitry Chagin
92870cb499 linux(4): Add copyin_sigset() helper.
MFC after:	2 weeks

(cherry picked from commit 3923e63209)
2022-06-17 22:34:04 +03:00
Dmitry Chagin
2d05c4f018 linux(4): Add linux_epoll_pwait_ts() helper for future use.
MFC after:	2 weeks

(cherry picked from commit 27a25179c8)
2022-06-17 22:34:04 +03:00
Dmitry Chagin
c78e5c4c6a 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 5171ed79f6)
2022-06-17 22:34:04 +03:00
Dmitry Chagin
302cff0ef9 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 ee55d560e8)
2022-06-17 22:34:03 +03:00
Dmitry Chagin
b203abf47a linux(4): Regen for rseq syscall.
(cherry picked from commit 75e409495f)
2022-06-17 22:34:03 +03:00
Dmitry Chagin
24c5e6eb7b linux(4): Change rseq syscall definition to match Linux actual one.
MFC after:	2 weeks

(cherry picked from commit f202f35db0)
2022-06-17 22:33:57 +03:00
Dmitry Chagin
3130fd2daa 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 4a700f3c32)
2022-06-17 22:33:55 +03:00
Dmitry Chagin
7056934698 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 6201a50d0d)
2022-06-17 22:33:55 +03:00
Dmitry Chagin
e4de536940 linux(4): Check that the thread tid in the thread group pid in linux_tdfind().
MFC after:		2 weeks

(cherry picked from commit fe894a3705)
2022-06-17 22:33:54 +03:00
Dmitry Chagin
cadaecc91e linux(4): Microoptimize bsd_to_linux_sockaddr().
Differential Revision:	https://reviews.freebsd.org/D34725
MFC after:		2 weeks

(cherry picked from commit bbddd5881d)
2022-06-17 22:33:54 +03:00
Dmitry Chagin
c5789e62ba 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 91e7bdcdcf)
2022-06-17 22:33:53 +03:00
Dmitry Chagin
c3dfbacbe9 linux(4): Copyout actual size of addr to the user space in accept().
Differential Revision:	https://reviews.freebsd.org/D34727

(cherry picked from commit 673bce11ce)
2022-06-17 22:33:52 +03:00
Dmitry Chagin
ecf8f49968 linux(4): Limit user-supplied sockaddr length in recvfrom().
Differential Revision:	https://reviews.freebsd.org/D34726

(cherry picked from commit bb0f644cd6)
2022-06-17 22:33:52 +03:00
Dmitry Chagin
543eaf070e linux(4): Remove unnecessary PTRIN().
(cherry picked from commit 68bfaefb3d)
2022-06-17 22:33:52 +03:00
Dmitry Chagin
61337dfb34 linux(4): Handle SO_DOMAIN in getsockopt syscall.
Differential revision:	https://reviews.freebsd.org/D34714

(cherry picked from commit cf312f799a)
2022-06-17 22:33:51 +03:00
Dmitry Chagin
85575b7e0c getdirentries: return ENOENT for unlinked but still open directory.
To be more compatible to IEEE Std 1003.1-2008 (“POSIX.1”).

Reviewed by:            mjg, Pau Amma (doc)
Differential revision:  https://reviews.freebsd.org/D34680
MFC after:              2 weeks

(cherry picked from commit c6487446d7)
2022-06-17 22:33:51 +03:00
Dmitry Chagin
d33fba34ab linux(4): Prevent an attempt to copy an uninitialized source address.
PR:			259380
MFC after:		3 days

(cherry picked from commit bb46e9b510)
2022-06-17 22:33:50 +03:00
Fernando Apesteguía
c43c6efaee [linprocfs] add sys/kernel/random/boot_id
This file holds a UUID that is invariant for every boot. In our case, it is
invariant per mount.

PR:	262369
Reported by:	sodynet1@gmail.com
Approved by:	dchagin@
Differential Revision:	https://reviews.freebsd.org/D34860

(cherry picked from commit 0f2041a5b0)
2022-06-17 22:33:50 +03:00
John Baldwin
d6e3208301 i386 linux: Remove unused variables.
(cherry picked from commit 9e70163017)
2022-06-17 22:33:49 +03:00
Dmitry Chagin
9f870e779c linux(4): Fix a typo in itimerspec conversion routine.
MFC after:	3 days

(cherry picked from commit 0938d04a2c)
2022-06-17 22:33:49 +03:00
Dmitry Chagin
6ea301ef77 linsysfs: plug set-but-not-used vars.
MFC after:	2 weeks

(cherry picked from commit bafe3b8804)
2022-06-17 22:33:49 +03:00
Dmitry Chagin
ac33f043f6 linux(4): Cleanup empty lines.
MFC after:		2 weeks

(cherry picked from commit 09d60bfae5)
2022-06-17 22:33:48 +03:00
Dmitry Chagin
c4ca1d2a27 linux(4): Fix KASSERT message.
MFC after:		2 weeks

(cherry picked from commit 4e1e83461b)
2022-06-17 22:33:48 +03:00
Dmitry Chagin
aeddbb898e linux(4): readlink should fail if bufzis <= 0.
MFC after:		2 weeks

(cherry picked from commit d6ccce0aa2)
2022-06-17 22:33:48 +03:00
Dmitry Chagin
708fc30050 linprocfs: Add /proc/self/oom_score_adj.
To avoid annoyng messages from LTP test suites add the simple
implementation of /proc/self/oom_score_adj which is do nothing.

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

(cherry picked from commit b7df7b987e)
2022-06-17 22:33:47 +03:00
Dmitry Chagin
82fa7c3b83 linux(4): Add compat.linux32.emulate_i386 knob.
Historically 32-bit Linuxulator under amd64 emulated the real i386
behavior. Since 3d8dd983 the old i386 Linux world can't be used under
amd64 Linuxulator as it don't know anything about amd64 machine (which
is returned now by newuname() syscall). So, add a knob to allow to swith
the behavior and use i386 Linux binaries on amd64.
Set knob to the new behavior as I think this is common to the modern
Linux distros.

Reviewed by:		Pau Amma (doc), emaste
Differential revision:	https://reviews.freebsd.org/D34708
MFC after:		2 weeks

(cherry picked from commit d5dc757e84)
2022-06-17 22:33:47 +03:00
Dmitry Chagin
71d5b525f5 linux(4): Fixup miscalculation of d_off of struct dirent in getdents() syscalls.
Avoid calculating d_off value as it is specific to the underlying filesystem
and can be used by others API, like lseek(), seekdir() as input offset.

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

(cherry picked from commit 099fa2feb3)
2022-06-17 22:33:46 +03:00
Dmitry Chagin
ccbef519e0 linux(4): wait4() returns ESRCH if pid is INT_MIN.
Weird and undocumented patch was added to the Linux kernel in 2017,
fixes wait403 LTP test.

MFC after:	2 weeks

(cherry picked from commit 9103c5582a)
2022-06-17 22:33:46 +03:00
Dmitry Chagin
65d3f90d13 linux(4): Rid unused defines from linux_mib.
Reviewed by:		trasz
Differential revision:  https://reviews.freebsd.org/D31591
MFC after:		2 weeks

(cherry picked from commit 5bcf0f7cd7)
2022-06-17 22:33:46 +03:00
Dmitry Chagin
cbb2112dca linux(4): Fixup waitid handling P_PGID idtype.
Since Linux 5.4, if id is zero, then wait for any child that is in the same
process grop as the caller's process group.

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

(cherry picked from commit 4e3aefb923)
2022-06-17 22:33:45 +03:00
Dmitry Chagin
2c029214d3 linux(4): Return ENOSYS for unsupported P_PIDFD waitid idtype.
Reviewed by:		emaste
Differential revision:  https://reviews.freebsd.org/D31559
MFC after:		2 weeks

(cherry picked from commit be1e4a0bdf)
2022-06-17 22:33:45 +03:00
Dmitry Chagin
638a0649cf linux(4): Add support for __WALL wait option bit.
As FreeBSD does not have __WALL option bit analogue explicitly set all
possible option bits to emulate Linux __WALL wait option bit.

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

(cherry picked from commit c7ef7c3fac)
2022-06-17 22:33:45 +03:00
Dmitry Chagin
7df3421cb6 linux(4): Fixup options value validation in linux_waitid().
Reviewed by:		emaste
Differential revision:  https://reviews.freebsd.org/D31554
MFC after:		2 weeks

(cherry picked from commit d7e1e138ec)
2022-06-17 22:33:44 +03:00
Dmitry Chagin
de1382dc4b linux(4): Eliminate bogus options value check validation.
The kernel do it for us.

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

(cherry picked from commit 2fd480b318)
2022-06-17 22:33:44 +03:00
Dmitry Chagin
721dcd87ab linux(4): Consolidate wait* facility into linux_common_wait().
Also fix bug in waitid() implementation, use wru_self not wru_children.

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

(cherry picked from commit 0c6b1ff7de)
2022-06-17 22:33:44 +03:00
Mateusz Guzik
6a8133e329 linux: plug set-but-not-unused vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 74a0e24f07)
2022-06-17 22:33:43 +03:00
Dmitry Chagin
221d908864 linux(4): Add AT_NO_AUTOMOUNT to statx.
Specific to Linux AT_NO_AUTOMOUNT flag tells the kernel to not automount the
terminal component of pathname if it is a directory that is an automount point.
As it is the default for FreeBSD silencly ignore this flag.

glibc-2.34 uses this flag in the stat64 system calls which is used by i386.

Reviewed by:		trasz
Differential revision:  https://reviews.freebsd.org/D31524
MFC after:		2 weeks

(cherry picked from commit ff39d74aa9)
2022-06-17 22:33:43 +03:00
Dmitry Chagin
a55eb1bdbf linprocfs: Eliminate bogus comment (KSE).
Reviewed by:		trasz, emaste
Differential revision:	https://reviews.freebsd.org/D31525
MFC after:		2 weeks

(cherry picked from commit aae8ae5ea5)
2022-06-17 22:33:42 +03:00
John Baldwin
6cc60a705f linux_copyout_strings: Use PROC_PS_STRINGS().
Reviewed by:	markj
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D34173

(cherry picked from commit 6bea696af2)
2022-06-17 22:33:42 +03:00
Mateusz Guzik
e09814f1f2 linprocfs: plug set-but-not-unused vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit ae3d955404)
2022-06-17 22:33:42 +03:00
Dmitry Chagin
00a4cd973c pseudofs: Destroy vncache hashtbl on pseudofs module unload.
Reviewed by:		mjg, kib
Differential Revision:	https://reviews.freebsd.org/D31605
MFC after:		2 weeks

(cherry picked from commit 0f74021fb6)
2022-06-17 22:33:41 +03:00