Commit graph

288498 commits

Author SHA1 Message Date
Ihor Antonov 24fd3e969e daemon: move buffer into daemon_state
There is no reason for a buffer in listen_child()
to be a static function variable. The buffer and
its position are parts of the daemon state and should
live together with the rest of the state variables.

Reviewed by:	cperciva, kevans
2023-12-27 00:07:25 -06:00
Ihor Antonov 6ac7c9f06a daemon: remove redundant parameter from listen_child()
state already contains pipe fd

Reviewed by:	cperciva, kevans
2023-12-27 00:07:25 -06:00
Ihor Antonov a6f795cc89 daemon: fix clang-tidy warnings
Fixed narrowing conversions:
- strtol replaced with strtonum with range check
- read returns ssize_t
- kevent.data explicitly cast to int before passing into strerror

While we we're here:
- Defined and documented maximum restart delay.
- Fixed typo in a comment.
- Remove unused includes

Reviewed by:	cperciva, kevans
2023-12-27 00:07:25 -06:00
Gleb Smirnoff 97958f5d5c netlink: simplify socket destruction
Destroy the socket at the file descriptor close(2).  There is no
reason to linger for any longer, there are no external references.
Remove pr_detach method as nothing left to do after pr_close.
Remove pr_abort method as it shall never be executed for this type
of socket.

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D42521
2023-12-26 20:22:12 -08:00
Gleb Smirnoff f27aff8f7f linux/netlink: don't override sopt level
This override effectively prevents correct entering of netlink
protocol specific pr_ctloutput in sosetopt().

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D42520
2023-12-26 20:21:58 -08:00
Gleb Smirnoff dbc463119c netlink: remove unused structure 2023-12-26 20:21:58 -08:00
Alexander Motin 7bbac6419d Schedule fast taskqueue callouts on right CPU.
With fast taskqueues using direct callouts we can reduce number of
CPU wakeups by scheduling callout on current CPU if taskqueue calls
taskqueue_enqueue_timeout() on itself.  The trick won't work for
regular taskqueues, since the callout thread will occupy the CPU.
It also may not work in case of multiple threads since we do not
know which thread will pick the task, and we do not want excessive
callout migrations.  So we optimize only the other cases we can.

In practice this allows iichid(4) taskqueue to stay on CPU where
underlying ig4(4) interrupts are routed and to not kick CPU 0 with
timer interrupts on each sampling period (every 2nd/3rd sleep).

MFC after:	1 month
2023-12-26 22:55:24 -05:00
Pawel Jakub Dawidek 4cf4bc7334
Block cloning tests.
The test mostly focus on testing various corner cases.
The tests take a long time to run, so for the common.run runfile
we randomly select a hundred tests.
To run all the bclone tests, bclone.run runfile should be used.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #15631
2023-12-26 12:01:53 -08:00
Richard Scheffenegger a8b70cf260 netpfil: Use accessor functions and named constants for all tcphdr flags
Update all remaining references to the struct tcphdr th_x2 field.
This completes the compatibilty of various aspects with AccECN
(TH_AE), after the internal ipfw "re-checksum required" was moved
to use the TH_RES1 flag.

No functional change.

Reviewed By:           tuexen, #transport, glebius
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43172
2023-12-25 13:18:01 +01:00
Alexander Motin 358453ce9b iichid(4): Switch taskqueue to "fast"
While "fast" taskqueue may be more expensive due to spinlock use,
when used mainly for timeout tasks it allows to avoid extra context
switches to and from callout thread, that is even more expensive.

MFC after:	1 month
2023-12-26 19:36:34 -05:00
Alexander Motin a8f80c0c16 iichid(4): Unify two taskqueue tasks
taskqueue_enqueue_timeout(0) is equivalent to taskqueue_enqueue(),
so no need to create a separate periodic_task and event_task to run
exactly the same handler.

