Commit graph

140327 commits

Author SHA1 Message Date
Dmitry Chagin
b5bfa2af4b linux(4): Regen for linux_poll system call.
MFC after:	2 weeks

(cherry picked from commit 8fe8bb7cb5)
2022-06-17 22:30:20 +03:00
Dmitry Chagin
b7289a2e08 linux(4): Implement poll system call via linux_common_ppol()
for the sake of converting events to/from native.

MFC after:	2 weeks

(cherry picked from commit 2eff670fde)
2022-06-17 22:30:19 +03:00
Dmitry Chagin
b2deba043c linux(4): Rework Linux ppoll system call.
For now the Linux emulation layer uses in kernel ppoll(2) without
conversion of user supplied fd 'events', and does not convert the
kernel supplied fd 'revents'.

At least POLLRDHUP is handled by FreeBSD differently than by
Linux. Seems that Linux silencly ignores POLLRDHUP on non socket fd's
unlike FreeBSD, which does more strictly check and fails.

Rework the Linux ppoll, using kern_poll and converting 'events'
and 'revents' values.
While here, move poll events defines to the MI part of code as they
mostly identical on all arches except arm.

Differential Revision:	https://reviews.freebsd.org/D30716
MFC after:		2 weeks

(cherry picked from commit 26795a0378)
2022-06-17 22:30:19 +03:00
Dmitry Chagin
d3bd2f1f03 sg: get rid of unused include.
sg driver does not depends on the Linuxulator any more.

Reviewed by:		imp
Differential Revision:	https://reviews.freebsd.org/D30750
MFC after:		2 weeks

(cherry picked from commit 8345c513c5)
2022-06-17 22:30:19 +03:00
Edward Tomasz Napierala
b27865547a linux: improve reporting for unsupported syscall flags
Filter out the flags we do support; previously we would print
out the flag value verbatim.

Reviewed By:	dchagin
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D30693

(cherry picked from commit 9d167945e8)
2022-06-17 22:30:18 +03:00
Dmitry Chagin
7e3a56d742 linux(4): Regen for ppoll_time64 system call.
MFC after:	2 weeks

(cherry picked from commit 89f15b79b1)
2022-06-17 22:30:18 +03:00
Dmitry Chagin
ad561d55e4 linux(4): Implement ppoll_time64 system call.
MFC after:	2 weeks

(cherry picked from commit ed61e0ce1d)
2022-06-17 22:30:17 +03:00
Dmitry Chagin
3ae9b75f6b Split kern_poll() on two counterparts.
The kern_poll_kfds() operates on clear kernel data, kfds points to an
array in the kernel, while kern_poll() operates on user supplied pollfd.
Move nfds check to kern_poll_maxfds().

No functional changes, it's for future use in the Linux emulation layer.

Reviewd by:		kib
Differential Revision:	https://reviews.freebsd.org/D30690
MFC after:		2 weeks

(cherry picked from commit e884512ad1)
2022-06-17 22:30:17 +03:00
Dmitry Chagin
9616bcffa1 linux(4): Regen for pselect6_time64 system call.
MFC after:	2 weeks

(cherry picked from commit 981a60f112)
2022-06-17 22:30:17 +03:00
Dmitry Chagin
4250154ede linux(4): Implement pselect6_time64 system call.
MFC after:	2 weeks

(cherry picked from commit f6d075ecd7)
2022-06-17 22:30:16 +03:00
Dmitry Chagin
efb9538e1f linux(4): Regen for rt_sigtimedwait_time64 system call.
MFC after:	2 weeks

(cherry picked from commit c002529000)
2022-06-17 22:30:16 +03:00
Dmitry Chagin
2eae70753e linux(4): Implement rt_sigtimedwait_time64 system call.
It still does not work as intended, awaits D30675.

MFC after:	2 weeks

(cherry picked from commit db4a1f331b)
2022-06-17 22:30:15 +03:00
Dmitry Chagin
f83465c2e7 linux(4): Regen for futex_time64 system call.
MFC after:	2 weeks

(cherry picked from commit 985978806e)
2022-06-17 22:30:15 +03:00
Dmitry Chagin
75ed1704e3 linux(4): Implement futex_time64 system call.
MFC after:	2 weeks

(cherry picked from commit 2e46d0c3d9)
2022-06-17 22:30:15 +03:00
Dmitry Chagin
92b1cf8572 linux(4): Regen for futex system call.
MFC after:	2 weeks

(cherry picked from commit ee64d98204)
2022-06-17 22:30:14 +03:00
Dmitry Chagin
f348d6732b linux(4): Change Linux futex syscall definition to match Linux actual one.
MFC after:	2 weeks

(cherry picked from commit 3c1de151e3)
2022-06-17 22:30:14 +03:00
Dmitry Chagin
56161ea24c Fix copyright, remove "all rights reserved".
The eventfd code was written by me, rdivacky@ copyrigth applicable only
to epoll part of the Linuxulator code. Roman is ok to retire his copyright
from sys/kern/sys_eventfd.c and 'All rights reserved.' lines from
sys/compat/linux/linux_event.[c|h] and sys/kern/sys_eventfd.c files.

