Commit graph

288758 commits

Author SHA1 Message Date
Alan Somers 6b1c534927 Add a regression test for PR 276191.
The bug isn't fusefs-specific, but this is the easiest way to reproduce
it.

PR:		276191
MFC after:	1 week
MFC with:	bdb46c21a3
Differential Revision:  https://reviews.freebsd.org/D43446
Reviewed by: 	kib
2024-01-13 15:47:16 -07:00
Konstantin Belousov 69748e62e8 vm/vm_object.c: minor cleanup
Remove sys/cdefs.h and sys/socket.h includes.
Order sys/ includes alphabetically.
Do not check for NULL before free().

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
DIfferential revision:	https://reviews.freebsd.org/D43444
2024-01-13 18:45:53 +02:00
Wolfram Schneider e3c7b76fa8 man(1): support spaces in filenames
The globbing function in exists() needs to handle white spaces.

PR:          275978
Reviewed by: kevans, bapt, emaste
MFC after:   1 week
2024-01-13 16:16:55 +00:00
Robert Wing c8328f1a7b pmap_init(9): drop MLINKS reference
fix the build
2024-01-12 17:29:15 +00:00
Brooks Davis 60b2e2d3ee libc: stop exposing __fcntl_compat
It was exposed (under FBSDprivate_1.0) for forward compatability in
threading libraries in 2008 by commit cd7d66a21f.  The last consumer
was removed in 2015 by commit 8495e8b1e9.  I missed this among the _
and __sys_ symbols in commit e2417a21a0.

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D43408
2024-01-13 00:01:13 +00:00
Minsoo Choo 03d04bf494 Stop using expressions in _Alignof()
_Alignof(expression) is a non-standard extension.  This is not allowed
in gnu11 and gnu17 which follow the C11 standard _Alignof(type).

Reviewed by:	arichardson, imp, jhb
Fixes:		4a9cd9fc22 amd64 db_trace: Reject unaligned frame pointers
Fixes:		7ccaf76a27 riscv db_trace: Ensure trapframe pointer is suitably aligned.
Fixes:		638c68897f arm64 db_trace: Ensure trapframe pointer is suitably aligned.
Differential Revision:	https://reviews.freebsd.org/D43409
2024-01-12 15:37:53 -08:00
Alexander Ziaee 246e0457d9 mixer.8: Add terse example for increasing volume
Reviewed by:	jhb
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1044
2024-01-12 14:55:36 -08:00
Ricardo Branco 82f2275b73 cd9660: Add support for mask,dirmask,uid,gid options
Reviewed by:	jhb
Pull Request:	https://github.com/freebsd/freebsd-src/pull/982
2024-01-12 14:51:31 -08:00
Robert Wing bc1eea0c0b pmap_init(9): sweep references to pmap_init2()
gone since 2005
2024-01-12 13:29:50 +00:00
Robert Wing 55e2a7d3ea pmap_pinit(9): sweep references to pmap_pinit2()
gone since 2004
2024-01-12 13:29:17 +00:00
Mark Johnston 8e1a7e29b6 sanitizers: Avoid building genassym.c and genoffset.c with sanitizers
Some, particularly KASAN, may insert redzones around global symbols,
resulting in incorrect offset definitions because genassym.sh (ab)uses
symbol sizes to assign semantic meaning.

(Ideally I would be able to define this pattern in one place, but I
haven't found a way to define a GENSYM_CFLAGS that actually works for
all of the consumers (kern.post.mk, kmod.mk, sys/conf/files*).)

MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
2024-01-12 16:09:14 -05:00
Mark Johnston d07acc58d8 systm: Relax __result_use_check annotations
When compiling with gcc, functions annotated this way can not have their
return values cast away, e.g., with `(void)copyout(...)`.  clang permits
it but gcc does not.  Since we have a number of such casts for calls
which copy data out of the kernel, and since failing to check for errors
when copying *in* is a much more severe bug, remove some of the
annotations in order to make the gcc build happy.