MFC after:	1 month
2023-12-26 19:28:56 -05:00
Mark Johnston ddc8576d29 fb: Explicitly handle errors when getting or setting a colour palette
In the VESA driver, simply ignore errors.  It is not clear to me how to
return them to userspace.

This is in preparation for annotating copyin() and related functions
with __result_use_check.

MFC after:	1 week
2023-12-26 19:01:26 -05:00
Mark Johnston b4a9e6d814 hptmv: Handle errors from copyout() in hpt_set_info()
This is in preparation for annotating copyin() and related functions
with __result_use_check.

MFC after:	1 week
2023-12-26 19:01:26 -05:00
Mark Johnston 2873d841f8 tdfx: Handle errors from copyin() and copyout()
This is in preparation for annotating copyin() and related functions
with __result_use_check.

MFC after:	1 week
2023-12-26 19:00:53 -05:00
Mark Johnston 916273680b ti: Handle errors from copyin() and copyout()
This is in preparation for annotating copyin() and related functions
with __result_use_check.

MFC after:	1 week
2023-12-26 18:58:24 -05:00
Zhan-Wei 10b84b88f0 cat: Use present tense
Event: Advanced UNIX Programming Course (Fall23) at NTHU.
Reviewed by: imp, lwhsu
Pull Request: https://github.com/freebsd/freebsd-src/pull/923
2023-12-26 16:53:40 -07:00
Daniel Tameling b3ab6b5029 ncal(1): print the correct option name when -B is specified twice
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/911
2023-12-26 16:45:26 -07:00
Elyes Haouas fd4fafa873 timeout_test.sh: Fix typo
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/906
2023-12-26 16:41:15 -07:00
Alex Xu (Hello71) c6ae97c44d sys: ${CFLAGS:N-flto} -> ${CFLAGS:N-flto*}
For the same reason as the original https://reviews.freebsd.org/D9659:
-flto=<N>, -flto=full, and -flto=thin also produce the GIMPLE/bitcode
which is not supported by genassym, so filter those out as well.

Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/898
2023-12-26 16:31:51 -07:00
Igor Ostapenko d4d14d965f atf-sh: fix comment typo
Signed-off-by: Igor Ostapenko <pm@igoro.pro>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/895
2023-12-26 16:24:42 -07:00
Rick Macklem 208f089d45 RELNOTES: Add an entry for commit 1a87880700 2023-12-26 15:01:42 -08:00
Rick Macklem a558130881 nfscl: Fix handling of expired Kerberos credentials (NFSv4.1/4.2)
If the NFS server detects that the Kerberos credentials provided
by a NFSv4.1/4.2 mount using sec=krb5[ip] have expired, the NFS
server replies with a krpc layer error of RPC_AUTHERROR.
When this happened, the client erroneously left the NFSv4.1/4.2
session slot busy, so that it could not be used by other RPCs.
If this happened for all session slots, the mount point would
hang.

This patch fixes the problem by releasing the session slot
and resetting its sequence# upon receiving a RPC_AUTHERROR
reply.

This bug only affects NFSv4.1/4.2 mounts using sec=krb5[ip],
but has existed since NFSv4.1 client support was added to
FreeBSD.

So, why has the bug remained undetected for so long?
I cannot be sure, but I suspect that, often, the client detected
the Kerberos credential expiration before attempting the RPC.
For this case, the client would not do the RPC and, as such,
there would be no busy session slot.  Also, no hang would
occur until all session slots are busied (64 for a FreeBSD
client/server), so many cases of the bug probably went undetected?
Also, use of sec=krb5[ip] mounts are not that common.

PR:	275905
Tested by:	Lexi <lexi.freebsd@le-fay.org>
MFC after:	1 week
2023-12-26 14:33:39 -08:00
Gleb Smirnoff 08c33cd94d hpts: avoid duplicate call to tcp_output()
Obtained from:	rrs
2023-12-26 13:09:09 -08:00
Konstantin Belousov bf7830d79d ofed: use ANSI C functions definitions in opensm/sm.c
Sponsored by:	NVidia networking
MFC after:	1 week
2023-12-26 21:22:01 +02:00
Kai-Yang Chen c1b12377a6 cat(1): Fix typo
Fix type: rebiuld -> rebuild in Makefile

