Commit graph

270354 commits

Author SHA1 Message Date
Konstantin Belousov 25cda42a49 posix_spawn: add chdir-related non-portable actions
Namely posix_spawn_file_actions_addchdir_np and
posix_spawn_file_actions_addfchdir_np.

Reviewed by:	kevans, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33143
2021-11-30 03:43:54 +02:00
Konstantin Belousov 8ed1e4a5c1 posix_spawn(3), posix_spawn_file_actions_addopen(3): use .Fo/.Fc
to wrap too long lines with function prototypes.

Reviewed by:	kevans, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33143
2021-11-30 03:43:54 +02:00
Konstantin Belousov b239cc204a posix_spawn: style, use return ()
Reviewed by:	kevans, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33143
2021-11-30 03:43:54 +02:00
Konstantin Belousov adbaf1b443 posix_spawn.c: format fae_action anon enum more stylish
Reviewed by:	kevans, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33143
2021-11-30 03:43:54 +02:00
Alexander Motin f5b0083302 mpsutil: Fix data truncation by too short buffers.
Length of some string buffers was insufficient for cases of more that
99 targets per HBA or slots per enclosure.  Some others are tuned just
for better alignment.  While there also fix output formatting issues.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2021-11-29 20:20:03 -05:00
Daniel Ebdrup Jensen bd6dce978c rc.conf(5): Add _limits, _login_class, and _oomprotect
Add a few very useful variables that might easily be overlooked, since
they're only documented in rc.subr(8) which might not be the first place
that people look.

At least _oomprotect has existed since 11.0-RELEASE, and doesn't appear
to be very well-known. While the others aren't as new, in my estimation,
a lot more people would use them if they knew about them.

While here, also add a reference to rc.subr(8) and login.conf(5), and
sort the variables alphabetically.

Reported by: 	Daniel Dettlaff <dmilith at gmail.com>
Reviewed by:	ceri, gbe, 0mp, ygy, a.wolk, pauamma
2021-11-30 02:06:40 +01:00
Brooks Davis 0e765d9b08 syscalls: regen 2021-11-29 22:04:58 +00:00
Brooks Davis 6d37a1670b syscalls: mprotect does not take a const
The mprotect syscall decleration is not const.  I added this one
incorrectly in a944d28d0e.

Reported by:	kib
Reviewed by:	kib, imp
2021-11-29 22:04:47 +00:00
Brooks Davis 401eec3635 syscalls: regen 2021-11-29 22:04:44 +00:00
Brooks Davis a8efd4d1b3 syscalls: make syscall and __syscall SYSMUX
Rather than combining the declearation of nosys with the registration
of SYS_syscall, declare syscall(2) and __syscall(2) with the new
SYSMUX type in syscalls.master and declare nosys directly.  This
eliminates the last use of syscall aliases in the tree.

Reviewed by:	kib, imp
2021-11-29 22:04:44 +00:00
Brooks Davis d7f306c5be makesyscalls: add a new SYSMUX type
This type is for system call multiplexers (syscall(2), __syscall(2))
that don't have a normal handler and instead are handled in the
machine-dependent syscall code.

Reviewed by:	kib, imp
2021-11-29 22:04:43 +00:00
Brooks Davis 5c1835b1d4 syscalls: regen 2021-11-29 22:04:43 +00:00
Brooks Davis cffb55f0f3 syscalls: normalize exit
Declare the exit system call normally.  This results in the
implementation being named sys_exit rather than sys_sys_exit and
being decalred as returning an int.  Infact it does not return
at all because exit1 does not, so add an __unreachable() to let the
compiler know that.

Reviewed by:	kib, imp
2021-11-29 22:04:43 +00:00
Brooks Davis 7fb006e7d6 syscalls: regen 2021-11-29 22:04:42 +00:00
Brooks Davis 638c5fa8df syscalls: normalize (get|set)rlimit
Declare normal <foo>_args structs rather than going out of the way
to declare __<foo>_args.

