]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agompr/mps/mpt: verify cfg page ioctl lengths
Ed Maste [Mon, 28 Mar 2022 13:33:54 +0000 (09:33 -0400)]
mpr/mps/mpt: verify cfg page ioctl lengths

*_CFG_PAGE ioctl handlers in the mpr, mps, and mpt drivers allocated a
buffer of a caller-specified size, but copied to it a fixed size header.
Add checks that the size is at least the required minimum.

Note that the device nodes are owned by root:operator with 0640
permissions so the ioctls are not available to unprivileged users.

This change includes suggestions from scottl, markj and mav.

Two of the mpt cases were reported by Lucas Leong (@_wmliang_) of
Trend Micro Zero Day Initiative; scottl reported the third case in mpt.
Same issue found in mpr and mps after discussion with imp.

Reported by: Lucas Leong (@_wmliang_), Trend Micro Zero Day Initiative
Reviewed by: imp, mav
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34692

2 years agosctp: get rid of stcb send lock
Michael Tuexen [Mon, 28 Mar 2022 23:50:17 +0000 (01:50 +0200)]
sctp: get rid of stcb send lock

Just use the stcb lock instead to simplify locking.

Reported by: syzbot+d00b202063150f85b110@syzkaller.appspotmail.com
Reported by: syzbot+87f268a0a6d2d6383306@syzkaller.appspotmail.com
MFC after: 3 days

2 years agonfscl: Fix IO_APPEND writes from kernel space
Rick Macklem [Mon, 28 Mar 2022 22:11:52 +0000 (15:11 -0700)]
nfscl: Fix IO_APPEND writes from kernel space

Commit 867c27c23a5c modified the NFS client so that
it did IO_APPEND writes directly to the NFS server
bypassing the buffer cache, via a call to
nfs_directio_write().  Unfortunately, this (very old)
function assumed that the uio iov was for user space
addresses.  As such, a IO_APPEND VOP_WRITE() that
was for system space, such as ktrace(1) does, would
write bogus data.

This patch fixes nfs_directio_write() so that it
handles kernel space uio iovs.

Reported by: bz
Tested by: bz
MFC after: 2 weeks

2 years agouudecode: use SRCDIR in the regression test
Piotr Pawel Stefaniak [Mon, 28 Mar 2022 18:50:40 +0000 (20:50 +0200)]
uudecode: use SRCDIR in the regression test

Fixes: 9f3203c00314 "uudecode: correct error message"

2 years agosysent: regen for syscallarg_t
Brooks Davis [Mon, 28 Mar 2022 18:43:03 +0000 (19:43 +0100)]
sysent: regen for syscallarg_t

2 years agosyscallarg_t: Add a type for system call arguments
Brooks Davis [Mon, 28 Mar 2022 18:43:03 +0000 (19:43 +0100)]
syscallarg_t: Add a type for system call arguments

This more clearly differentiates system call arguments from integer
registers and return values. On current architectures it has no effect,
but on architectures where pointers are not integers (CHERI) and may
not even share registers (CHERI-MIPS) it is necessiary to differentiate
between system call arguments (syscallarg_t) and integer register values
(register_t).

Obtained from: CheriBSD

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D33780

2 years agoshare/mk: Remove obsolete reference to LINTLIBDIR
Brooks Davis [Mon, 28 Mar 2022 18:43:03 +0000 (19:43 +0100)]
share/mk: Remove obsolete reference to LINTLIBDIR

Lint support was removed in 1cbb58886a477cf282072eaa331d8122e36e9952,
but this entry (accidently added in an unrelated commit) wasn't
removed.

2 years agoxen(4): Fix a few typos in source code comments
Gordon Bergling [Sun, 27 Mar 2022 16:05:58 +0000 (18:05 +0200)]
xen(4): Fix a few typos in source code comments

- s/querried/queried/

MFC after: 3 days

2 years agoffs(3): Fix a common typo in source code comments
Gordon Bergling [Sun, 27 Mar 2022 16:03:16 +0000 (18:03 +0200)]
ffs(3): Fix a common typo in source code comments

- s/quadradically/quadratically/

Obtained from: NetBSD
MFC after: 3 days

2 years agogpart(8): Fix two typos in source code comments
Gordon Bergling [Sun, 27 Mar 2022 16:01:55 +0000 (18:01 +0200)]
gpart(8): Fix two typos in source code comments

- s/partiton/partition/

MFC after: 3 days

