Commit Graph

269254 Commits

Author SHA1 Message Date
Yoshihiro Takahashi
2c614481fd unzip: Fix segmentation fault if a zip file contains buggy filename.
PR:             259011
Reported by:    Robert Morris
Submitted by:   ak
MFC after::     1 week
2021-10-10 20:49:19 +09:00
Baptiste Daroussin
b158d4d7a1 rescue: fix after with to a ldscript of libncursesw.a 2021-10-10 08:53:41 +02:00
Baptiste Daroussin
9294a2c719 ncurses: convert libncursesw.a into a static ldscript
Introduce the notion of static linker scripts to allow libncursesw.a to
track its dependency on libtinfow.a

this allows the build of older freebsd source tree to happen and make
static linking in part with dynamic linking which already provides a
ldscript

This fixes a bootstrapping FreeBSD 12 or 13 on recent FreeBSD 14

Reviewed by:		imp
Differential Revision:	https://reviews.freebsd.org/D32435
2021-10-10 07:51:00 +02:00
Mark Peek
0f14bcbe38 vmci: fix panic due to freeing unallocated resources
Summary:
An error mapping PCI resources results in a panic due to unallocated
resources being freed up. This change puts the appropriate checks in
place to prevent the panic.

PR:		252445
Reported by:	Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Tested by:	marcus
MFC after:	1 week
Sponsored by:	VMware

Test Plan:
Along with user testing, also simulated error by inserting a ENXIO
return in vmci_map_bars().

Reviewed by:	marcus
Subscribers:	imp
Differential Revision: https://reviews.freebsd.org/D32016
2021-10-09 14:21:16 -07:00
Konstantin Belousov
5fb54d2fc8 readlinkat(2): allow O_PATH fd
PR:	258856
Reported by:	ashish
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32390
2021-10-09 22:31:37 +03:00
Mark Johnston
fa9da1f590 timecounter: Let kern.timecounter.stepwarnings be set as a tunable
MFC after:	1 week
2021-10-09 12:34:06 -04:00
Mark Johnston
7fa2335347 bhyve: Map the MSI-X table unconditionally for passthrough
It is possible for the PBA to reside in the same page as the MSI-X
table.  And, while devices are not supposed to do this, at least some
Intel wifi devices place registers in a page shared with the MSI-X
table.  To handle the first case we currently map the PBA page using
/dev/mem, and the second case is not handled.

Kill two birds with one stone: map the MSI-X table BAR using the
PCIOCBARMMAP ioctl instead of /dev/mem, and map the entire table so that
accesses beyond the bounds of the table can be emulated.  Regions of the
BAR not containing the table are left unmapped.

Reviewed by:	bz, grehan, jhb
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32359
2021-10-09 11:36:19 -04:00
Elyes HAOUAS
c8a45820e0 sbin/mount_fusefs/mount_fusefs.8: Fix typos
"expicitly" --> "explicitly"
"uknown" --> "unknown"

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/552
2021-10-09 09:02:39 -06:00
Marko Zec
bc8b8e106b [fib_algo][dxr] Retire counters which are no longer used
The number of chunks can still be tracked via vmstat -z|fgrep dxr.

MFC after:	3 days
2021-10-09 13:47:10 +02:00
Marko Zec
1549575f22 [fib_algo][dxr] Improve incremental updating strategy
Tracking the number of unused holes in the trie and the range table
was a bad metric based on which full trie and / or range rebuilds
were triggered, which would happen in vain by far too frequently,
particularly with live BGP feeds.

Instead, track the total unused space inside the trie and range table
structures, and trigger rebuilds if the percentage of unused space
exceeds a sysctl-tunable threshold.

MFC after:	3 days
PR:		257965
2021-10-09 13:22:27 +02:00
Ed Maste
032448cd2c Belatedly track private lib renaming for OptionalObsoleteFiles.inc
Reviewed by:	kevans
Fixes:		5551c57355 ("Rework PRIVATELIB")
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32384
2021-10-08 23:15:56 -04:00
Ed Maste
172fa4aa75 OpenSSH: cherry-pick "need initgroups() before setresgid()"
From openssh-portable commits f3cbe43e28fe and bf944e3794ef.
2021-10-08 21:29:25 -04:00
Devin Teske
1c64959bff bsdconfig: Comments
My current style is to copy C for "/* NOTREACHED */" instead of spelling
out "Not reached". Make this one nominal change in this one file and the
others later.

