Commit Graph

267954 Commits

Author SHA1 Message Date
Mateusz Guzik
7b2561b46b vfs: stop open-coding vfs_getvfs in kern_unmount
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-26 11:38:31 +00:00
Andrey V. Elsukov
da3a09d894 ipfw_nat64: fix direct output mode
In nat64_find_route[46] handle NHF_GATEWAY flag and use destination
address from next hop to do link layer address lookup.

PR:		255928
Reviewed by:	melifaro
Obtained from:	Yandex LLC
MFC after:	1 week
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D31680
2021-08-26 13:48:23 +03:00
Paweł Anikiel
9da8235cc8 ichwd: add Lewisburg Super SKUs, Cannon and Comet Lake support
Cannon and Comet Lake PCHs have their PMC hidden, so when reading
the ACPI Base Address fails, we assume a default value.

Obtained from:	Semihalf
Sponsored by:	Stormshield
2021-08-26 12:04:28 +02:00
Kristof Provost
062463698e pf tests: Test ALTQ on top of if_bridge
Reviewed by:	donner
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31676
2021-08-26 11:23:45 +02:00
Luiz Otavio O Souza
eb680a63de if_bridge: add ALTQ support
Similar to the recent addition of ALTQ support to if_vlan.

Reviewed by:	donner
Obtained from:	pfsense
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31675
2021-08-26 11:23:44 +02:00
Kristof Provost
cd46399b9c pf tests: ALTQ priority test
Test that ALTQ can prioritise one type of traffic over another. Do this
by establishing a slow link and saturating it with ICMP echos.
When prioritised TCP connections reliably go through. When not
prioritised TCP connections reliably fail.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-26 11:23:39 +02:00
Arnaud Ysmal
3706af423f Add support for Lewisburg GPIO through P2SB
Obtained from:		Semihalf
Sponsored by:		Stormshield
Differential revision:	https://reviews.freebsd.org/D31269
2021-08-26 11:00:39 +02:00
Kyle Evans
3daa8e165c pxeboot: improve and simplify rx handling
This pushes the bulk of the rx servicing into a single loop that's only
slightly convoluted, and it addresses a problem with rx handling in the
process.  If we hit a tx interrupt while we're processing, we'd
previously drop the frame on the floor completely and ultimately
timeout, increasing boot time on particularly busy hosts as we keep
having to backoff and resend.

After this patch, we don't seem to hit timeouts at all on zoo anymore
though loading a 27M kernel is still relatively slow (~1m20s).

Reviewed by:	tsoome
Triage by:	Ash Gokhale <ashfixit gmail com>
Sponsored By:	National Bureau of Economic Research
Sponsored by:	Klara, Inc.
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31512
2021-08-25 21:59:08 -05:00
Ka Ho Ng
8d7cd10ba6 tmpfs: Implement VOP_DEALLOCATE
Implementing VOP_DEALLOCATE to allow hole-punching in the same manner as
POSIX shared memory's fspacectl(SPACECTL_DEALLOC) support.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D31684
2021-08-26 05:34:54 +08:00
Ka Ho Ng
399be91098 tmpfs: Move partial page invalidation to a separate helper
The partial page invalidation code is factored out to be a separate
helper from tmpfs_reg_resize().

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31683
2021-08-26 05:34:54 +08:00
Mark Johnston
a507a40f3b fsetown: Simplify error handling
No functional change intended.

Suggested by:	kib
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31671
2021-08-25 16:20:07 -04:00
Mark Johnston
1d874ba4f8 fsetown: Fix process lookup bugs
- pget()/pfind() will acquire the PID hash bucket locks, which are
  sleepable sx locks, but this means that the sigio mutex cannot be held
  while calling these functions.  Instead, use pget() to hold the
  process, after which we lock the sigio and proc locks, respectively.
- funsetownlst() assumes that processes cannot be registered for SIGIO
  once they have P_WEXIT set.  However, pfind() will happily return
  exiting processes, breaking the invariant.  Add an explicit check for
  P_WEXIT in fsetown() to fix this. [1]