2 years agomlx5en(4): Fix a few typos in source code comments
Gordon Bergling [Sun, 27 Mar 2022 15:59:43 +0000 (17:59 +0200)]
mlx5en(4): Fix a few typos in source code comments

- s/persistant/persistent/

MFC after: 3 days

2 years agobfe(4): Fix a typo in a comment
Gordon Bergling [Sun, 27 Mar 2022 15:57:04 +0000 (17:57 +0200)]
bfe(4): Fix a typo in a comment

2 years agocamcontrol(8): Fix typo in a source code comment
Gordon Bergling [Mon, 7 Feb 2022 17:25:51 +0000 (18:25 +0100)]
camcontrol(8): Fix typo in a source code comment

- s/querried/queried/

MFC after: 3 days

2 years agopfctl(8): Fix a typo in a comment
Gordon Bergling [Sun, 27 Mar 2022 15:55:55 +0000 (17:55 +0200)]
pfctl(8): Fix a typo in a comment

- s/steping/stepping/

MFC after: 3 days

2 years agovxlan(4): Fix two typos in sysctl descriptions
Gordon Bergling [Mon, 7 Feb 2022 17:23:35 +0000 (18:23 +0100)]
vxlan(4): Fix two typos in sysctl descriptions

- s/fowarding/forwarding/

MFC after: 3 days

2 years agofstyp(8): Fix a few typos in source code comments
Gordon Bergling [Mon, 7 Feb 2022 17:20:48 +0000 (18:20 +0100)]
fstyp(8): Fix a few typos in source code comments

- s/mmaping/mapping/
- s/filesytem/filesystem/

MFC after: 3 days

2 years agomount(8): Fix a typo in source code comments
Gordon Bergling [Mon, 7 Feb 2022 17:15:34 +0000 (18:15 +0100)]
mount(8): Fix a typo in source code comments

- s/filesytem/filesystem/

MFC after: 3 days

2 years agoextra_tcp_stacks: Fix two typos in source code comments
Gordon Bergling [Mon, 7 Feb 2022 17:14:22 +0000 (18:14 +0100)]
extra_tcp_stacks: Fix two typos in source code comments

- s/recusive/recursive/

MFC after: 3 days

2 years agostand: Fix a common typo in source code comments
Gordon Bergling [Mon, 7 Feb 2022 17:12:58 +0000 (18:12 +0100)]
stand: Fix a common typo in source code comments

- s/existance/existence/

MFC after: 3 days

2 years agolibc: Fix a typo in a source code comment
Gordon Bergling [Sun, 6 Feb 2022 16:25:59 +0000 (17:25 +0100)]
libc: Fix a typo in a source code comment

- s/compnent/component/

MFC after: 3 days

2 years agocxgbetool(8): Fix a typo in the man page
Gordon Bergling [Sun, 27 Mar 2022 16:58:52 +0000 (18:58 +0200)]
cxgbetool(8): Fix a typo in the man page

- s/begining/beginning/

MFC after: 3 days

2 years agopkgbase: Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 16:56:58 +0000 (18:56 +0200)]
pkgbase: Fix a typo in a source code comment

- s/begining/beginning/

MFC after: 3 days

2 years agoxen(3): Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 16:54:13 +0000 (18:54 +0200)]
xen(3): Fix a typo in a source code comment

- s/mmaping/mapping/

MFC after: 3 days

2 years agopmc(3): Fix a common typo in json descriptions
Gordon Bergling [Sun, 6 Feb 2022 16:17:57 +0000 (17:17 +0100)]
pmc(3): Fix a common typo in json descriptions

- s/from from/from/

MFC after: 3 days

2 years agonetinet6: Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 16:52:38 +0000 (18:52 +0200)]
netinet6: Fix a typo in a source code comment

- s/maping/mapping/

MFC after: 3 days

2 years agonetgraph(3): Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 16:50:45 +0000 (18:50 +0200)]
netgraph(3): Fix a typo in a source code comment

- s/failes/fails/

MFC after: 3 days

2 years agoqlnxe(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 16:45:13 +0000 (18:45 +0200)]
qlnxe(4): Fix a typo in a source code comment

- s/existance/existence/

MFC after: 3 days

2 years agoisci(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 16:42:11 +0000 (18:42 +0200)]
isci(4): Fix a typo in a source code comment

- s/recored/recorded/

MFC after: 3 days

2 years agoexca(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 16:39:36 +0000 (18:39 +0200)]
exca(4): Fix a typo in a source code comment

