Commit Graph

267367 Commits

Author SHA1 Message Date
Tom Jones
44752e92e1 Correct section reference for examples in RFC3542
Reviewed by:	bz, network
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D26272
2021-08-01 13:55:24 +01:00
Alexander V. Chernikov
054948bd81 [multipath][nhops] Fix random crashes with high route churn rate.
When certain multipath route begins flapping really fast, it may
 result in creating multiple identical nexthop groups. The code
 responsible for unlinking unused nexthop groups had an implicit
 assumption that there could be only one nexthop group for the
 same combination of nexthops with weights. This assumption resulted
 in always unlinking the first "identical" group, instead of the
 desired one. Such action, in turn, produced a used-but-unlinked
 nhg along with freed-and-linked nhg, ending up in random crashes.

Similarly, it is possible that multiple identical nexthops gets
 created in the case of high route churn, resulting in the same
 problem when deleting one of such nexthops.

Fix by matching the nexthop/nexhop group pointer when deleting the item.

Reported by:	avg
MFC after:	1 week
2021-08-01 10:07:37 +00:00
Edward Tomasz Napierala
60fb9e10c7 cam: enable kern.cam.da.enable_uma_ccbs by default
This makes the da(4) driver use UMA for its CCBs by default,
like ada(4) already does.  Please let me know via email
if you notice any suspicious kernel messages,

