Commit Graph

268141 Commits

Author SHA1 Message Date
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
Kristof Provost
e59eff9ad3 pfctl: fix killing states by ID
Since the conversion to the new DIOCKILLSTATESNV the kernel no longer
exists the id and creatorid to be big-endian.
As a result killing states by id (i.e. `pfctl -k id -k 12345`) no longer
worked.

Reported by:	Özkan KIRIK
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-24 12:54:13 +02:00
Mateusz Guzik
36fc383018 Remove bcopy declaration
The kernel was migrated to memmove in ba96f37758 ("Use __builtin
for various mem* and b* (e.g. bzero) routines.").

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-24 11:24:08 +00:00
Mateusz Guzik
7ec4365671 libkern: remove bcopy
Unused since ba96f37758 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

File name remains to reduce churn.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-24 11:24:07 +00:00
Mateusz Guzik
9a1d562085 mips: retire ovbcopy
ovbcopy is unused since 9f45b2da8f ("Define ovbcopy() as a macro
which expands to the equivalent bcopy() call")

bcopy is left in place because it is used by assembly primitives

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-24 11:24:07 +00:00
Mateusz Guzik
d0bc029b4a arm64: retire bcopy
Unused since ba96f37758 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

Reviewed by:	andrew
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31651
2021-08-24 11:24:07 +00:00
Mateusz Guzik
38941f5993 i386: retire bcopy
Unused since ba96f37758 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-24 11:24:07 +00:00
Ka Ho Ng
1a4c5061fc param: Bump __FreeBSD_version to 1400031
Commit 1eaa36523c introduces backward compatible changes to
fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9).
rmsr.r_offset and *offset is updated to contain meaningful value upon
returning from the call.

Sponsored by:	The FreeBSD Foundation
2021-08-24 17:13:00 +08:00
Ka Ho Ng
1eaa36523c fspacectl(2): Clarifies the return values
rmacklem@ spotted two things in the system call:
- Upon returning from a successful operation, vop_stddeallocate can
  update rmsr.r_offset to a value greater than file size. This behavior,
  although being harmless, can be confusing.
- The EINVAL return value for rqsr.r_offset + rqsr.r_len > OFF_MAX is
  undocumented.

This commit has the following changes:
- vop_stddeallocate and shm_deallocate to bound the the affected area
  further by the file size.
- The EINVAL case for rqsr.r_offset + rqsr.r_len > OFF_MAX is
  documented.
- The fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9)'s return
  len is explicitly documented the be the value 0, and the return offset
  is restricted to be the smallest of off + len and current file size
  suggested by kib@. This semantic allows callers to interact better
  with potential file size growth after the call.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D31604
2021-08-24 17:08:28 +08:00
Ka Ho Ng
5425ba8332 truncate(1): Fix cross-build CI failure due to missing fspacectl
For other platforms, fspacectl(2) is absent. This commit masks out the
calls to fspacectl(2) and replace them with a ENODEV errno.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31619
2021-08-24 17:08:28 +08:00
Sam Hathaway
2e9e2c8ff5
zpool-remove.8: describe top-level vdev sector size limitation
Document that top-level vdevs cannot be removed unless all top-level
vdevs have the same sector size.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Sam Hathaway <sam@sam-hathaway.com>
Closes #11339
Closes #12472
2021-08-23 14:59:18 -07:00
Kristof Provost
159258afb5 altq: Fix panics on rmc_restart()
rmc_restart() is called from a timer, but can trigger traffic. This
means the curvnet context will not be set.
Use the vnet associated with the interface we're currently processing to
set it. We also have to enter net_epoch here, for the same reason.

Reviewed by:	mjg
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31642
2021-08-23 21:35:41 +02:00
Mateusz Guzik
e72e16c55d Remove bzero declaration
The kernel was migrated to memset in ba96f37758 ("Use __builtin
for various mem* and b* (e.g. bzero) routines.") and there are no
remaining architectures using the file.

malloc is augmented to prevent KMSAN from breaking.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-23 18:38:05 +00:00
Mateusz Guzik
a4c33d65f2 mips: retire bzero
Unused since ba96f37758 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-23 18:38:05 +00:00
Mateusz Guzik
11cb9a096c powerpc: retire bzero
Unused since ba96f37758 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

Reviewed by:	jhibbits
Sponsored by:   Rubicon Communications, LLC ("Netgate")
2021-08-23 18:38:05 +00:00
Mateusz Guzik
c69cc8d101 riscv: retire bzero
Unused since ba96f37758 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

Reviewed by:	mhorne
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-23 18:38:05 +00:00