- s/maping/mapping/

MFC after: 3 days

2 years agodrm2: Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 16:36:32 +0000 (18:36 +0200)]
drm2: Fix a typo in a source code comment

- s/mmaping/mapping/

MFC after: 3 days

2 years agoipfilter(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 16:33:25 +0000 (18:33 +0200)]
ipfilter(4): Fix a typo in a source code comment

- s/existance/existence/

MFC after: 3 days

2 years agocxgbe(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 16:32:19 +0000 (18:32 +0200)]
cxgbe(4): Fix a typo in a source code comment

- s/begining/beginning/

MFC after: 3 days

2 years agogeom(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 16:31:00 +0000 (18:31 +0200)]
geom(4): Fix a typo in a source code comment

- s/comand/command/

MFC after: 3 days

2 years agolibefivar(3): Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 16:29:32 +0000 (18:29 +0200)]
libefivar(3): Fix a typo in a source code comment

- s/partiton/partition/

MFC after: 3 days

2 years agoBump __FreeBSD_version after linuxkpi updates
Emmanuel Vadot [Mon, 28 Mar 2022 16:31:02 +0000 (18:31 +0200)]
Bump __FreeBSD_version after linuxkpi updates

2 years agolinuxkpi: Change irq_work_queue to return a bool
Emmanuel Vadot [Mon, 28 Mar 2022 13:27:27 +0000 (15:27 +0200)]
linuxkpi: Change irq_work_queue to return a bool

This was changed in Linux v5.10

MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co .KG

2 years agolibc: Check for readdir(2) errors in fts(3)
Ganael LAPLANCHE [Mon, 28 Mar 2022 14:54:02 +0000 (10:54 -0400)]
libc: Check for readdir(2) errors in fts(3)

Previously, such errors were not distinguished from the end-of-directory
condition.

With improvements from Mahmoud Abumandour <ma.mandourr@gmail.com>.

Reviewed by: markj
PR: 262038
MFC after: 2 weeks

2 years agolibc: Restore fp state upon flush error in fputc
Mark Johnston [Fri, 25 Mar 2022 14:46:24 +0000 (10:46 -0400)]
libc: Restore fp state upon flush error in fputc

This is akin to commit bafaa70b6f9098d83d074968c8e6747ecec1e118.

Reported by: Guy Yur <guyyur@gmail.com>
Fixes: 86a16ada1ea6
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

2 years agoaudit: Initialize vattr fields before calling VOP_GETATTR
Mark Johnston [Sun, 20 Mar 2022 01:59:13 +0000 (21:59 -0400)]
audit: Initialize vattr fields before calling VOP_GETATTR

Some filesystems do not fill out certain optional vattr fields.  To
ensure that they do not get copied out to userspace uninitialized, use
VATTR_NULL to provide default values.

Reported by: KMSAN
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

2 years agohpet: Allow a MMIO window smaller than 1K
John F. Carr [Sat, 19 Mar 2022 22:51:43 +0000 (18:51 -0400)]
hpet: Allow a MMIO window smaller than 1K

Some new AMD systems provide a HPET MMIO region smaller than the 1KB
specified, and a correspondingly small number of timers.  Handle this in
the HPET driver rather than requiring a 1KB window.  This allows the
HPET driver to attach on such systems.

PR: 262638
Reviewed by: markj
MFC after: 1 month

2 years agodevd: Add rtw to wireless list
Warner Losh [Mon, 28 Mar 2022 14:16:14 +0000 (08:16 -0600)]
devd: Add rtw to wireless list

rtw88 and rtw89 are coming soon, so add them here now

Sponsored by: Netflix
MFC After: 1 day

2 years agolinuxkpi: Add llnode member in struct irq_work
Emmanuel Vadot [Mon, 28 Mar 2022 12:48:28 +0000 (14:48 +0200)]
linuxkpi: Add llnode member in struct irq_work

This was added in Linux v5.8 and started to be used in drm code in v5.9

MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agopf: add a rule rb tree
Mateusz Guzik [Mon, 28 Feb 2022 20:17:32 +0000 (21:17 +0100)]
pf: add a rule rb tree

with md5 sum used as key.

This gets rid of the quadratic rule traversal when "keep_counters" is
set.

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf: pre-compute rule hash
Mateusz Guzik [Fri, 25 Feb 2022 17:50:56 +0000 (18:50 +0100)]
pf: pre-compute rule hash