Reviewed by:		kib, emaste
Approved by:		rdivacky
Differential Revision:	https://reviews.freebsd.org/D30677
MFC after:		2 weeks

(cherry picked from commit f570a6723e)
2022-06-17 22:28:01 +03:00
Dmitry Chagin
7f90bce852 linux(4): Fix clock_nanosleep return value for unsupported clockid.
The Linux clock_nanosleep() returns ENOTSUP for CLOCK_THREAD_CPUTIME_ID.
This silence one of the LTP clock_nanosleep tests.

MFC after:	2 weeks

(cherry picked from commit 66e73ce737)
2022-06-17 22:28:01 +03:00
Dmitry Chagin
27c31bdac5 linux(4): optimize ksiginfo to siginfo conversion.
Retire ksiginfo_to_lsiginfo function, use siginfo_to_lsiginfo instead.
Convert rt_sigtimedwait siginfo variables to well known names.

MFC after:	2 weeks

(cherry picked from commit f4e801085b)
2022-06-17 22:28:00 +03:00
Dmitry Chagin
fc13bfeae5 linux(4): Properly convert linux siginfo to native siginfo
add input validation.

MFC after:	2 weeks

(cherry picked from commit 9c1045ff00)
2022-06-17 22:28:00 +03:00
Dmitry Chagin
e58a9a565f Regen for ('0f8dab45404f347752470579feccc6d2739b9570') Linux
rt_sigtimedwait system call.

MFC after:	2 weeks

(cherry picked from commit e29ea22f70)
2022-06-17 22:27:59 +03:00
Dmitry Chagin
77935ceb59 linux(4): Fix timeout parameter of rt_sigtimedwait syscall, which is
timespec not a timeval.

MFC after:	2 weeks

(cherry picked from commit 0f8dab4540)
2022-06-17 22:27:59 +03:00
Dmitry Chagin
e13423cc78 Regen for ('6501370a7dfb358daf07555136742bc064e68cb7') Linux
clock_nanosleep_time64 system call.

MFC after:	2 weeks

(cherry picked from commit 56b187005c)
2022-06-17 22:27:59 +03:00
Dmitry Chagin
677bd84068 linux(4): Implement clock_nanosleep_time64 system call.
MFC after:	2 weeks

(cherry picked from commit 6501370a7d)
2022-06-17 22:27:58 +03:00
Dmitry Chagin
fd6647f64a Regen for ('187715a420237e1ed94dd5aef158eada7dcdc559') Linux
clock_getres_time64 system call.

MFC after:	2 weeks

(cherry picked from commit 773d9153c3)
2022-06-17 22:27:58 +03:00
Dmitry Chagin
58504e1710 linux(4): Implement clock_getres_time64 system call.
MFC after:	2 weeks

(cherry picked from commit 187715a420)
2022-06-17 22:27:57 +03:00
Dmitry Chagin
69bd490142 Regen for ('19f9a0e4df54f8d1e99234146024422bdcfa09ce') Linux
clock_settime64 system call.

MFC after:	2 weeks

(cherry picked from commit 82e3848654)
2022-06-17 22:27:57 +03:00
Dmitry Chagin
b004647240 linux(4): Implement clock_settime64 system call.
MFC after:	2 weeks

(cherry picked from commit 19f9a0e4df)
2022-06-17 22:27:57 +03:00
Dmitry Chagin
96b5459afb Regen for ('99b6f430698fa00a33184dd61591d8b6518ed9d3') Linux
clock_gettime64 system call.

MFC after:	2 weeks

(cherry picked from commit 9e07ae7a09)
2022-06-17 22:27:56 +03:00
Dmitry Chagin
ead9f9b1c4 linux(4): Implement clock_gettime64 system call.
MFC after:	2 weeks

(cherry picked from commit 99b6f43069)
2022-06-17 22:27:56 +03:00
Dmitry Chagin
d0bf82e69a Regen for ('e4bffb80bbc6a2e4b3be89aefcbd5bb2c2fc0ba0') Linux
utimensat_time64 syscall.

MFC after:	2 weeks

(cherry picked from commit ea7fa5583c)
2022-06-17 22:27:56 +03:00
Dmitry Chagin
43ee9ad567 linux(4): Implement utimensat_time64 system call.
MFC after:	2 weeks

(cherry picked from commit e4bffb80bb)
2022-06-17 22:27:55 +03:00
Dmitry Chagin
34670aeab4 linux(4): add struct timespec64 definition and conversion routine for
future use.

MFC after:		2 weeks

(cherry picked from commit bfcce1a9f6)
2022-06-17 22:27:55 +03:00
Dmitry Chagin
a836accf4c linux(4): Microoptimize futimesat, utimes, utime.
While here wrap long line.

Differential Revision:	https://reviews.freebsd.org/D30488
MFC after:		2 weeks

(cherry picked from commit 2a0fa277f6)
2022-06-17 22:22:17 +03:00
Dmitry Chagin
5e777d88c4 linux(4): Handle AT_EMPTY_PATH in the utimensat syscall.
Differential Revision:	https://reviews.freebsd.org/D30518
MFC after:		2 weeks