Reviewed by:	kib
Reported by:	Jenkins
Fixes:	8e36732e6e ("systm: Annotate copyin() and related functions with __result_use_check")
Differential Revision:	https://reviews.freebsd.org/D43418
2024-01-12 15:56:00 -05:00
Mark Johnston 848a8bf3f4 fb: Check for errors from copyin()
When compiling with gcc, a function annotated with __result_use_check
cannot have its return value ignored with a void cast.  So, try to
handle it.

MFC after:	1 week
2024-01-12 15:56:00 -05:00
Kyle Evans 5df041c4bb bhyveload(8): document some SECURITY CONSIDERATIONS
The situation is improved now that we're running in a sandbox, but there
is still some host machine access that could be concerning depending on
the context.  These concerns may be somewhat mitigated by the fact that
the host machine usually provides the loader binary, even when the guest
image is providing the loader scripts -- they only bring the lua
scripts, and they have to be able to execute arbitrary syscalls rather
than the interfaces provided by libsa(3).

Reviewed by:	jhb, markj
Differential Revision:	https://reviews.freebsd.org/D43299
2024-01-12 13:58:16 -06:00
Warner Losh 46ebf11f5a MAINTAINERS: Add myself for nvme entries, remove jimharris
Jim Harris no longer has a commit bit and has moved on from being the
FreeBSD nvme driver maintainer at Intel. I've been reviewing things
so I'll take that up.

Sponsored by:		Netflix
2024-01-12 12:12:15 -07:00
Warner Losh 178679daa9 MAINTAINERS, etc: Remove hselasky entries
Sadly, Hans-Peter has passed away. Remove his entries out of respect for
his many years of service to the project.
2024-01-12 12:02:28 -07:00
Steve Kargl 7385a7f67c system(3): fix typo santized -> sanitized
PR: 276262
Reviewed by: imp
2024-01-12 11:29:22 -07:00
Dag-Erling Smørgrav 1e25eb287f login: Missed an instance of getpwnam().
Fixes:		a3d80dd8aa
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D43423
2024-01-12 17:40:55 +01:00
Dag-Erling Smørgrav 899837e8f5 uniq: Error out if writing to the output failed.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D43407
2024-01-12 16:44:06 +01:00
Dag-Erling Smørgrav e2ec8ee02a uniq: Clean up and test obsolete options.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D43402
2024-01-12 16:44:00 +01:00
Dag-Erling Smørgrav 11715600e6 uniq: Fix interactive use.
Output a line as soon as it is possible to determine that it will have
to be output.  For the basic case, this means output each line as it is
read unless it is identical to the previous one.  For the -d case, it
means output the first instance as soon as the second is read, unless
the -c option was also given.  The -D and -u cases were already fine.

Add test cases for interactive use with no options and with -d.

Explicitly ignore -d when -D is also specified.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	rew, kevans
Differential Revision:	https://reviews.freebsd.org/D43382
2024-01-12 16:43:55 +01:00
Dag-Erling Smørgrav e762fd81e2 uniq: Replace NetBSD's unit tests with our own.
These new tests cover more functionality and are easier to extend.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D43381
2024-01-12 16:43:49 +01:00
Dag-Erling Smørgrav a3d80dd8aa login: Use getpwnam_r() instead of getpwnam().
Since we expect the entry to still be valid after calling into PAM,
which may call getpwnam() itself, we need to use getpwnam_r().

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, imp, allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D43376
2024-01-12 16:43:42 +01:00
Gleb Smirnoff e007b89e9d tests: add a test for shutdown(2) on a datagram socket 2024-01-12 02:04:04 -08:00
Gleb Smirnoff d4033ebd05 divert: just return EOPNOTSUPP on shutdown(2)
Before this change we would always return ENOTCONN.  There is no
legitimate use of shutdown(2) on divert(4).
2024-01-12 02:04:04 -08:00
Gleb Smirnoff 0598824cc8 protosw: remove unneeded include 2024-01-12 02:04:04 -08:00
Roger Pau Monné 82126ef92f xen: improve man (4) page
Update the xen(4) man page to reflect the current support status.

Reported by: kevans
Reviewed by: bcr kevans imp
Differential revision: https://reviews.freebsd.org/D43373
2024-01-12 10:18:49 +01:00
Cy Schubert 3091cdb11f Revert "kerberos: Fix numerous segfaults when using weak crypto"
This revision breaks Linux and MacOS cross builds because
TARGET_ENDIANNESS is not define during bootstrapping on these
platforms.