Fixes:	f52979098d ("Fix a pair of races in SIGIO registration")
Reported by:	syzkaller [1]
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31661
2021-08-25 16:18:10 -04:00
Konstantin Belousov
6032b6ba95 amd64 UEFI loader: enable automatic disable of staging area copying
Discussed with:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
2021-08-25 22:26:52 +03:00
Piotr Pawel Stefaniak
9f7a81b133 diff3: document and test -T
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D31650
2021-08-25 18:20:59 +02:00
Ka Ho Ng
76321d2d43 param: Bump __FreeBSD_version to 1400032
Commit 9e202d036d introduces incompatible changes to
fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9)'s
rmsr.r_offset/*offset return value.

Sponsored by:	The FreeBSD Foundation
2021-08-26 00:03:55 +08:00
Ka Ho Ng
9e202d036d fspacectl(2): Changes on rmsr.r_offset's minimum value returned
rmsr.r_offset now is set to rqsr.r_offset plus the number of bytes
zeroed before hitting the end-of-file. After this change rmsr.r_offset
no longer contains the EOF when the requested operation range is
completely beyond the end-of-file. Instead in such case rmsr.r_offset is
equal to rqsr.r_offset.  Callers can obtain the number of bytes zeroed
by subtracting rqsr.r_offset from rmsr.r_offset.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D31677
2021-08-26 00:03:37 +08:00
Michael Tuexen
dc6ab77d66 tcp: make network epoch expectations of LRO explicit
Reviewed by:		gallatin, hselasky
MFC after:		3 days
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D31648
2021-08-25 17:12:36 +02:00
Kristof Provost
e62175df4e pf tests: test ALTQ CBQ on top of if_vlan
The main purpose of this test is to verify that we can use ALTQ on top
of if_vlan, but while we're here we also exercise the CBQ code. There's
already a basis test for HFSC, so it makes sense to test another
algorithm while we test if_vlan.

Reviewed by:	donner
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31649
2021-08-25 08:57:10 +02:00
Luiz Otavio O Souza
2e5ff01d0a if_vlan: add the ALTQ support to if_vlan.
Inspired by the iflib implementation, allow ALTQ to be used with if_vlan
interfaces.

Reviewed by:	donner
Obtained from:	pfsense
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31647
2021-08-25 08:56:45 +02:00
Keith Owens
3b29c8b4bd ddb: do not assume that ffs is mounted with softdep
Avoid a panic when debugging with "show ffs" in ddb.

Reviewed By:	kib, markj, mckusick
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D31622
2021-08-24 21:00:19 -05:00
Vladimir Kondratyev
8d73071c47 wsp(4): Add evdev support.
Reviewed by:	hselasky
Tested by:	Greg V, Constantin Furst<constantin_AT_fuersten_DOT_info>
MFC after:	2 weeks
PR:		252236
Differential revision:	https://reviews.freebsd.org/D31653
2021-08-25 02:01:42 +03:00
Vladimir Kondratyev
250ab00407 wsp(4): Compact parameter structure.
MFC after:	2 weeks
2021-08-25 01:59:48 +03:00
Vladimir Kondratyev
9fa1201d60 atp(4), wsp(4): Return correct priority from probe() method;
MFC after:	2 weeks
2021-08-25 01:59:17 +03:00
Vladimir Kondratyev
d056693d7b evdev: Add support for automatic MT protocol type A to type B conversion.
MFC after:	2 weeks
2021-08-25 01:53:56 +03:00
Vladimir Kondratyev
f76051c7da evdev: Add implicit mode for touch tracking.
In implicit mode assignment of slot number and tracking id is performed
automatically on each synchronization requested by device driver.

This is done with creation of intermediate buffer for multitouch events.
This buffer holds untracked events until synchronization is requested by
device driver. It is needed as touch assigment requires
knowledges of all touch positions pushed in current and previous reports.

MFC after:	2 weeks
2021-08-25 01:52:37 +03:00
Vladimir Kondratyev
4c0a134e32 evdev: Import support for touch-tracking.
Touch tracking is a process of assignment of unique trackingID to each
initiated contact on the surface.  Keeping the trackingIDs persistent
across multitouch reports requires solving of so called Euclidian
Bipartite Matching problem.

This commit imports EBM-solver implementation based on Dinitz-Kronrod
algorithm to find minimum cost matching between contacts listed in two
consecutive reports.

Obtained from:	OpenBSD
MFC after:	2 weeks
2021-08-25 01:50:53 +03:00
Vladimir Kondratyev
66bd52f5e2 evdev: Make MT tracking IDs monotonically increasing sequence.
MFC after:	2 weeks
2021-08-25 01:48:33 +03:00
Vladimir Kondratyev
059360287e evdev: Give short aliases to items of evdev_mt_slot array
with using of unioned anonymous structure.

Access to the same data by using different members of union generally
works despite it is not supported by C specs.

Also add helper function to report entire slot state.

MFC after:	2 weeks
2021-08-25 01:47:34 +03:00
Vladimir Kondratyev
127e54deb6 evdev: Normalize width and pressure of single touch compat events
to match Synaptics touchpad reporting range.

MFC after:	2 weeks
2021-08-25 01:46:49 +03:00
Vladimir Kondratyev
314913ed7c evdev: force no fuzz for autogenerated single touch compat events.
As fuzz has already been applied on multitouch event processing.
This allows to remove existing workaround for double fuzz procesing.

MFC after:	2 weeks
2021-08-25 01:45:50 +03:00
Vladimir Kondratyev
fbe17f9017 evdev: Send first active rather than 0-th slot state as ST report
MFC after:	2 weeks
2021-08-25 01:45:16 +03:00
Vladimir Kondratyev
2dc7188e53 evdev: Use bitsets to track active touches and slots changed in current report
Obtained from:	OpenBSD

MFC after: 	2 weeks
2021-08-25 01:44:36 +03:00
Vladimir Kondratyev
98a7606b85 evdev: Multitouch code style changes.
1. Move touch count reporting helpers to utils. They are not multitouch.
2. Use evdev_mt prefix for private multitouch support routines.
3. Use int instead of int32_t where fixed size is not required.
4. Export some internal functions.

This change should be no-op.

MFC after:	2 weeks
2021-08-25 01:43:41 +03:00
John Baldwin
4f0f5bf995 iscsi: Validate DataSN values in Data-In PDUs in the initiator.
As is done in the target, require that DataSN values are consecutive
and in-order.  If an out of order Data-In PDU is received, force a
session reconnect.  In addition, when a SCSI Response PDU is received,
verify that the ExpDataSN field matches the count of Data-In PDUs
received for this command.  If not, force a session reconnect.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31594
2021-08-24 14:58:34 -07:00
Mark Johnston
71fbc6faed bhyve: Fix vq_getchain() error handling bugs in various device models
Reviewed by:	grehan, khng
Approved by:	so
Security:	CVE-2021-29631
Security:	FreeBSD-SA-21:13.bhyve
2021-08-24 14:29:13 -04:00
Gordon Tetlow
aef815e787 Fix multiple OpenSSL vulnerabilities.
Approved by:	so
Security:	SA-21:16.openssl
Security:	CVE-2021-3711
Security:	CVE-2021-3712
2021-08-24 11:26:45 -07:00
Gordon Tetlow
64ae2f785e Fix libfetch out of bounds read.
Approved by:	so
Security:	SA-21:15.libfetch
Security:	CVE-2021-36159
2021-08-24 11:26:45 -07:00
Gordon Tetlow
91a8bed5a4 Fix remote code execution in ggatec(8).
Approved by:    so
Security:       SA-21:14.ggatec
Security:       CVE-2021-29630
2021-08-24 11:26:45 -07:00
Ka Ho Ng
a48416f844 tmpfs: Fix error being cleared after commit c12118f6ce
In tmpfs_link() error was erroneously cleared in commit c12118f6ce.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
MFC with:	c12118f6ce
2021-08-25 00:35:29 +08:00
Ka Ho Ng
5c1428d2c4 uipc_shm: Handle offset on shm_size as if it is beyond shm_size
This avoids any unnecessary works in such case.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	markj, kib
Differential Revision:	https://reviews.freebsd.org/D31655
2021-08-24 23:49:18 +08:00
Ka Ho Ng
c12118f6ce tmpfs: Fix styles
A lot of return statements were in the wrong style before this commit.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-08-24 22:45:08 +08:00
Mateusz Guzik
80b1995bb5 arm: export actlr as sysctl hw.cpu.quirks.actlr_value
Reviewed by:	cognet
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-24 14:21:39 +00:00
Jessica Clarke
83ec48b792 Revert "Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now"
The fixes for this have now been committed so we can re-enable these.

This reverts commit d9f25575a2.

MFC after:	1 week
2021-08-24 15:04:25 +01:00
Jessica Clarke
c1f7d8dd23 clang: Build with -fno-strict-aliasing when using GCC
Somewhat ironically, there are strict aliasing violations in Clang,
which can result in the following assertion failure:

  Assertion `*(NamedDecl **)&Data == ND && "PointerUnion mangles the NamedDecl pointer!"' failed.

Upstream's clang/CMakeLists.txt specifically (not LLVM as a whole)
passes -fno-strict-aliasing if the compiler is not Clang, and this fixes
the above issue.

This was seen when cross-building from Linux using a bootstrap
compiler, but likely also affects worlds built with a new enough
external GCC toolchain.

MFC after:	1 week
Reviewed by:	dim
Differential Revision:	https://reviews.freebsd.org/D31533
2021-08-24 15:04:25 +01:00
Jessica Clarke
c8edd05426 clang: Support building with GCC and DEBUG_FILES disabled
If MK_DEBUG_FILES=no then the Clang link rule has clang as .TARGET,
rather than clang.full, causing the implicit ${CFLAGS.${.TARGET:T}} to
be CFLAGS.clang, and thus pull in flags intended for when your compiler
is Clang, not when linking Clang itself. This doesn't matter if your
compiler is in fact Clang, but it breaks using GCC as, for example,
bsd.sys.mk adds -Qunused-arguments to CFLAGS.clang. This is seen when
trying to build a bootstrap toolchain on Linux where GCC is the system
compiler.

Thus, introduce a new internal NO_TARGET_FLAGS variable that is set by
Clang to disable the addition of these implicit flags. This is a bigger
hammer than necessary, as flags for .o files would be safe, but that is
not needed for Clang.

Note that the same problem does not arise for LDFLAGS when building LLD
with BFD, since our build produces a program called ld.lld, not plain
lld (unlike upstream, where ld.lld is a symlink to lld so they can
support multiple different flavours in one binary).

Suggested by:	sjg
Fixes:		31ba4ce889 ("Allow bootstrapping llvm-tblgen on macOS and Linux")
MFC after:	1 week
Reviewed by:	dim, imp, emaste
Differential Revision:	https://reviews.freebsd.org/D31532
2021-08-24 15:04:25 +01:00
Jessica Clarke
1e4c802913 Fix bootstrapping to actually build lldb-tblgen for later use
Because MK_LLDB=no is in BSARGS, the bootstrap-tools recursive make does
not add lldb-tblgen to _clang_tblgen, causing it to not be built. This
means that the build currently always uses the host's lldb-tblgen
(which, whilst currently it appears to work, could in future break if
TableGen backends are added or altered) and, if it doesn't exist (either
because the current FreeBSD system was built with it disabled, or you're
building on macOS/Linux), fails. Linux and macOS cross-builds used to
work simply because LLDB was previously in BROKEN_OPTIONS when building
on non-FreeBSD.

Instead, move MK_LLDB=no from BSARGS to XMAKE. This ensures that the
lib/clang build in cross-tools continues to not build LLDB parts for the
bootstrap toolchain (both to save time/space on FreeBSD, and because our
vendored LLDB does not include the macOS and Linux host files so those
would fail to build).

The DIRDEPS target is updated to move MK_LLDB=no from the BSARGS block
that mirrors Makefile.inc1 to the line that disables additional
toolchain components. The DIRDEPS build likely suffers from the same
issue currently, but having never used it and not being familiar with
how it works I am leaving that as-is. If it does suffer from the same
issue it should be easily reproducible by renaming /usr/bin/lldb-tblgen
or moving it to a directory not in PATH.

Fixes:		31ba4ce889 ("Allow bootstrapping llvm-tblgen on macOS and Linux")
MFC after:	1 week
Reviewed by:	dim, emaste, imp
Differential Revision:	https://reviews.freebsd.org/D31531
2021-08-24 15:04:25 +01:00
Jessica Clarke
ab3a18095f Makefile.inc1: Make sure sub-makes see MK_CLANG_BOOTSTRAP=no when XCC is a path
Currently we override MK_CLANG_BOOTSTRAP to no so we don't build a
bootstrap compiler, but subdirectories don't see that and so the hack in
bsd.sys.mk to prefer our includes over Clang's resource dir for external
toolchains is not enabled unless you use -DWITHOUT_CLANG_BOOTSTRAP
explicitly on top of XCC (which tools/build/make.py does not do),
causing duplicate definition errors when building rtld-elf due to the
use of -ffreestanding (Clang's stdint.h will use the system one when
hosted, but its own when freestanding, and only has glibc's preprocessor
guards, not FreeBSD's).

This broke when dropping CLANG_BOOTSTRAP from BROKEN_OPTIONS.

Fixes:		31ba4ce889 ("Allow bootstrapping llvm-tblgen on macOS and Linux")
MFC after:	1 week
Reviewed by:	imp, arichardson
Differential Revision:	https://reviews.freebsd.org/D31529
2021-08-24 15:04:25 +01:00
Ed Maste
37296464de memcpy.3: remove BUGS section allowing overlapping strings
The removed text claimed that memcpy is implemented using bcopy and thus
strings may overlap.  Use of bcopy is an implementation detail that is
no longer true, even if the implementation (on some archs) does allow
overlap.

In any case behaviour is undefined per the C standard if memcpy is
called with overlapping objects, and this man page already claimed that
src and dst may not overlap.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31192
2021-08-24 09:58:10 -04:00
Kristof Provost
9ce320820e pfctl: build fix
Fix the build issue introduced in e59eff9ad3 (pfctl: fix killing states by ID)

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-24 13:21:05 +02:00
Kristof Provost
bbf832f344 pf tests: test killing states by ID
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-24 12:54:13 +02:00