Event: Advanced UNIX Programming Course (Fall’23) at NTHU.
Reviewed by: imp, Mina Galić
Pull Request: https://github.com/freebsd/freebsd-src/pull/933
2023-12-26 10:44:38 -07:00
Pei-Ju Chien c38fe1d282 sh(1): Fix typo
Remove extra 'ing' from 'bookinging.'

Event: Advanced UNIX Programming Course (Fall’23) at NTHU.
Reviewed by: imp, Mina Galić
Pull Request: https://github.com/freebsd/freebsd-src/pull/934
2023-12-26 10:44:35 -07:00
Kai-Yang Chen b6ae2ec7b0 sh(1): Fix typo
Event: Advanced UNIX Programming Course (Fall’23) at NTHU.
Reviewed by: imp, @rilysh on github
Pull Request: https://github.com/freebsd/freebsd-src/pull/935
2023-12-26 10:44:33 -07:00
WEININGCHIU 878bf23d37 sh(1): Fix typo
nozero -> non-zero

Event: Advanced UNIX Programming Course (Fall’23) at NTHU.
Reviewed by: imp, Mina Galić
Pull Request: https://github.com/freebsd/freebsd-src/pull/936
2023-12-26 10:33:14 -07:00
Minsoo Choo 896fd0d3f5 Remove SVN related Git attributes
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Reviewed by: imp, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/938
2023-12-26 10:28:28 -07:00
Minsoo Choo d2a736db13 Update MAINTAINERS for Git
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/937
2023-12-26 10:28:25 -07:00
Minsoo Choo 08ae26534e Update LOCKS for Git
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/937
2023-12-26 10:28:25 -07:00
Zhan-Wei f0d6447c0b pax: Add missing 'for' in comment.
Event: Advanced UNIX Programming Course (Fall23) at NTHU.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/941
2023-12-26 10:24:24 -07:00
Zhan-Wei ebb1fe4006 mv: Improve comment
Fix typo/grammar error: Use the singlar verb ending on exists.

Event: Advanced UNIX Programming Course (Fall23) at NTHU.
Reviewed by: imp, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/940
2023-12-26 10:24:22 -07:00
lherschi c327288e8e bluetooth: fix comment in bluetooth.device.conf
The default for discoverable is 'NO' not 'YES'. This now matches the man
page.