Reviewed By:	imp
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D31257
2021-08-01 09:40:42 +00:00
Wolfram Schneider
99feb137f5 `make buildworld' with time logging for each stage
PR:	 	257141
Reviewed by:	sjg,emaste
Approved by:	emaste
Differential Revision:	https://reviews.freebsd.org/D31154
2021-08-01 09:10:49 +00:00
Toomas Soome
bbb539b83c loader: cstyle cleanup of libsa/lseek.c
Clean up lseek.c, no functional changes intended. This is pre-patch
for open file list rewrite.

MFC after:	1 week
2021-08-01 10:11:17 +03:00
Li-Wen Hsu
de0c7fbe28
loader.conf(5): mention "efi" option for "console" parameter
PR:		213467
Reviewed by:	imp
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D31368
2021-08-01 06:41:49 +08:00
Warner Losh
a226a9cf8e awk: use awkgram.tab.h consistently
yacc makes awkgram.h. However, one true awk includes awkgram.tab.h, so
we link to for the builds. Make sure that we consistently link to it.
Also, restore the awkgram.tab.h dependency to maketab. It should not
have been deleted, despite apparently making meta build on stable/12
work. The important missing arc was proctab.c's dependence on
awkgram.tab.h.

MFC After:	1 day (build breakage)
Fixes:		c50c8502cb
Sponsored by:	Netflix
2021-07-31 16:24:12 -06:00
Bjoern A. Zeeb
22e20d852f LinuxKPI: fix bug in le32p_replace_bits()
Fix a bug that slipped in in 90707c4e44
using the correct field in le32p_replace_bits().

MFC after:	3 days
Reviewed by:	hselasky
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31352
2021-07-31 22:15:35 +00:00
Warner Losh
c50c8502cb awk: Fix dependencies
proctab.c is generated from awktab.h, so needs to depend on it.
maketab does not depend on awktab.h, and gets the maketab.c dependency
automatically, so remove them both.

Normally, these don't matter. However, for a meta build, they can cause
us to build maketab twice (once host, once for target) resulting in a
binary that can't run on the host due to proctab.c racing maketab in
parallel legs. In stable/12, this was a reliably lost race, while in
main I've been unable to trigger the race at all (maybe due to dirdep
changes making main more robust).

MFC After:	1 day (build breakage)
Reported by:	kp
Sponsored by:	Netflix
2021-07-31 15:48:26 -06:00
Kevin Bowling
ff01d6343f igb: clean up igb_txrx comments
Reviewed by:	grehan
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D31227
2021-07-31 08:04:25 -07:00
Kevin Bowling
d02e436353 igc: sync igc_txrx with igb(4)
Reviewed by:	grehan
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31227
2021-07-31 08:00:16 -07:00
Konstantin Belousov
041b7317f7 Add pmap_vm_page_alloc_check()
which is the place to put MD asserts about allocated pages.

On amd64, verify that allocated page does not belong to the kernel
(text, data) or early allocated pages.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31121
2021-07-31 16:53:42 +03:00
Konstantin Belousov
e18380e341 amd64: do not assume that kernel is loaded at 2M physical
Allow any 2M aligned contiguous location below 4G for the staging
area location.  It should still be mapped by loader at KERNBASE.

The assumption kernel makes about loader->kernel handoff with regard to
the MMU programming are explicitly listed at the beginning of hammer_time(),
where kernphys is calculated.  Now kernphys is the variable instead of
symbol designating the physical address.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31121
2021-07-31 16:53:42 +03:00
Hans Petter Selasky
792b602a33 Bump the FreeBSD version after making FPU sections thread-safe in the LinuxKPI.
Differential Revision:	https://reviews.freebsd.org/D29921
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-07-31 15:40:57 +02:00
Hans Petter Selasky
469884cf04 LinuxKPI: Make FPU sections thread-safe and use the NOCTX flag.
Reviewed by:	kib
Submitted by:	greg@unrelenting.technology
Differential Revision:	https://reviews.freebsd.org/D29921
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-07-31 15:36:48 +02:00
Warner Losh
f7f76c200a awk: Document deprecated behavior of hex constants and locales.
FreeBSD will convert "0x12" from hex and print it as 18. Other awks will
convert it to 0. This extension has been removed upstream, and will be
removed in FreeBSD 14.0.

FreeBSD used to set the locale on startup, and make the ranges use that
locale. This lead to weird results like "[A-Z]" matching lower case
characters in some locales. This bug has been fixed.

MFC After:		3 days
Sponsored by:		Netflix
2021-07-30 23:41:39 -06:00
Warner Losh
4e52f5db35 awk: Flag -Ft as deprecated behavior
Upstream is poised to deprecate the -Ft wart in one true awk. None of
the other awks do this, and the gawk maintainer says that he's had no
requests for it in gawk in 30 years maintaining it. github can find a
few instances of it in the wild. As such, warn that it's deprecated and
will go away in the future.

MFC After:		3 days
Sponsored by:		Netflix
2021-07-30 23:33:37 -06:00
Jung-uk Kim
97c0b5ab18 acpica: Import ACPICA 20210730
(cherry picked from commit 34cfdff1f386b2d7bf0a8ea873acf604753991e6)
2021-07-31 00:16:27 -04:00
Warner Losh
155f15118a clock_gettime: Add Linux aliases for CLOCK_*
Linux standardized what we call CLOCK_{REALTIME,MONOTONIC}_FAST as
CLOCK_{REALTIME,MONOTONIC}_COARSE. In addition, Linux spells
CLOCK_UPTIME as CLOCK_BOOTTIME.

Add aliases to time.h and document these new aliases in
clock_gettime(2).

Reviewed by:		vangyzen, kib (prior), dchagin (prior)
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30988
2021-07-30 17:20:22 -06:00
Warner Losh
7b797ba27a time.h: reduce CLOCK_ namespace pollution, move to _clock_id.h
Attempt to comply with the strict namespace pollution requirements of
_POSIX_C_SOURCE. Add guards to limit visitbility of CLOCK_ and TIMER_
defines as appropriate. Only define the CLOCK_ variables relevant to the
specific standards. Move all the sharing to sys/_clock_id.h and make
time.h and sys/time.h both include that rather than copy due to the
now large number of clocks and compat defines.

Please note: The old time.h previously used these newer dates:
	CLOCK_REALTIME			199506
	CLOCK_MONOTONIC			200112
	CLOCK_THREAD_CPUTIME_ID		200112
	CLOCK_PROCESS_CPUTIME_ID	200112

but glibc defines all of these for 199309. glibc uses this date for all
these values, however, only CLOCK_REALTIME was in IEEE 1003.1b. Add a
comment about this to document it. A large number of programs and
libraries assume that these will be defined for _POSIX_C_SOURCE =
199309.

In addition, leak CLOCK_UPTIME_FAST for the pocl package until it can be
updated to use a simple CLOCK_MONOTONIC.

Reviewed by:		kib
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31056
2021-07-30 17:20:22 -06:00
Warner Losh
cda1f88da5 RELNOTES: Put the old descripiton back
After looking at the RELNOTES files on the stable branches, restore the
old description and update the file to match the format it's supposed to
have.

Sponsored by:		Netflix
2021-07-30 17:07:52 -06:00
Warner Losh
9ed1e98abf nanobsd: adopt dhcpd to latest conventions
Adopt the dhcpd build to use nanobsd-build top level directory that
other nanobsd builds are using.

Sponsored by:		Netflix
2021-07-30 16:55:43 -06:00
John Baldwin
d0d631d5f4 cxgbei: Round up the maximum PDU data length by the MSS for TXDATAPLEN_MAX.
Recent firmware versions round down the value passed here by the MSS
and subsequently mishandle transmitted PDUs larger than the rounded
down value.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications
2021-07-30 13:27:24 -07:00
Kristof Provost
a191b4018f UPDATING: fix incorrect hash
Pointed out by:		lwhsu
2021-07-30 20:01:24 +02:00
Mark Johnston
b2ed7e988a bus: Convert to the new interceptor scheme
This was missed in commit a90d053b84.

Fixes:		a90d053b84
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2021-07-30 15:15:27 -04:00
Tom Jones
0943200b13 inet6_option_space is deprecated, refer to inet6_opt_init instead
Reviewed by:	bz, hrs
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D26273
2021-07-30 14:23:39 +01:00
Kristof Provost
3412900333 UPDATING: Document the removal of DIOCGETSTATESNV
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-07-30 14:23:40 +02:00
Kristof Provost
b69019c14c pf: remove DIOCGETSTATESNV
While nvlists are very useful in maximising flexibility for future
extensions their performance is simply unacceptably bad for the
getstates feature, where we can easily want to export a million states
or more.

The DIOCGETSTATESNV call has been MFCd, but has not hit a release on any
branch, so we can still remove it everywhere.

Reviewed by:	mjg
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31099
2021-07-30 11:45:28 +02:00
Alexander Motin
9d3b47abbb ipmi(4): Add more watchdog error checks.
Add request submission status checks before checking req->ir_compcode,
otherwise it may be zero just because of initialization.

Add checks for req->ir_compcode errors in ipmi_reset_watchdog() and
ipmi_set_watchdog().  In first case explicitly check for 0x80, which
means timer was not previously set, that I found happening after BMC
cold reset.  This change makes watchdog timer to recover instead of
permanently ignoring reset errors after BMC reset or upgraded.

MFC after:	2 weeks
Sponsored by:   iXsystems, Inc.
2021-07-29 23:39:04 -04:00
Alexander Motin
74f80bc1af coretemp(4): Switch to smp_rendezvous_cpus().
Use of smp_rendezvous_cpus() instead of sched_bind() allows to not
block indefinitely if target CPU is running some thread with higher
priority, while all we need is single rdmsr/wrmsr instruction call.
I guess it should also be much cheaper than full thread migration.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2021-07-29 23:26:10 -04:00
Mark Johnston
6f179693c5 Add interceptors for atomic operations on userspace memory
Implement them for KASAN.  KCSAN interceptors are left unimplemented for
now.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2021-07-29 21:14:36 -04:00
Mark Johnston
a90d053b84 Simplify kernel sanitizer interceptors
KASAN and KCSAN implement interceptors for various primitive operations
that are not instrumented by the compiler.  KMSAN requires them as well.
Rather than adding new cases for each sanitizer which requires
interceptors, implement the following protocol:
- When interceptor definitions are required, define
  SAN_NEEDS_INTERCEPTORS and SANITIZER_INTERCEPTOR_PREFIX.
- In headers that declare functions which need to be intercepted by a
  sanitizer runtime, use SANITIZER_INTERCEPTOR_PREFIX to provide
  declarations.
- When SAN_RUNTIME is defined, do not redefine the names of intercepted
  functions.  This is typically the case in files which implement
  sanitizer runtimes but is also needed in, for example, files which
  define ifunc selectors for intercepted operations.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2021-07-29 21:13:32 -04:00
John Baldwin
419d406e4e geom_vfs: Pre-allocate event for g_vfs_destroy.
When an active g_vfs is orphaned due to an underlying disk going away
the destroy is deferred until the filesystem is unmounted in
g_vfs_done().  However, g_vfs_done() is invoked from a non-sleepable
context and cannot use M_WAITOK to allocate the event.  Instead,
allocate the event in g_vfs_orphan() and save it in the softc to be
retrieved by the last call to g_vfs_done().

Reported by:	Jithesh Arakkan @ Chelsio
Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31354
2021-07-29 17:09:23 -07:00
John Baldwin
5b5d78897c Use a more specific type for geom_disk.d_event.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D31353
2021-07-29 16:34:46 -07:00
John Baldwin
67495c13d0 cxgbei: Wait for socket to close in icl_cxgbei_conn_close.
This ensures the TOE has finished processing any in-flight received
data before returning to the caller.  The caller assumes it is safe to
free any open tasks or transfers (and associated buffers) after this
function returns.

Previously, data placed directly via DDP could be written to buffers
after the caller had freed the buffers.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications
2021-07-29 16:34:46 -07:00
Kirk McKusick
a91716efeb Clean up orphaned indirdep dependency structures after disk failure.
During forcible unmount after a disk failure there is a bug that
causes one or more indirdep dependency structures to fail to be
deallocated. Until we manage to track down why they fail to get
cleaned up, this code tracks them down and eliminates them so that
the unmount can succeed.

Reported by:  Peter Holm
Help from:    kib
Reviewed by:  Chuck Silvers
Tested by:    Peter Holm
MFC after:    7 days
Sponsored by: Netflix
2021-07-29 16:31:16 -07:00
Kirk McKusick
412b5e40a7 Diagnotic improvement to soft dependency structure management.
The soft updates diagnotic code keeps a list for each type of soft
update dependency. When a new block is allocated for a file it is
initially tracked by a "newblk" dependency. The "newblk" dependency
eventually becomes either an "allocdirect" dependency or an "indiralloc"
dependency. The diagnotic code failed to move the "newblk" from the list
of "newblk"s to its new type list.

No functional change intended.

Reviewed by:  Chuck Silvers (as part of a larger change)
Tested by:    Peter Holm (as part of a larger change)
Sponsored by: Netflix
2021-07-29 16:13:54 -07:00
Konstantin Belousov
2572376f7f amd64: do not touch low memory in AP startup unless we used legacy boot
This fixes several ommisions in 48216088b1

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D31343
2021-07-30 01:20:45 +03:00
Konstantin Belousov
b27fe1c3ba amd64: stop doing special allocation for the AP startup trampoline
There is no reason now why do we need to allocate trampoline page very
early in the boot process.  The only requirement for the page is that
it is below 1M to be usable by the real mode during init.  This can be
handled by vm_alloc_contig() when we do the startup.

Also assert that startup trampoline fits into single page.  In principle
we can do multi-page allocation if needed, but it is not.

Move the alloc_ap_trampoline() function and the boot_address variable to
i386/mp_machdep.c.  Keep existing mechanism of early alloc on i386.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D31343
2021-07-30 01:20:45 +03:00
Warner Losh
59b83c47e2 awk: Note awk upgrades.
Note the high level differences with the latest one true awk
import. This list may grow as we learn more troublesome areas.

Updated description of the format fo the file to match the file.

I'll likely merge this change (and any followups) by direct commit to
stable/13 and stable/12 in a couple of weeks.

Sponsored by:		Netflix
2021-07-29 15:45:25 -06:00
Bjoern A. Zeeb
4c8af633d1 LinuxKPI: bitfield.h cleanup
Add a missing tab and remove an unnecessary return.
No functional changes.

MFC after:	3 days
2021-07-29 21:24:35 +00:00
Leandro Lupori
95d619a8ea hwpmc: remove static POWER8 definitions
After b48a2770d4, static POWER8 definitions became unnecessary,
as all of them (and much more) are already present in libpmc's
PMU events.

Submitted by:		Leonardo Bianconi <leonardo.bianconi@eldorado.org.br> (initial version)
Reviewed by:		kbowling, mhorne
Sponsored by:		Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D31334
2021-07-29 14:52:00 -03:00
Konstantin Belousov
cbf6f55e77 x86 __vdso_gettc: add O_CLOEXEC flag to open
of the /dev/hpet and /dev/hv_tsc devices, to not leak internal libc
filedescriptors on exec.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31344
2021-07-29 18:01:24 +03:00
Mark Johnston
4b136ef259 amd64: Set GS.base before calling init_secondary() on APs
KMSAN instrumentation requires thread-local storage to track
initialization state for function parameters and return values.  This
buffer is accessed as part of each function prologue.  It is provided by
the KMSAN runtime, which looks up a pointer in the current thread's
structure.

When KMSAN is configured, init_secondary() is instrumented, but this
means that GS.base must be initialized first, otherwise the runtime
cannot safely access curthread.  Work around this by loading GS.base
before calling init_secondary(), so that the runtime can at least check
curthread == NULL and return a pointer to some dummy storage.  Note that
init_secondary() still must reload GS.base after calling lgdt(), which
loads a selector into %gs, which in turn clears the base register.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31336
2021-07-29 10:22:37 -04:00
Mark Johnston
e153745083 amd64: Set MSR_KGSBASE to 0 during AP startup
There is no reason to initialize it to anything else, and this matches
initialization of the BSP.  No functional change intended.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31336
2021-07-29 10:14:05 -04:00
Mark Johnston
9e575fadf4 link_elf_obj: Invoke fini callbacks
This is required for KASAN: when a module is unloaded, poisoned regions
(e.g., pad areas between global variables) are left as such, so if they
are reused as KLDs are loaded, false positives can arise.

Reported by:	pho, Jenkins
Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31339
2021-07-29 09:46:25 -04:00
Mark Johnston
98bfb9dac2 libc/locale: Use O_CLOEXEC when opening locale tables
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-07-29 09:14:50 -04:00
Dmitry Chagin
2411ac0b89 linux(4): Eliminate a now unused includes after futexes refactoring.
MFC after:		2 weeks
2021-07-29 12:56:39 +03:00
Dmitry Chagin
d90df8ac13 linux(4): Add a comment about wait/requeue pi operations.
MFC after:		2 weeks
2021-07-29 12:55:59 +03:00
Dmitry Chagin
626cbd4648 linux(4): Handle incorrect FUTEX_CLOCK_REALTIME option bit.
Return ENOSYS if the FUTEX_CLOCK_REALTIME option bit is specified for an
inappropriate futex operation.

MFC after:		2 weeks
2021-07-29 12:55:33 +03:00