While here, word-smith "Preload" into "Pre-load" as I believe that to
be more grammatically correct in this instance.

Also while here, fix a comment capitalization error.

Lastly, bump copyright for above changes.
2021-10-08 16:26:21 -07:00
Warner Losh
15575aca87 bsd.cpu.mk: Minor formatting for armv6 vs armv7
Separate out the arch/cpu options for armv6 from the armv7 ones. This is
less confusing.

Sponsored by:		Netflix
2021-10-08 15:44:46 -06:00
Mitchell Horne
17f790f49f arm, arm64, riscv: adjust top-level nexus comment
These platforms don't manage resources for DMA request lines or I/O
ports, this is specific to x86. Remove the references from the comments.

Reviewed by:	imp, jhb
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32358
2021-10-08 14:16:32 -03:00
Piotr Pawel Stefaniak
bf8f6ffcb6 Mention kern.timecounter.alloweddeviation in nanosleep.1
PR:		224837
Reported by:	Aleksander Derevianko
2021-10-08 17:07:50 +02:00
Kristof Provost
1c680e620b pf: do not copy anchor_wildcard / anchor_relative from userspace
We overwrite these fields again in pf_kanchor_setup() anyway.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-10-08 14:46:59 +02:00
Bjoern A. Zeeb
0525ece355 net80211: fix build for 526370fb85
In 526370fb85 "net80211: proper ssid
length check in setmlme_assoc_adhoc()" we are checking the
sizeof on an array function parameter which leads to a warning that
it will resturn the size of the type of the array rather than the
array size itself.  Use the defined length used both in the ioctl
and the sizing of the array function parameter instead.

Reported by:	CI
MFC after:	3 days
X-MFC with:	526370fb85
2021-10-08 11:21:44 +00:00
Bjoern A. Zeeb
76f3b8cb64 USB: adjust the Generic XHCI ACPI probe return value
Change the probe return value from BUS_PROBE_DEFAULT to BUS_PROBE_GENERIC
given this is the "generic" attach method.  This allows individual
drivers using XHCI generic but needing their own intialisation to
gain priority for attaching over the generic implementation.

Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D32257
2021-10-08 10:28:44 +00:00
Bjoern A. Zeeb
09dd08f167 net80211: correct length check in ieee80211_ies_expand()
In ieee80211_ies_expand() we are looping over Elements
(also known as Information Elements or IEs).
The comment suggests that we assume well-formedness of
the IEs themselves.
Checking the buffer length being least 2 (1 byte Element ID and
1 byte Length fields) rather than just 1 before accessing ie[1]
is still good practise and can prevent and out-of-bounds read in
case the input is not behaving according to the comment.

Reported by:	(coypu sdf.org)
admbugs:	857
MFC after:	3 days
Reviewed by:	adrian, markj
Differential Revision: https://reviews.freebsd.org/D32340
2021-10-08 10:26:22 +00:00
Bjoern A. Zeeb
526370fb85 net80211: proper ssid length check in setmlme_assoc_adhoc()
A user supplied SSID length is used without proper checks in
setmlme_assoc_adhoc() which can lead to copies beyond the end
of the user supplied buffer.
The ssid is a fixed size array for the ioctl and the argument
to setmlme_assoc_adhoc().
In addition to an ssid_len check of 0 also error in case the
ssid_len is larger than the size of the ssid array to prevent
problems.

PR:		254737
Reported by:	Tommaso (cutesmilee.research protonmail.com)
MFC after:	3 days
Reviewed by:	emaste, adrian
Differential Revision: https://reviews.freebsd.org/D32341
2021-10-08 10:23:31 +00:00
Michael Tuexen
bd19202c92 sctp: improve KASSERT messages
MFC after:	1 week
2021-10-08 11:33:56 +02:00
Konstantin Belousov
174aad047e vm_fault: do not trigger OOM too early
Wakeup in vm_waitpfault() does not mean that the thread would get the
page on the next vm_page_alloc() call, other thread might steal the free
page we were waiting for. On the other hand, this wakeup might come much
earlier than just vm_pfault_oom_wait seconds, if the rate of the page
reclamation is high enough.

If wakeups come fast and we loose the allocation race enough times, OOM
could be undeservably triggered much earlier than vm_pfault_oom_attempts
x vm_pfault_oom_wait seconds.  Fix it by not counting the number of sleeps,
but measuring the time to th first allocation failure, and triggering OOM
when it was older than oom_attempts x oom_wait seconds.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D32287
2021-10-08 12:24:46 +03:00
Alexander V. Chernikov
7e64580b5f routing: Use the same index space for both nexthop and nexthop groups.
This simplifies userland object handling along with kernel-level
 nexthop handling in fib algo framework.

MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D32342
2021-10-08 07:58:55 +00:00
Michal Meloun
dfb7360222 dwmmc: Calculate the maximum transaction length correctly.
We should reserve two descriptors (not MMC_SECTORS) for potentially
unaligned (so bounced) buffer fragments, one for the starting fragment
and one for the ending fragment.

Submitted by:	kjopek@gmail.com
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30387
2021-10-08 09:21:03 +02:00
Peter Holm
89ec6dcce0 stress2: Added a regression test 2021-10-08 06:38:17 +00:00
Peter Holm
e6c28c2465 stress2: exclude known problem test 2021-10-08 06:35:17 +00:00
Robert Wing
8ff2b52241 prometheus_sysctl_exporter(8): filter output using a regex
Add two options, -i and -e, for filtering prometheus metrics.

Each option takes a regular expression as an argument. The provided
regex will be tested against the prometheus metric name.

The -i option includes metrics matching the given regex.
The -e option excludes metrics matching the given regex.

Sponsored by:   Modirum MDPay
Sponsored by:   Klara Inc.
Reviewed by:	0mp, debdrup
Differential Revision:	https://reviews.freebsd.org/D32269
2021-10-07 17:02:57 -08:00
Konstantin Belousov
b5cadc643e Make core dump writes interruptible with SIGKILL
This can be disabled by sysctl kern.core_dump_can_intr

Reported and tested by:	pho
Reviewed by:	imp, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32313
2021-10-08 03:21:43 +03:00
Konstantin Belousov
2ec505d2b8 core(5): explicitly mention the core file size limit name
Reviewed by:	imp, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32313
2021-10-08 03:21:43 +03:00
Konstantin Belousov
244ab56611 Add curproc_sigkilled()
Function returns an indicator that the process was killed with SIGKILL

Reviewed by:	imp, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32313
2021-10-08 03:21:43 +03:00
Konstantin Belousov
7a9775e9d0 sys/proc.h: remove dead prototype
Reviewed by:	imp, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32313
2021-10-08 03:21:43 +03:00
Konstantin Belousov
dc2d0899bb kern_sig.c: Remove unused SIGPROP_CANTMASK
Reviewed by:	imp, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32313
2021-10-08 03:21:42 +03:00
Konstantin Belousov
aba66031f2 riscv: move signal delivery code to exec_machdep.c
Reviewed by:	emaste, imp
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32310
2021-10-08 03:20:42 +03:00
Konstantin Belousov
dfaf65023e arm: move signal delivery code to exec_machdep.c
Reviewed by:	emaste, imp
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32310
2021-10-08 03:20:42 +03:00
Konstantin Belousov
b4ae6b1660 arm64: move signal delivery code to exec_machdep.c
also move ptrace-related helpers to ptrace_machdep.c.

Reviewed by:	emaste, imp
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32310
2021-10-08 03:20:42 +03:00
Konstantin Belousov
4c5bf59152 i386: move signal delivery code to exec_machdep.c
also move ptrace-related helpers to ptrace_machdep.c
Apply some style. Use ANSI C function definitions.
Remove MPSAFE annotations.

Reviewed by:	emaste, imp
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32310
2021-10-08 03:20:42 +03:00
Kirk McKusick
4313e2ae44 Avoid lost buffers in fsck_ffs.
The ino_blkatoff() and indir_blkatoff() functions failed to release
the buffers holding second and third level indirect blocks. This
commit ensures that these buffers are now properly released.

MFC after:    1 week
Sponsored by: Netflix
2021-10-07 15:52:58 -07:00
Mitchell Horne
8babb5582e riscv: fix VM_MAXUSER_ADDRESS checks in asm routines
There are two issues with the checks against VM_MAXUSER_ADDRESS. First,
the comparison should consider the values as unsigned, otherwise
addresses with the high bit set will fail to branch. Second, the value
of VM_MAXUSER_ADDRESS is, by convention, one larger than the maximum
mappable user address and invalid itself. Thus, use the bgeu instruction
for these comparisons.

Add a regression test case for copyin(9).