Makes it cheaper to compare rules when "keep_counters" is set.
This also sets up keeping them in a RB tree.

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf: add pf_config_lock
Mateusz Guzik [Fri, 25 Feb 2022 17:56:45 +0000 (18:56 +0100)]
pf: add pf_config_lock

For now only protects rule creation/destruction, but will allow
gradually reducing the scope of rules lock when changing the
rules.

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf: include anchor path when hashing a rule
Mateusz Guzik [Mon, 21 Mar 2022 16:34:42 +0000 (16:34 +0000)]
pf: include anchor path when hashing a rule

Otherwise all anchors hash to the same value.

Note this can result in checksum mismatches between pfsynced hosts,
but it has to be sorted out as the previously computed checksum
would fail to indicate changed anchors.

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agorouting: copy nexthop fib when changing existing nexthop
Alexander V. Chernikov [Mon, 28 Mar 2022 11:31:23 +0000 (11:31 +0000)]
routing: copy nexthop fib when changing existing nexthop

MFC after: 1 day

2 years agoFix a sign mismatch warning in the physmem code
Andrew Turner [Mon, 28 Mar 2022 10:29:42 +0000 (11:29 +0100)]
Fix a sign mismatch warning in the physmem code

Make sure both sides of a comparison are unsigned. As the values being
compared are size_t make the the value in the for loop size_t too.

Sponsored by: The FreeBSD Foundation

2 years agouudecode: add missing test files to Makefile
Piotr Pawel Stefaniak [Mon, 28 Mar 2022 09:49:22 +0000 (11:49 +0200)]
uudecode: add missing test files to Makefile

Fixes: 9f3203c00314 "uudecode: correct error message"

2 years agoTreat cache write as a read in arm64 data faults
Andrew Turner [Sat, 26 Mar 2022 15:59:34 +0000 (15:59 +0000)]
Treat cache write as a read in arm64 data faults

On arm64 we can ask the hardware to perform cache operations from
userspace. These require read permission however when the memory is
unmapped the kernel will receive a write exception. Add a check to
see if the cause of the exception is from the cache and pass a memory
read fault type to the vm subsystem.

PR: 262836
Reported by: dch
Sponsored by: The FreeBSD Foundation

2 years agostress2: Enable four quota tests, which now seems to run without issues
Peter Holm [Mon, 28 Mar 2022 08:44:51 +0000 (10:44 +0200)]
stress2: Enable four quota tests, which now seems to run without issues

2 years agouudecode: correct error message
Piotr Pawel Stefaniak [Mon, 8 Nov 2021 14:31:03 +0000 (15:31 +0100)]
uudecode: correct error message

PR: 153276
Reported by: David Brennan

2 years agouu{encode,decode}: improve style
Piotr Pawel Stefaniak [Mon, 8 Nov 2021 14:31:01 +0000 (15:31 +0100)]
uu{encode,decode}: improve style

2 years agosh: fix autocompletion for commands that share name with a directory
Piotr Pawel Stefaniak [Sat, 12 Mar 2022 11:08:05 +0000 (12:08 +0100)]
sh: fix autocompletion for commands that share name with a directory

Provide libedit a special function making it always add a space after
the autocompleted command. The default one adds a slash if the word is
also a name of a directory in the current working directory, but this is
wrong for commands.

Reviewed by: bapt, jilles
Differential Revision: https://reviews.freebsd.org/D34544

2 years agoMFV 45916e7c91ce: libbsdxml (expat) 2.4.7
Xin LI [Mon, 28 Mar 2022 05:22:07 +0000 (22:22 -0700)]
MFV 45916e7c91ce: libbsdxml (expat) 2.4.7
Update contrib/expat from 2.4.6 to 2.4.7.

MFC after: 2 weeks
Relnotes: yes

2 years agoVendor import of expat 2.4.7.
Xin LI [Mon, 28 Mar 2022 05:19:28 +0000 (22:19 -0700)]
Vendor import of expat 2.4.7.

2 years agoDescribe modern time zone handling.
Greg Lehey [Mon, 28 Mar 2022 03:57:37 +0000 (14:57 +1100)]
Describe modern time zone handling.
Reviewed by: peterj@
MFC after: 2 weeks

2 years agosys/stdatomic.h: be nicer to c++
Konstantin Belousov [Sun, 27 Mar 2022 21:16:15 +0000 (00:16 +0300)]
sys/stdatomic.h: be nicer to c++