I think the correct approach would be to separate the new
fbsd_ossl_provider_load() and unload functions into their own
library (instead of libroken). This avoids the less desirable
option of including bsd.cpu.mk in secure/lib/Makefile.common,
which does build but could complicate future work.

Reported by:	jrtc27

This reverts commit cb350ba7bf.
2024-01-11 23:42:33 -08:00
Baptiste Daroussin 91dc237466 find: fix build on 32bits 2024-01-12 07:34:28 +01:00
Xin LI e872a4013f releng-gce: Advertise the availability of gVNIC support in GCE images.
This marks FreeBSD GCE images as gVNIC capable by adding the
--guest-os-features=GVNIC flag at creation time as suggested in GCE
documentation[1].  This allows Generation 3 and newer GCE instances
to leverage advanced networking capabilities and performance
enhancements provided by gVNIC.  Users will benefit from these
improvements without needing to create custom images.

[1] https://cloud.google.com/compute/docs/networking/using-gvnic#create_a_vm_with_gvnic_support

Reviewed by:	cperciva
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D43411
2024-01-11 21:38:04 -08:00
Rick Macklem d004554af7 UPDATING: Add an entry for the __FreeBSD_version bump to 1500010 2024-01-11 16:53:46 -08:00
Rick Macklem a2da1bdb61 param.h: Bump __FreeBSD_version to 1500010
Commit cc760de218 changed the internal interface between
the nfscommon and nfscl modules.  As such, both need to be
rebuilt from sources.  Therefore, bump __FreeBSD_version.
2024-01-11 16:48:23 -08:00
Rick Macklem cc760de218 nfscl: Only update atime for Copy when noatime is not specified
Commit 57ce37f9dc modified the NFSv4.2 Copy operation so that
it will update atime on the infd file whenever possible.
This is done by adding a Setattr of TimeAccess for the
input file.

This patch disables this change for the case of an NFSv4.2
mount with the "noatime" mount option, which avoids the
additional Setattr of TimeAccess operation.

MFC after:	1 week
2024-01-11 16:38:33 -08:00
Goran Mekić d06a00963b find: add SIGINFO handler
Print number of files processed and path currently being processed on
SIGINFO.

Reviewed by:	des, asomers
Sponsored by:	Axcient
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D43380
2024-01-11 16:37:14 -07:00
Martin Matuska 0e1d8481f9 ktls: fix vnet-related panic in ktls_reset_receive_tag()
Reviewed by:	gallatin, jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43400
2024-01-11 21:32:29 +01:00
Mark Johnston d682a91726 conf: Do not set -fno-sanitize-memory-param-retval for old compilers
The option was introduced in LLVM 16.

Fixes:	b6c653c974 ("kmsan: Set -fno-sanitize-memory-param-retval for now")
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
2024-01-11 14:20:22 -05:00
Brooks Davis e2417a21a0 libc: separate syscall and non-syscall symbols
Put declerations of _ and __sys_ prefixed stubs at the top and
everything else at the bottom.  Sort the bottom list with sort(1).
This paves the way to generate the syscall symbol list.

Reviewed by:	kib
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43386
2024-01-11 18:27:20 +00:00
Brooks Davis 6597ea4481 powerpc/SYS.h: implement _SYSCALL_BODY() macro
Add _SYSCALL_BODY() macro which invokes the syscall via _SYCALL() and
calls cerror as required.  Use to implement PSEUDO() and RSYSCALL().

Reviewed by:	jhibbits
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43323
2024-01-11 18:27:20 +00:00
Konstantin Belousov b068bb09a1 Add vnode_pager_clean_{a,}sync(9)
Bump __FreeBSD_version for ZFS use.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43356
2024-01-11 18:44:53 +02:00
Mark Johnston 1f62718d8b top: Avoid printing a blank line when the ZFS ARC is empty
PR:		275994
MFC after:	2 weeks
2024-01-11 10:01:37 -05:00
Cy Schubert cb350ba7bf kerberos: Fix numerous segfaults when using weak crypto
Weak crypto is provided by the openssl legacy provider which is
not load by default. Load the legacy providers as needed.