PR:		257193
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D31209
2021-10-07 18:12:30 -03:00
Mitchell Horne
4a9f2f8b07 riscv: handle page faults in the unmappable region
When handling a kernel page fault, check explicitly that stval resides
in either the user or kernel address spaces, and make the page fault
fatal if not. Otherwise, a properly crafted address may appear to
pmap_fault() as a valid and present page in the kernel map, causing the
page fault to be retried continuously. This is mainly due to the fact
that the upper bits of virtual addresses are not validated by most of
the pmap code.

Faults of this nature should only occur due to some kind of bug in the
kernel, but it is best to handle them gracefully when they do.

Handle user page faults in the same way, sending a SIGSEGV immediately
when a malformed address is encountered.

Add an assertion to pmap_l1(), which should help catch other bugs of
this kind that make it this far.

Reviewed by:	jrtc27, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31208
2021-10-07 18:12:17 -03:00
Kristof Provost
76c2e71c4c pf: remove unused field from pf_kanchor
The 'match' field is only used in the userspace version of the struct
(pf_anchor).

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-10-07 19:50:22 +02:00
Kristof Provost
90dedf0fef pfctl: Remove unused variable
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-10-07 19:50:01 +02:00
Mariusz Zaborski
824bbb9a40 diff: consider two files with same inodes as identical
Obtained from:	OpenBSD
MFC after:	1 week
2021-10-07 17:07:00 +02:00
Martin Birgmeier
67bceb38f4 i2c(8): fix option handling
Recognize the '-o' option when processing command line arguments.

Fixes:  9c10d00bf8 ("i2c(8): Add interpreted mode for batch/scripted...")
PR:     258572
2021-10-06 21:56:20 -08:00
Kyle Evans
4d7876aa70 build: slap a libtinfo dependency on libncurses
This mirrors the SUBDIR_DEPEND in lib/ncurses/Makefile.

Reported by:	jenkins (e.g., riscv64 build #23984)
Fixes:	396851c20a ("ncurses: split libtinfo from libncurses")
2021-10-06 22:03:37 -05:00
Kevin Bowling
3f66b96d86 ixgbe: Update shared code catchup
Leftovers from DPDK sync

Reviewed by:	grehan
Obtained from:	DPDK
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D31621
2021-10-06 18:45:55 -07:00
Jessica Clarke
224a95f124 libfido2: Address CHERI compatibility
Cherry-picked from libfido2 upstream f20a735c0a6f:

iso7816: Avoid storing pointers in a packed structure

On CHERI, and thus Arm's experimental Morello prototype architecture,
pointers are represented as capabilities, which are unforgeable bounded
pointers, providing always-on fine-grained spatial memory safety. The
unforgeability is enforced through the use of tagged memory, with one
validity tag bit per capability-sized-and-aligned word in memory. This
means that storing a pointer to an unaligned location, which is not
guaranteed to work per the C standard, either traps or results in the
capability losing its tag (and thus never being dereferenceable again),
depending on how exactly the store is done (specifically, whether a
capability store or memcpy is used).

However, iso7816 itself does not need to be packed, and doing so likely
causes inefficiencies on existing architectures. The iso7816_header_t
member is packed, and the flexible payload array is a uint8_t (which by
definition has no padding bits and is exactly 8 bits in size and, since
CHAR_BITS must be at least 8, its existence implies that it has the same
representation as unsigned char, and that it has size and alignment 1)
so there will never be any padding inserted between header and payload
(but payload may overlap with padding at the end of the struct due to
how flexible arrays work, which means we need to be careful about our
calculations).

Co-authored-by: pedro martelletto <pedro@yubico.com>
2021-10-06 21:40:26 -04:00
Ed Maste
0afa8e065e Import libfido2 at 'contrib/libfido2/'
git-subtree-dir: contrib/libfido2
git-subtree-mainline: d586c978b9
git-subtree-split: a58dee945a
2021-10-06 21:29:18 -04:00
Kyle Evans
d586c978b9 stand: fix build after recent opencrypto changes
Pass the ivlen along through, and just drop this KASSERT() if we're
building _STANDALONE for the time being.

Fixes:	1833d6042c ("crypto: Permit variable-sized IVs ...")
2021-10-06 20:23:44 -05:00
Ed Maste
10ff414c14 Import libcbor at 'contrib/libcbor/'
git-subtree-dir: contrib/libcbor
git-subtree-mainline: 293663f4da
git-subtree-split: 5b2defbd2a
2021-10-06 20:26:10 -04:00