(cherry picked from commit b4f9b6eef2)
2022-06-17 22:22:16 +03:00
Dmitry Chagin
0f5f0e5e56 linux(4): Convert flags before use in utimensat.
Differential Revision:	https://reviews.freebsd.org/D30487
MFC after:		2 weeks

(cherry picked from commit 8505eb5dd8)
2022-06-17 22:22:16 +03:00
Dmitry Chagin
f62db98894 linux(4): Add F_GETPIPE_SZ fcntl operation which returns the capacity
of the pipe referred by fd.

Differential Revision:	https://reviews.freebsd.org/D30517
MFC after:		2 weeks

(cherry picked from commit a06c12464b)
2022-06-17 22:22:16 +03:00
Dmitry Chagin
587982d0d9 linux(4); Retire unnecessary __packed attribute from some struct's
definition.

Differential Revision:	https://reviews.freebsd.org/D30482
MFC after:		2 weeks

(cherry picked from commit 19593f775c)
2022-06-17 22:22:15 +03:00
Dmitry Chagin
e8c134531f linux: remove redundant SDT tracepoints
Remove all the 'entry' and 'return' probes; they clutter up the source
and are redundant to FBT.

Reviewed By:    dchagin
Sponsored By:   EPSRC
Differential Revision:  https://reviews.freebsd.org/D30040

(cherry picked from commit 5e8caee259)
2022-06-17 22:22:15 +03:00
Edward Tomasz Napierala
dd5708d524 linux(4): make linkat(2) handle AT_EMPTY_PATH
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D29974

(cherry picked from commit ee384b229d)
2022-06-17 22:22:14 +03:00
Edward Tomasz Napierala
734796a303 kern_linkat: modify to accept AT_ flags instead of FOLLOW/NOFOLLOW
This makes this API match other kern_xxxat() functions.

Reviewed By:	kib
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D29776

(cherry picked from commit 5d1d844a77)
2022-06-17 22:22:14 +03:00
Thomas Munro
5fac6f1687 poll(2): Add POLLRDHUP.
Teach poll(2) to support Linux-style POLLRDHUP events for sockets, if
requested.  Triggered when the remote peer shuts down writing or closes
its end.

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D29757

(cherry picked from commit 3aaaa2efde)
2022-06-17 22:22:13 +03:00
Edward Tomasz Napierala
ece62f6117 linux: drop unneeded casts
No functional changes.

Sponsored By:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28533

(cherry picked from commit cc743b050a)
2022-06-17 22:22:12 +03:00
Hans Petter Selasky
026e19496c urtw(4): Adjust all pause calls to use milliseconds instead of ticks.
Sponsored by:	NVIDIA Networking

(cherry picked from commit c6c22ebb38)
2022-06-16 04:55:52 +02:00
Hans Petter Selasky
1c5c1e4486 upgt(4): Adjust all pause calls to use milliseconds instead of ticks.
Sponsored by:	NVIDIA Networking

(cherry picked from commit bc2e447338)
2022-06-16 04:55:52 +02:00
Hans Petter Selasky
be3f667388 mlx4core: Use-after-free causes a resource leak in flow-steering detach
mlx4_QP_FLOW_STEERING_DETACH_wrapper first removes the steering
rule (which results in freeing the rule structure), and then
references a field in this struct (the qp number) when releasing the
busy-status on the rule's qp.

Since this memory was freed, it could reallocated and changed.
Therefore, the qp number in the struct may be incorrect,
so that we are releasing the incorrect qp. This leaves the rule's qp
in the busy state (and could possibly release an incorrect qp as well).

Fix this by saving the qp number in a local variable, for use after
removing the steering rule.

Linux commit:
3b01fe7f91c8e4f9afc4fae3c5af72c14958d2d8

PR:	     	264469
Sponsored by:	NVIDIA Networking

(cherry picked from commit dd2a8c8f72)
2022-06-14 11:39:23 +02:00
Hans Petter Selasky
43bcc15a42 ktls: Refer send tag pointer once.
So that the asserts and the actual code see the same values.

Differential revision:	https://reviews.freebsd.org/D32356
Sponsored by:	NVIDIA Networking

(cherry picked from commit f0fca64618)
2022-06-14 11:39:23 +02:00
Hans Petter Selasky
ac91cbc1f5 ng_ubt(4): Probe USB Bluetooth per USB interface and not per USB device.
PR:		264416
Sponsored by:	NVIDIA Networking

(cherry picked from commit 9d28e15e7b)
2022-06-14 11:39:23 +02:00
Konstantin Belousov
45ecb85824 fdescfs: allow chown/utime etc on fdescfs fd for underlying files opened with O_PATH
(cherry picked from commit 156745b42d)
2022-06-13 22:29:23 +03:00
Yuichiro NAITO
a39788bd28 smp: Use local copies of the setup function pointer and argument
No functional change intended.

PR:		264383
Reviewed by:	jhb, markj

(cherry picked from commit 8d95f50052)
2022-06-13 08:43:06 -04:00