When the legacy provider is loaded into the default context the default
provider will no longer be automatically loaded. Without the default
provider the various kerberos applicaions and functions will abort().

PR:			272835
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D43009
Tested by:		netchild, Joerg Pulz <Joerg.Pulz@frm2.tum.de>
2024-01-11 05:26:42 -08:00
Konstantin Belousov ed1a88a311 vnode_pager_generic_putpages(): rename maxblksz local to max_offset
Requested by:	markj
Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43358
2024-01-11 11:49:37 +02:00
Konstantin Belousov bdb46c21a3 vnode_pager_generic_putpages(): correctly handle clean block at EOF
The loop 'skip clean blocks' checking for the clean blocks in the dirty
pages might end up setting the in_hole to true when exactly at EOF at
the middle of the block, without advancing the prev_offset value. Then
the next block is not dirty, and next_offset is clipped back to poffset
+ maxsize, equal to prev_offset, failing the assertion.

Instead of asserting prev_offset < next_offset, we must skip the write.

Reported by:	asomers
PR:	276191
Reviewed by:	alc, markj
Tested by:	asomers
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43358
2024-01-11 11:49:37 +02:00
Gleb Smirnoff d9b1f6fbf9 netlink: fix bug with socket buffer character counter underflow
Cover case when an nb that we are now reading in full had been partially
read by previous read(2) and now has positive offset.  Throw couple
assertions that helped to catch that earlier.
2024-01-10 20:51:53 -08:00
Gleb Smirnoff f75d7fac10 netlink: avoid putting empty mbufs on the socket queue
When processing incoming Netlink messages in nl_process_nbuf() kernel
always allocates a writer with a buffer to put generated reply to.
However, certain messages aren't replied.  That makes nlmsg_flush()
to put an empty buffer to the socket.  Avoid doing that because avoiding
is much easier than dealing with empty buffers on the receiver side.
2024-01-10 20:51:53 -08:00
Gleb Smirnoff e6f4c31460 netlink: improve edge case when reading out truncated last nlmsg in nb
When there is not enough space for one full message we return it truncated.
This enters special block of code that previously may leave empty buffer
with offset == datalen in the queue.  Avoid that, as dealing later with
empty buffers causes more pain than just avoiding them.  While here add
missing msgrcv increment.
2024-01-10 20:51:53 -08:00
Gleb Smirnoff 26caf57e0b tests/netlink: improve recently added netlink_socket:membership
Change sequence of syscalls: instead of "add, delete, check, check"
run sequence "add, check, delete, check".  Seems to make more sense.

Do minimal parsing of incoming messages: find the IPv4 address there
and compare it to the original.
2024-01-10 20:51:53 -08:00
Gleb Smirnoff effa0f6c0a tests/netlink: mark a test that requires tun(4) 2024-01-10 20:51:53 -08:00
Gleb Smirnoff 6ee181b9d5 tests/net: enable if_clone_test:epair_ipv6_up_stress
The panic mentioned was fixed in f5a365e51f.

PR:	225438
2024-01-10 20:51:53 -08:00
Warner Losh 8a3fafc821 acpi/apm: Improve APM ioctl interface emulation
The apm(8) program documents certain states, but doesn't document the
'unknown' state. It reports things correctly for systems with a battery,
but incorrectly for systems without one. Emulate the old interface a
little better by saying ac power is online if we have no status (instead
of unknown), the battery has a high charge of 255% if there's no battery
(instead of -1). Programs, like emacs, expect to see only the documented
values and misbehave when they see something else.

This is closer to what would happen on old-school APM machines. Sadly
(or not) I have no access to old-school APM machines to 100% confirm
this, but reading the spec, old code and testing with emacs' mode line
with battery suggests these values are more correct. emacs has never
been converted to acpi_conf due to permissions issues with acpi devices.

Fixing the kernel is preferable to hacking apm(8) for these special
cases because other programs that use these interfaces will also be more
correct. The kernel also has more data with which to decide what to
return.

Sponsored by:	Netflix
MFC After:	1 week
2024-01-10 17:05:00 -07:00