Use of stdatomic.h is undefined in C++, even the C++ 2020 standard does not
list stdatomic.h as a C library header supported by the language.  More,
there are some subtle differences between the <atomic> C++ header, and
C11+ stdatomic.h provided features.

Nonetheless, it is a quality of the implementation aspect, so let mis-users
mis-use stdatomic.h as they want, by making a compat shim for _Bool.

PR: 262683
Reported by: yuri
Reviewed by: dim, emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34686

2 years agoypbind(8): Fix a typo in the man page
Gordon Bergling [Sun, 27 Mar 2022 18:42:24 +0000 (20:42 +0200)]
ypbind(8): Fix a typo in the man page

- s/ot/or/

MFC after: 3 days

2 years agonetgraph(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 18:08:44 +0000 (20:08 +0200)]
netgraph(4): Fix a typo in a source code comment

- s/shapshot/snapshot/

MFC after: 3 days

2 years agoclang: Skip attempts to access /proc/self/fd
Mateusz Guzik [Sun, 27 Mar 2022 18:01:38 +0000 (18:01 +0000)]
clang: Skip attempts to access /proc/self/fd

In contrast to Linux it does not provide entries which can be readlinked
-- these are just regular files, not giving the expected outcome. That's
on top of procfs not being mounted by default to begin with.

Reviewed by: dim
Differential Revision: https://reviews.freebsd.org/D34684

2 years agopf(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 17:57:49 +0000 (19:57 +0200)]
pf(4): Fix a typo in a source code comment

- s/seaching/searching/

MFC after: 3 days

2 years agomac_veriexec: Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 17:56:15 +0000 (19:56 +0200)]
mac_veriexec: Fix a typo in a source code comment

- s/seach/search/

MFC after: 3 days

2 years agolibmd: Fix a common typo in the license header
Gordon Bergling [Sun, 27 Mar 2022 17:46:32 +0000 (19:46 +0200)]
libmd: Fix a common typo in the license header

- s/rouines/routines/

Obtained from: NetBSD
MFC after: 3 days

2 years agoath: Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 17:28:49 +0000 (19:28 +0200)]
ath: Fix a typo in a source code comment

- s/ony/only/

MFC after: 3 days

2 years agonfsclient: Fix a typos in source code comments
Gordon Bergling [Sun, 27 Mar 2022 17:27:05 +0000 (19:27 +0200)]
nfsclient: Fix a typos in source code comments

- s/ony/only/

Obtained from: NetBSD
MFC after: 3 days

2 years agovfs: add missing bits to vdropl_impl
Mateusz Guzik [Sun, 27 Mar 2022 14:00:09 +0000 (14:00 +0000)]
vfs: add missing bits to vdropl_impl

This completes the patch which was originally meant to go in.