Reviewed by:	kib, imp
2021-11-29 22:04:42 +00:00
Brooks Davis c2996f8ad9 syscalls: regen 2021-11-29 22:04:42 +00:00
Brooks Davis ba4e5253a3 syscalls: normalize orecvfrom and ogetsockname
Declare o<foo>_args rather than reusing the equivalent <foo>_args
structs.  Avoiding the addition of a new type isn't worth the
gratutious differences.

Reviewed by:	kib, imp
2021-11-29 22:04:42 +00:00
Brooks Davis 28f0471884 uipc: rework recvfrom, getsockname, getpeername
Stop using <foo>_args structs as part of internal kernel APIs.  Add
a kern_recvfrom and adjust getsockname and getpeername's equivalent
functions to take individual arguments rather than a uap pointer.

Adopt a convention from CheriBSD that a function interacting with
userspace pointers and sitting between the sys_<foo> syscall and
kern_<foo> implementation is named user_<foo>.

Reviewed by:	kib, imp
2021-11-29 22:04:41 +00:00
Brooks Davis 3660e76a22 syscalls: correct a couple style issues
Reviewed by:	kib, imp
2021-11-29 22:04:41 +00:00
Brooks Davis 33f9ea209e syscalls: add missing SAL annotations
freebsd7_shmctl was missing an annotation

Reviewed by:	kib, imp
2021-11-29 22:04:41 +00:00
Mark Johnston e0189cf66a elf.5: Document compressed section headers
Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33138
2021-11-29 13:57:24 -05:00
Mark Johnston 9ff084f0fa libelf: Link gelf_getchdr.3 to the build
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-11-29 13:57:24 -05:00
Mark Johnston 7a33723038 mii/dp83822phy: Remove a declaration for a non-existent function
Fixes:	0c9156faec ("Introduce DP83822 PHY driver")
2021-11-29 13:57:24 -05:00
Mark Johnston 1c732c8591 dummynet: Fix socket option length validation for IP_DUMMYNET3
The socket option handler tries to ensure that the option length is no
larger than some reasonable maximum, and no smaller than sizeof(struct
dn_id).  But the loaded option length is stored in an int, which is
converted to an unsigned integer for the comparison with a size_t, so
negative values are not caught and instead get passed to malloc().

Change the code to use a size_t for the buffer size.

Reviewed by:	kp
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33133
2021-11-29 13:57:24 -05:00
Mark Johnston d5ea04ee7b dummynet: Avoid an out-of-bounds read in do_config()
do_config() processes a buffer of variable-length dummynet commands.
The loop which processes this buffer loads the fixed-length header
before checking whether there are any bytes left to read, so it performs
a 4-byte read past the end of the buffer before terminating.

Restructure the loop to avoid this.

Reported by:	Jenkins (KASAN job)
Reviewed by:	kp
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33132
2021-11-29 13:57:24 -05:00
Neel Chauhan 3dd3a395ba ext2: Check for e2fs_first_dblock in ext2_compute_sb_data()
This prevents a kernel panic on a damaged ext2 superblock.

PR:			259107
Reported by:		Robert Morris <rtm@lcs.mit.edu>
Differential Revision:	https://reviews.freebsd.org/D33029
2021-11-29 09:53:45 -08:00
Bjoern A. Zeeb 1910048eb9 USB: add CYUSB330x to usbdevs
Add the Cypress dual USB3/2 HUB CYUSB330x as found in SolidRun's
HoneyComb to usbdevs.
2021-11-29 17:44:08 +00:00
Edward Tomasz Napierala a089c17d32 linux(4): Fix "set but not used" warnings
No functional changes.

Sponsored By:	EPSRC
2021-11-29 16:45:16 +00:00
Edward Tomasz Napierala fbf5246757 cfiscsi(4): Fix "set but not used" warning
No functional changes.

Sponsored By:	EPSRC
2021-11-29 16:45:15 +00:00
Edward Tomasz Napierala 1cde21402a cdceem(4): Fix "set but not used" warnings
No functional changes.