Event: Advanced UNIX Programming Course (Fall'23) at NTHU.
Reviewed by: imp, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/939
2023-12-26 10:24:19 -07:00
Pin-Yi Kuo 4185d1f76a diff(1): fix a typo
On the manpage of diff(1), "when" is mistyped to "wen".

Event: Advanced UNIX Programming Course (Fall'23) at NTHU.
Signed-off-by: Pin-Yi Kuo <kuokuoyiyi@gapp.nthu.edu.tw>
Reviewed by: imp, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/943
2023-12-26 10:07:55 -07:00
Pin-Yi Kuo e3d3e1ff7e df(1): fix a typo
On the manpage of df(1), "according" is mistyped into "acccording"

Event: Advanced UNIX Programming Course (Fall'23) at NTHU.
Signed-off-by: Pin-Yi Kuo <kuokuoyiyi@gapp.nthu.edu.tw>
Reviewed by: imp, zlei, Mina Galić
Pull Request: https://github.com/freebsd/freebsd-src/pull/944
2023-12-26 10:05:29 -07:00
rilysh 8f0498208d bhyve/audio.c: avoid re-calculating the length of dev_name
In the function audio_init(), strlen() is being called two times,
first to get the length of dev_name and second to use in memcpy().
Creating a local variable and keeping the length avoids this
re-calculation.

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/945
2023-12-26 09:36:31 -07:00
Che-Yu Chang 2aa186b3b0 gvinum(8): Fix a typo
On line 354, "go up from" is mistyped as "go up form".

Event: Advanced UNIX Programming Course (Fall’23) at NTHU.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/951
2023-12-26 09:12:27 -07:00
Che-Yu Chang f8f3b16b6c camcontrol(8): Fix typos
On line 748, "bigger than" is mistyped as "bigger then", and on line
765, "more than" is mistyped as "more then".

Event: Advanced UNIX Programming Course (Fall’23) at NTHU.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/949
2023-12-26 09:12:23 -07:00
Alexander Motin 5bc10feacc acpi_cpu: Reduce BUS_MASTER_RLD manipulations
Instead of setting and clearing BUS_MASTER_RLD register on every C3
state enter/exit, set it only once if the system supports C3 state
and we are going to "disable" bus master arbitration while in it.

This is what Linux does for the past 14 years, and for even more time
this register is not implemented in a relevant hardware.  Same time
since this is only a single bit in a bigger register, ACPI has to
do take a global lock and do read-modify-write for it, that is too
expensive, saved only by C3 not entered frequently, but enough to be
seen in idle system CPU profiles.

MFC after:	1 month
2023-12-25 21:43:20 -05:00
Mark Johnston 6adf554abd vmm: Fix handling of errors from subyte()
subyte() returns -1 upon an error, not an errno value.

MFC after:	1 week
Fixes:	e17eca3276 ("vmm: Avoid embedding cpuset_t ioctl ABIs")
2023-12-25 21:04:01 -05:00
Mark Johnston c38df501ce compat_freebsd4: Fix handling of errors from subyte()
Upon failure, subyte() returns -1, not an errno value.

MFC after:	1 week
2023-12-25 21:04:01 -05:00
Mark Johnston 74e713804f iscsi: Check for copyout errors in iscsi_ioctl_daemon_receive()
Reviewed by:	jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43148
2023-12-25 21:04:01 -05:00
Mark Johnston 099d25c354 nmount: Ignore errors when copying out an error string
In general we copy error strings as part of reporting an error from
lower layers, so if the copyout() fails there's nothing to do since we'd
prefer to preserve the original error.

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by:	olce, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43147
2023-12-25 21:04:01 -05:00
Mark Johnston bbf221e3e8 geom: Report copyout() errors in g_ctl_ioctl_ctl()
Despite the name, req->serror is used in some cases to copy non-error
messages to userspace.  So, report errors when copying out so long as
they don't clobber an earlier error.

Reviewed by:	mav, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43146
2023-12-25 21:04:01 -05:00
Mark Johnston 6cdff09c0d gntdev: Handle errors from suword32() in gntdev_alloc_gref()
Try to copy out output values before handling errors, and check that we
did so successfully.  In particular, it doesn't seem sensible to ignore
errors here, otherwise userspace won't have any way to refer to the
allocations.

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by:	royger
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43145
2023-12-25 21:04:01 -05:00
Mark Johnston 68cc77a3b7 mpr: Handle errors from copyout() in ioctl handlers
In preparation for adding a __result_use_check annotation to copyin()
and related functions, start checking for errors from copyout() in
the mpr(4) user command handler.  This should make it easier to catch
bugs.

Reviewed by:	imp, asomers
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D43177
2023-12-25 21:04:01 -05:00
Mark Johnston bcf4a7c7ac mps: Handle errors from copyout() in ioctl handlers
In preparation for adding a __result_use_check annotation to copyin()
and related functions, start checking for errors from copyout() in
the mps(4) user command handler.  This should make it easier to catch
bugs.

Reviewed by:	imp, asomers
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D43176
2023-12-25 21:04:01 -05:00
Mark Johnston 3379d9b5de umtx: Check for errors from suword32()
This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D43144
2023-12-25 21:04:01 -05:00
Mark Johnston f450277f7a thread: Ignore errors when copying out during thr_exit()
It does not seem reasonable to return to userspace after calling
umtx_thread_exit().

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by:	olce, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43143
2023-12-25 21:04:00 -05:00