Spotted by: mhorne
Fixes: c35ec1efdcb2978b ("vfs: [1/2] fix stalls in vnode reclaim by not
requeieing from vnlru")

2 years agovfs: assorted tidy ups to lookup
Mateusz Guzik [Sat, 26 Mar 2022 10:26:59 +0000 (10:26 +0000)]
vfs: assorted tidy ups to lookup

No functional changes.

2 years agoLog euid, rgid and jail on listen queue overflow
Alexander Leidinger [Sat, 26 Mar 2022 10:14:16 +0000 (11:14 +0100)]
Log euid, rgid and jail on listen queue overflow

If you have numerous jails with multiple similar services running,
this helps to narrow down which services this log is referring to.

2 years agolibarchive: merge vendor bugfixes
Martin Matuska [Sat, 26 Mar 2022 10:04:36 +0000 (11:04 +0100)]
libarchive: merge vendor bugfixes

Bugfixes:
  IS #1672 and OSS-Fuzz #38766:
    (zip reader) fix possible out-of-bounds read in zipx_lzma_alone_init()
  PR #1676: (mtree reader) remove the unused variable "detected_bytes"
  PR #1674: (doc) fix use of At mdoc(7) macro in cpio.5

MFC after: 3 days

2 years agoUpdate vendor/libarchive to libarchive/libarchive@cfaa28168
Martin Matuska [Sat, 26 Mar 2022 09:46:31 +0000 (10:46 +0100)]
Update vendor/libarchive to libarchive/libarchive@cfaa28168

Bugfixes:
  IS #1672 and OSS-Fuzz #38766:
    (zip reader) fix possible out-of-bounds read in zipx_lzma_alone_init()
  PR #1676: (mtree reader) remove the unused variable "detected_bytes"
  PR #1674: (doc) fix use of At mdoc(7) macro in cpio.5

Obtained from: libarchive
Libarchive commit: cfaa28168a07ea4a53276b63068f94fce37d6aff

2 years agodepend-cleanup.sh: Handle libc bcmp.c moving back to bcmp.S on amd64
Mateusz Guzik [Sat, 26 Mar 2022 09:11:31 +0000 (09:11 +0000)]
depend-cleanup.sh: Handle libc bcmp.c moving back to bcmp.S on amd64

2 years agoamd64: bring back asm bcmp, shared with memcmp
Mateusz Guzik [Fri, 25 Mar 2022 15:04:04 +0000 (15:04 +0000)]
amd64: bring back asm bcmp, shared with memcmp

Turns out clang converts "memcmp(foo, bar, len) == 0" and similar to
bcmp calls.

Reviewed by: emaste (previous version), jhb (previous version)
Differential Revision: https://reviews.freebsd.org/D34673

2 years agojail: handle jailsys parameters in modification permission test
Jamie Gritton [Sat, 26 Mar 2022 02:16:51 +0000 (19:16 -0700)]
jail: handle jailsys parameters in modification permission test

Avoid a null dereference when a value-less jailsys parameter is passed
to "jail -m".  There was already code to handle boolean parameters,
but in reality any parameter could be passed without a value.

2 years agouma_zalloc_domain: call uma_zalloc_debug in multi-domain path
Eric van Gyzen [Mon, 7 Mar 2022 17:12:15 +0000 (11:12 -0600)]
uma_zalloc_domain: call uma_zalloc_debug in multi-domain path

It was only called in the non-NUMA and single-domain paths.
Some of its assertions were duplicated in uma_zalloc_domain,
but some things were missed, especially memguard.

Reviewed by: markj, rstone
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34472

2 years agostack_zero is not needed before stack_save
Eric van Gyzen [Mon, 7 Mar 2022 16:01:45 +0000 (10:01 -0600)]
stack_zero is not needed before stack_save

The man page was recently clarified to commit to this contract.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

2 years agostack(9): dynamic allocation is not necessary
Eric van Gyzen [Mon, 7 Mar 2022 01:12:28 +0000 (19:12 -0600)]
stack(9): dynamic allocation is not necessary

The man page said dynamic allocation was required, but struct stack
can be allocated in any way, including on the stack.  Make this clear,
and explain how to initialize the struct.

While I'm here, stack_save does not require any lock.

Reviewed by: markj, Pau Amma <pauamma_gundo.com>
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34461

2 years agouma_zalloc: assert M_NOWAIT ^ M_WAITOK
Eric van Gyzen [Fri, 4 Mar 2022 11:23:08 +0000 (05:23 -0600)]
uma_zalloc: assert M_NOWAIT ^ M_WAITOK

The uma_zalloc functions expect exactly one of [M_NOWAIT, M_WAITOK].
If neither or both are passed, print an error and a stack dump.
Only do this ten times, to prevent livelock.  In the future, after
this exposes enough bad callers, this will be changed to a KASSERT().

Reviewed by: rstone, markj
MFC after: 1 month
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34452

2 years agoksiginfo_alloc: pass M_WAITOK or M_NOWAIT to uma_zalloc
Eric van Gyzen [Fri, 4 Mar 2022 21:01:06 +0000 (15:01 -0600)]
ksiginfo_alloc: pass M_WAITOK or M_NOWAIT to uma_zalloc

It expects exactly one of those flags.  A future commit will assert this.

Reviewed by: rstone
MFC after: 1 month
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34451

2 years agovm_ksubmap_init: pass M_WAITOK to vmem_init -> uma_zalloc_arg
Eric van Gyzen [Fri, 4 Mar 2022 20:55:12 +0000 (14:55 -0600)]
vm_ksubmap_init: pass M_WAITOK to vmem_init -> uma_zalloc_arg

uma_zalloc_arg expects exactly one of the two WAIT flags.  A future
commit will assert this.

Reviewed by: rstone
MFC after: 1 month
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34450

2 years agobsdinstall checksum: Replace dialog with bsddialog
Alfonso S. Siciliano [Sat, 26 Mar 2022 00:36:13 +0000 (01:36 +0100)]
bsdinstall checksum: Replace dialog with bsddialog

Replace (LGPL) dialog utility with (BSD-2-Clause) bsddialog utility.

Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D34660

2 years agobsdinstall mirrorselect: Replace dialog with bsddialog
Alfonso S. Siciliano [Sat, 26 Mar 2022 00:13:59 +0000 (01:13 +0100)]
bsdinstall mirrorselect: Replace dialog with bsddialog

Replace (LGPL) dialog utility with (BSD-2-Clause) bsddialog utility.

Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D34582

2 years agobsdinstall time: Revert dialog title
Alfonso S. Siciliano [Fri, 25 Mar 2022 23:50:03 +0000 (00:50 +0100)]
bsdinstall time: Revert dialog title

Revert dialog title like before dialog(1) replacement
0e5c72c3cc5471dfa8cb42b018d623b1ef15dbe8.

Reported by: jrtc27
Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D34647

2 years agobsdinstall services: Replace dialog with bsddialog
Alfonso S. Siciliano [Fri, 25 Mar 2022 23:19:36 +0000 (00:19 +0100)]
bsdinstall services: Replace dialog with bsddialog

Replace (LGPL) dialog utility with (BSD-2-Clause) bsddialog utility.

Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D34640

2 years agortsx: Remove update of softc during probe and some var rename.
Henri Hennebert [Fri, 25 Mar 2022 19:23:59 +0000 (15:23 -0400)]
rtsx: Remove update of softc during probe and some var rename.

MFC after: 1 week

2 years agovfs: set cn_namelen when handling degenerate lookups
Mateusz Guzik [Fri, 25 Mar 2022 18:19:36 +0000 (18:19 +0000)]
vfs: set cn_namelen when handling degenerate lookups

Turns out execve looks at it to store binary name, but in order to
trigger the problem one has to be trying to exec '/'. As is the value
would be left uninitialized (or rather set to -1 on debug kernels).

Fixes: 56244d35741a62e7 ("vfs: hoist degenerate path lookups out of the
loop")

2 years agodepend-cleanup.sh: Handle libc bcmp.S moving to bcmp.c on amd64.
John Baldwin [Fri, 25 Mar 2022 18:03:18 +0000 (11:03 -0700)]
depend-cleanup.sh: Handle libc bcmp.S moving to bcmp.c on amd64.

Reviewed by: emaste
Fixes: 5fc3cc2713eff8cd ("amd64: make bcmp in libc just call memcmp")
Differential Revision: https://reviews.freebsd.org/D34676

2 years agoDrop an OBE MP safe comment.
John Baldwin [Fri, 25 Mar 2022 17:01:39 +0000 (10:01 -0700)]
Drop an OBE MP safe comment.

2 years agoarm: Zero padding in mcontext_vfp_t in get_vfpcontext().
John Baldwin [Fri, 25 Mar 2022 16:57:20 +0000 (09:57 -0700)]
arm: Zero padding in mcontext_vfp_t in get_vfpcontext().

This can leak kernel stack data otherwise.

Reviewed by: imp, markj
Sponsored by: The University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34594

2 years agoAdd the Ampere and Fujitsu arm64 implementer IDs
D Scott Phillips [Fri, 25 Mar 2022 16:05:22 +0000 (09:05 -0700)]
Add the Ampere and Fujitsu arm64 implementer IDs

Reviewed By: andrew, emaste
MFC after: 3 days
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D34666

2 years agoarm64: Add explicit barrier after address translation instruction
D Scott Phillips [Fri, 25 Mar 2022 16:04:47 +0000 (09:04 -0700)]
arm64: Add explicit barrier after address translation instruction

Following ARMARM sec D5.2.11, which says:

> Where an instruction results in an update to a System register,
> as is the case with the AT * address translation instructions,
> explicit synchronization must be performed before the result is
> guaranteed to be visible to subsequent direct reads of the
> PAR_EL1.

Reviewed By: andrew
MFC after: 3 weeks
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D34665

2 years agoarm64: pmap: Mask VA operand in TLBI instructions
D Scott Phillips [Fri, 25 Mar 2022 16:04:11 +0000 (09:04 -0700)]
arm64: pmap: Mask VA operand in TLBI instructions

Bits 43:0 of the TLBI operand are bits 55:12 of the VA.  Leaving
bits 63:55 of the VA in bits 51:44 of the operand might wind up
setting the TTL field (47:44) and accidentally restricting which
translation levels are flushed in the TLB.

Reviewed By: andrew
MFC after: 3 days
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D34664

2 years agoamd64: remove bcmp.S
Mateusz Guzik [Fri, 25 Mar 2022 14:54:55 +0000 (14:54 +0000)]
amd64: remove bcmp.S

Fixes: 5fc3cc2713eff8cd ("amd64: make bcmp in libc just call memcmp")
2 years agolinux(4): Add AT_NO_AUTOMOUNT to statx.
Dmitry Chagin [Fri, 25 Mar 2022 14:54:23 +0000 (17:54 +0300)]
linux(4): Add AT_NO_AUTOMOUNT to statx.

Specific to Linux AT_NO_AUTOMOUNT flag tells the kernel to not automount the
terminal component of pathname if it is a directory that is an automount point.
As it is the default for FreeBSD silencly ignore this flag.

glibc-2.34 uses this flag in the stat64 system calls which is used by i386.

Reviewed by: trasz
Differential revision:  https://reviews.freebsd.org/D31524
MFC after: 2 weeks

2 years agolinprocfs: Eliminate bogus comment (KSE).
Dmitry Chagin [Fri, 25 Mar 2022 14:53:08 +0000 (17:53 +0300)]
linprocfs: Eliminate bogus comment (KSE).

Reviewed by: trasz, emaste
Differential revision: https://reviews.freebsd.org/D31525
MFC after: 2 weeks

2 years agopf: ether l3 rules can only use addresses
Kristof Provost [Fri, 25 Mar 2022 10:13:47 +0000 (11:13 +0100)]
pf: ether l3 rules can only use addresses

Disallow the use of tables in ethernet rules. Using tables requires
taking the PF_RULES lock. Moreover, the current table code isn't ready
to deal with ethernet rules.

Disallow their use for now.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agocxgbe(4): Handle FORCE_FEC in pcaps correctly.
Navdeep Parhar [Fri, 25 Mar 2022 07:34:54 +0000 (00:34 -0700)]
cxgbe(4): Handle FORCE_FEC in pcaps correctly.

The firmware doesn't report FORCE_FEC in pcaps if the transceiver
plugged in at that time does not support a speed that may use FEC.  It
is incorrect for the driver to assume that the FORCE_FEC value it read
during attach (in init_link_config) is permanent.  Instead, it should
check pcaps just before issuing the L1CFG command.

MFC after: 1 week
Sponsored by: Chelsio Communications

2 years agoLinuxKPI: 802.11: cleanup debugging
Bjoern A. Zeeb [Thu, 24 Mar 2022 19:09:04 +0000 (19:09 +0000)]
LinuxKPI: 802.11: cleanup debugging

Cleanup some debugging.  Rename the global variable to be less
generic.  Hide all debugging behind #ifdef for now and turn off.
Rename the debugging sysctl so we can start adding more to the
subtree.

There is a need to change that wildly grown infrastructure into
something more homogenic soon but this should do for 13.1.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agox86: Add a NT_X86_SEGBASES register set.
John Baldwin [Thu, 24 Mar 2022 18:36:19 +0000 (11:36 -0700)]
x86: Add a NT_X86_SEGBASES register set.

This register set contains the values of the fsbase and gsbase
registers.  Note that these registers can already be controlled
individually via ptrace(2) via MD operations, so the main reason for
adding this is to include these register values in core dumps.  In
particular, this will enable looking up the value of TLS variables
from core dumps in gdb.

The value of NT_X86_SEGBASES was chosen to match the value of
NT_386_TLS on Linux.  The notes serve similar purposes, but FreeBSD
will never dump a note equivalent to NT_386_TLS (which dumps a single
segment descriptor rather than a pair of addresses) and picking a
currently-unused value in the NT_X86_* range could result in a future
conflict.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D34650

2 years agoLinuxKPI: 802.11: improve hw_scan fallback to sw_scan
Bjoern A. Zeeb [Thu, 24 Mar 2022 17:49:59 +0000 (17:49 +0000)]
LinuxKPI: 802.11: improve hw_scan fallback to sw_scan

Extending what was started in d3ef7fb459ff924911e5276db0c04b13cd8074d9,
when a driver signals that hw_scan is not possible and expects a sw_scan
to be preformed we triggered a sw_scan towards the driver but did not
let net80211 know.
Cancel the initial scan towards net80211.  If we we defer to sw_scan
then clear IEEE80211_FEXT_SCAN_OFFLOAD so net80211 will send probe
requests, and actively start a new scan with net80211.
This may have to be further refined in the future but seems to work
for the moment.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days