Fix lib/libc/nss/getgr_test with large numbers of groups
These tests create a linked list with one entry for every group on the
running system. On a system with about 30,000 groups, the test took 69
seconds to run, and crashed Kyua with the below error:
kyua: E: string or blob too big (sqlite op: sqlite3_bind_blob) (sqlite db: /root/.kyua/store/results.usr_tests.20241231-203317-570235.db).
Fix the test by limiting it to operating on the first 1024 groups.
Apply the same change to getpw_test and getserv_test too, which are
vulnerable to the same problem.
Sponsored by: ConnectWise
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D48275
(cherry picked from commit d11904b350214943dedb64c7121d4602799d7afd)
fusefs: minor cleanup in the tests
Delete some unused includes and member variables.
Sponsored by: ConnectWise
(cherry picked from commit c2153a533ffb9691848a072c7628dcf56e0e6442)
fusefs: fix a memory leak
Fix a leak of a fuse_ticket structure. The leak mostly affected
NFS-exported fuse file systems, and was triggered by a failure during
FUSE_LOOKUP.
Sponsored by: ConnectWise
(cherry picked from commit 969d1aa4dbfcbccd8de965f7761203208bf04e46)
fusefs: ignore FUSE_NO_OPEN(DIR)_SUPPORT flags
The FUSE_NO_OPEN_SUPPORT and FUSE_NO_OPENDIR_SUPPORT flags
are only meant to indicate kernel features, and should be ignored
if they appear in the FUSE_INIT reply flags.
Also fix the corresponding test cases.
Reviewed by: Alan Somers <asomers at FreeBSD.org>
Signed-off-by: CismonX <admin at cismon.net>
Pull Request: https://github.com/freebsd/freebsd-src/pull/1509
(cherry picked from commit f0f596bd955e5b48c55db502e79fc652ac8970d3)
fusefs: delete a comment in the tests
Even on a riscv embedded system, the fusefs tests run fast enough that
10 seconds is a reasonable timeout.
[skip ci]
Sponsored by: ConnectWise
(cherry picked from commit 53f73aaffddaedff019555679d686ec401330d39)
fusefs: More accurately test the unique tokens in the test suite
Every fuse ticket has a "unique" token. As the name implies, they're
supposed to be unique. Previously the fusefs test suite verified their
uniqueness by relying on the fact that they are also sequential. But
they aren't guaranteed to be sequential. Enhance the tests by removing
that convenient assumption.
Sponsored by: Axcient
(cherry picked from commit b1879975794772ee51f0b4865753364c7d7626c3)
fusefs: FUSE_NOTIFY_INVAL_* must busy the mountpoint
Unusually, the FUSE_NOTIFY_INVAL_INODE and FUSE_NOTIFY_INVAL_ENTRY
messages are fully asynchronous. The server sends them to the kernel
unsolicited. That means that unlike every other fuse message coming
from the server, these two arrive to a potentially unbusied mountpoint.
So they must explicitly busy it. Otherwise a page fault could result if
the mountpoint were being unmounted.
Reported by: JSML4ThWwBID69YC at protonmail.com
(cherry picked from commit 989998529387b4d98dfaa6c499ad88b006f78de8)
pf: avoid use-after-free on reassembly
Ensure we update the mbuf pointer returned by pf_normalize_ip() or
pf_normalize_ip6() even if they fail.
Otherwise we'd risk using a freed mbuf.
PR: 283705
Reported by: Yichen Chai <yichen.chai at gmail.com>, Zhuo Ying Jiang Li <zyj20 at cl.cam.ac.uk>
Sponsored by: Rubicon Communications, LLC ("Netgate")
(cherry picked from commit 5d28f4cab8d5919aba1365e885a91a96c0655b59)
Make the CTL tests more resilient
Fix the find_device function to work regardless of whether "camcontrol
devlist" lists the da device first and the pass device second or vice
versa. On FreeBSD 14 and 15 it apparently always lists da first. But
on 13 it can do it in either order.
Sponsored by: ConnectWise
Reviewed by: emaste, markj, #cam
Differential Revision: https://reviews.freebsd.org/D47446
(cherry picked from commit b032be711c740d2f25b27c92069537edcfac221c)
atomics: Constify loads: Remove now superfluous uses of DECONST()
No functional change (intended).
Reviewed by: kib
MFC after: 4 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48497
smr: Load to accept pointers to const pointers
Pointers passed to the smr_entered_load() and smr_serialized_load()
macros are in the end used as arguments to atomic_load_*ptr(), so
convert them to the now acceptable 'const uintptr_t *' ones (instead of
'uintptr_tr *'), making these macros accept pointers to constant
pointers.
Reviewed by: kib
MFC after: 4 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48497
atomics: atomic_load_consume_ptr(): Accept pointers to const
Now that all directly-implemented loads (with acquire semantics or not)
accept pointers to const, ensure that atomic_load_consume_ptr(), built
on atomic_load_acq_ptr(), does so too, in the common atomics header as
well as *SAN interceptors.
Reviewed by: kib
Fixes: 5e9a82e898d5 ("atomics: Constify loads")
MFC after: 4 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48497
munmap.2: Unaligned addresses do not return error
We previously claimed that non-page-aligned addresses would return
EINVAL, but the address is in fact rounded down to the page boundary.
Reported by: Harald Eilertsen <haraldei at anduin.net>
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
Fixes: dabee6fecc67 ("kern_descrip.c: add fdshare()/fdcopy()")
Differential Revision: https://reviews.freebsd.org/D48465
(cherry picked from commit 9e36aaf0c24cf158e83c69c1d2312c000c3c36f3)
munmap.2: Remove EINVAL for negative len
len is unsigned (it is size_t), so cannot be negative.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit fab411c4fd5224e3dd44e0eb288d60b27480e2d1)
libbsnmptools: avoid uninitialized snmptoolctx->passwd with empty password
The removed check left snmptoolctx->passwd pointer to uninitialized
memory. Always calling strlcpy(3) would guarantee that with empty
password it will point to empty string.
Submitted by: markj
PR: 283909
(cherry picked from commit 3999a860d6e899de98b1025317d2d0ef1f83255f)
pkgbase: Fix OSVERSION specification when creating a repo
-o OSVERSION= needs to appear before the "repo" verb, otherwise it has
no effect. In this case, recent pkg-devel fails to create the repo,
saying that ABI cannot be specified without OSVERSION.
Reviewed by: kevans, manu
MFC after: 2 weeks
Fixes: 188fe88ec50e ("pkgbase: force OSVERSION")
Differential Revision: https://reviews.freebsd.org/D48518
ktrace: Fix uninitialized memory disclosure
The sockaddr passed to ktrcapfail() may be smaller than
sizeof(struct sockaddr), and the trailing bytes in the sockaddr
structure will be uninitialized, whereupon they get copied out to
userspace.
PR: 283673
Reviewed by: jfree, emaste
Reported by: Yichen Chai <yichen.chai at gmail.com>
Reported by: Zhuo Ying Jiang Li <zyj20 at cl.cam.ac.uk>
Fixes: 9bec84131215 ("ktrace: Record detailed ECAPMODE violations")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D48499
netinet tests: basic garp test
Excercise the garp code.
This doesn't actively verify anything, but is sufficient to trigger the
panic reported in PR 284073, so it's a useful test case to keep.
PR: 284073
Sponsored by: Rubicon Communications, LLC ("Netgate")
netinet: enter epoch in garp_rexmit()
garp_rexmit() is a callback, so is not in net_epoch, which
arprequest_internal() expects.
Enter and exit the net_epoch.
PR: 284073
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")