Sponsored By:	EPSRC
2021-11-29 16:45:15 +00:00
Konstantin Belousov 08bb51f8d6 shutdown: unmount filesystems after swapoff
Swap on file requires operational underlying mount, otherwise
swapoff_all() is guaranteed to panic due to the default strategy VOP for
reclaimed vnodes.

Reported and tested by:	peterj
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33147
2021-11-29 18:38:02 +02:00
Konstantin Belousov 0190c38b9d swapoff_one(): only check free pages count manually turning swap off
When swap is turned off due to system shutdown or reboot, ignore the
check.  Problem is that the check is not accurate by any means, free
page count can legitimately be low while system still able to page in
everything from the swap.  Then, we turn swap off if swapping on
real file or some non-standard geom provider, and typically panic
when system appears to actually need to unavailable page.

For syscall, it is better to be safe than sorry.

Reported and tested by:	peterj
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33147
2021-11-29 18:38:02 +02:00
Kornel Duleba 8661e085fb mmc: Fix HS200/HS400 capability check
HS200 and HS400 speeds can be enabled either with 1.2, or 1.8V signaling voltage.
Because of that we have four cabability flags: MMC_CAP_MMC_HS200_120,
MMC_CAP_MMC_HS200_180, MMC_CAP_MMC_HS400_120, MMC_CAP_MMC_HS400_180.

MMC logic only enables HS200/HS400 mode if both flags are set for the corresponding speed.
Fix that by being more permissive in host timing cap check.

Reviewed by: manu, mw
MFC after: 2 weeks
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D33130
2021-11-29 17:02:01 +01:00
Konstantin Belousov 181751a8b6 citrus_prop.c: do not ignore sign
In _citrus_prop_read_TYPE_func_ generated functions, do not ignore parsed
'-' sign, negate the value as appropriate.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33146
2021-11-29 17:39:54 +02:00
Konstantin Belousov a64a3b7988 libc/tests/stdlib/dynthr_mod/dynthr_mod.c: mark dummy as used
It receives the malloc() result, and we do not want the malloc() call
to be optimized out, which is allowed for hosted compiler.  Use dummy
for actual write though.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:51 +02:00
Konstantin Belousov e8b6309c70 netbsd h_raw.c test: fake use of sum to avoid warning
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:51 +02:00
Konstantin Belousov 631607ac29 t_mlock.c: Remove null_errno, it is write-only
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:51 +02:00
Konstantin Belousov c8a4a49d58 libc/stdio/vfwscanf.c::convert_wstring(): wcp0 is write-only 2021-11-29 17:39:51 +02:00
Konstantin Belousov 4b6f4db341 libc/x86/__vdso_gettc.c::tsc_selector_idx(): cpu_id is calculated but not used
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:51 +02:00
Konstantin Belousov 959c7ab51e acl_delete_entry(): remove write-only variable
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:51 +02:00
Konstantin Belousov 412fd7a34c setproctitle_internal(): remove kbuf local, it is write-only
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:51 +02:00
Konstantin Belousov 16b238b740 libc/rpc/getrpcent.c: Mark write-only variables as unused
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov 0e00befcaf libc/net/nscachedcli.c: remove write-only variables
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov 346eaa41f8 libc/net/getservent.c: Mark write-only variables as unused
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov f6d403743c libc/net/getprotoent.c: Mark write-only variables as unused
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov 1c4f305d21 libc/net/getnetnamadr.c: Mark write-only variables as unused
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov 024547c9bd libc/net/gethostnamadr.c: mark write-only variables as __unused
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov 701473ef94 libc/gen/getpwent.c: plug warnings about write-only variables
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov 075fa5a9a8 libc/gen/getgrent.c: plug warnings about write-only variables
The variables clang13 complains about take the results of var_arg() calls.
I decided to kept variables around, annotating their definitions with
__unused, to keep clear expected types of the varargs.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Mateusz Piotrowski 5d21348dfd rc.subr.8: Document changes to load_rc_config
Since e27961a496, load_rc_config does not
require a service name as its first argument. This change was documented
in the rc.subr script in 0b9c2e7ac5. Let's
update the manual page as well.

MFC after:	3 days
2021-11-29 16:09:02 +01:00