]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
20 months agostrfmon: Avoid an out-of-bounds access
Jose Luis Duran [Thu, 13 Oct 2022 15:51:27 +0000 (12:51 -0300)]
strfmon: Avoid an out-of-bounds access

Avoid an out-of-bounds access when trying to set the space_char using an
international currency format (%i) and the C/POSIX locale.

The current code tries to read the SPACE from int_curr_symbol[3]:

    currency_symbol = strdup(lc->int_curr_symbol);
    space_char = *(currency_symbol+3);

But on C/POSIX locales, int_curr_symbol is empty.

Three implementations have been examined: NetBSD[1], Darwin[2], and
Illumos[3].  Only NetBSD has fixed it[4].

Darwin and NetBSD also trim the mandatory final SPACE character after
reading it.

    Locale         Format    Darwin/NetBSD    FreeBSD/Illumos
    en_US.UTF-8    [%i]      [USD123.45]      [USD 123.45]
    fr_FR.UTF-8    [%i]      [123,45 EUR]     [123,45 EUR ]

This commit only fixes the out-of-bounds access.

[1]: https://github.com/NetBSD/src/blob/trunk/lib/libc/stdlib/strfmon.c
[2]: https://opensource.apple.com/source/Libc/Libc-1439.141.1/stdlib/NetBSD/strfmon.c.auto.html
[3]: https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libc/port/locale/strfmon.c
[4]: https://github.com/NetBSD/src/commit/3d7b5d498aa9609f2bc9ece9c734c5f493a8e239

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon: Fix typos in source code comments
Jose Luis Duran [Thu, 13 Oct 2022 14:49:21 +0000 (11:49 -0300)]
strfmon: Fix typos in source code comments

s/defult/default
s/internaltion/international

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon: Fix typo in constant
Jose Luis Duran [Thu, 13 Oct 2022 14:36:46 +0000 (11:36 -0300)]
strfmon: Fix typo in constant

s/SUPRESS_CURR_SYMBOL/SUPPRESS_CURR_SYMBOL

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon: Code cleanup
Jose Luis Duran [Fri, 14 Oct 2022 17:05:22 +0000 (14:05 -0300)]
strfmon: Code cleanup

No functional change intended.
Not claiming full style(9) compliance.

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon_test: Add some tests
Jose Luis Duran [Sun, 16 Oct 2022 04:01:17 +0000 (01:01 -0300)]
strfmon_test: Add some tests

Attempt to test the correctness of strfmon(3).

Some of them were inspired from the examples section at:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon.html

Items marked with XXX represent an invalid output.

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon_test: Fix typo and remove extra space
Jose Luis Duran [Sun, 16 Oct 2022 03:04:44 +0000 (00:04 -0300)]
strfmon_test: Fix typo and remove extra space

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agonetinet*: remove unneeded headers from files that just declare domains
Gleb Smirnoff [Tue, 25 Oct 2022 18:09:23 +0000 (11:09 -0700)]
netinet*: remove unneeded headers from files that just declare domains

20 months agotcp: remove useless today lock assertion in a middle of function
Gleb Smirnoff [Tue, 25 Oct 2022 18:09:22 +0000 (11:09 -0700)]
tcp: remove useless today lock assertion in a middle of function

It was added back in 7cfc6904408b, when there was a jump label
above and tcp_input() hadn't been locked all through.

20 months agotimes: Use modern function definitions
Warner Losh [Tue, 25 Oct 2022 05:03:11 +0000 (23:03 -0600)]
times: Use modern function definitions

Use the modern ANSI function defition syntax rather than the old K&R
syntax for times.

Sponsored by: Netflix

20 months agochio: Mark some arguments as unused.
Warner Losh [Tue, 25 Oct 2022 05:02:44 +0000 (23:02 -0600)]
chio: Mark some arguments as unused.

Sponsored by: Netflix

20 months agointrng: Remove from NOTES file
Warner Losh [Tue, 25 Oct 2022 16:52:44 +0000 (10:52 -0600)]
intrng: Remove from NOTES file

INTRNG is required on these platforms. Remove it from the NOTES file
since it is now in the DEFAULTS file.

Suggested by: mhorne
Sponsored by: Netflix

20 months agosubr_physmem: Fix userspace build
Warner Losh [Tue, 25 Oct 2022 05:05:07 +0000 (23:05 -0600)]
subr_physmem: Fix userspace build

Include stdbool.h in userspace configurations. For the kernel builds we
get it from sys/types.h, but bool isn't defined there for non-kernel
builds and this otherwise kernel-only file is used for the physmem test
suite.

Fixes: deb1e3b71998
Sponsored by: Netflix

20 months agovnic: work_done here only used for debug
Warner Losh [Tue, 25 Oct 2022 14:52:27 +0000 (08:52 -0600)]
vnic: work_done here only used for debug

Sponsored by: Netflix

20 months agogenet: cnt here is write only and can be removed
Warner Losh [Tue, 25 Oct 2022 14:52:53 +0000 (08:52 -0600)]
genet: cnt here is write only and can be removed

Sponsored by: Netflix

20 months agohccontrol.8: missed underscore fixed.
Maxim Konovalov [Tue, 25 Oct 2022 16:29:44 +0000 (16:29 +0000)]
hccontrol.8: missed underscore fixed.

PR: 267343

20 months agox86/include/elf.h: make inclusion blocks for elf32.h and elf64.h similar
Konstantin Belousov [Sat, 22 Oct 2022 20:05:59 +0000 (23:05 +0300)]
x86/include/elf.h: make inclusion blocks for elf32.h and elf64.h similar

They were copy-pasted when x86/include/elf.h file was merged from its
i386 and amd64 counterparts.  Having the text around inclusions
significantly different is somewhat confusing.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37085

20 months agoi386: move hard-coded load address for PIE below default linker base
Konstantin Belousov [Sat, 22 Oct 2022 20:03:17 +0000 (23:03 +0300)]
i386: move hard-coded load address for PIE below default linker base

both for i386 native and compat32 amd64.  We know the ld-elf.so.1 size
in advance, it fits there.  Trying to push it up after the end of a
binary cannot work reliably and eventually fail for large binaries.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37085

20 months agoarm, arm64: tweak hard-coded load addresses for PIE binaries
Konstantin Belousov [Sat, 22 Oct 2022 10:58:43 +0000 (13:58 +0300)]
arm, arm64: tweak hard-coded load addresses for PIE binaries

They are used when ASLR is not applied.
The need for adjusting is due to rtld direct exec mode puts ld-elf.so.1
at the PIE load address, and this address must not conflict with the
default linker' load address for non-PIE binaries.  Otherwise rtld in
direct mode cannot activate image.  Example of implicit failure is ldd(1)
refusing to run.

Reported by: kp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37085

20 months agophysmem: Add physmem_excluded to query if a region is excluded
Warner Losh [Thu, 6 Oct 2022 03:55:26 +0000 (21:55 -0600)]
physmem: Add physmem_excluded to query if a region is excluded

In order to safely reuse excluded memory when it's reserved for special
purpose, we need to test whether or not the memory has been reserved
early in boot. physmem_excluded will return true when the entire range
is excluded, false otherwise.

Sponsored by: Netflix

20 months agoefi: Add linux memory reserve table defniitions
Warner Losh [Thu, 6 Oct 2022 02:56:43 +0000 (20:56 -0600)]
efi: Add linux memory reserve table defniitions

There is some hardware which can't be completely reset to release the
memory it is using(so far only the GICv3 on arm has fit this
bill). Since that meory needs to be reserved by the OS for that
hardware's later use of it, create defines for code that will parse that
memory table. Otherise the system may allocate the memory for block I/O,
network packets, etc which will lead to memory corruption.

When booting via Linux's kexec protocol, it will add this table to the
EFI systbl's cfgtbl array. While the mechanism to pass 'configuration'
is standardized, these specific tables are not documented except in the
Linux source. Include comments gleened from its study.

Sponsored by: Netflix

20 months agobuild: Use `rm -fv` for BATCH_DELETE_OLD_FILES
Ed Maste [Mon, 24 Oct 2022 18:06:41 +0000 (14:06 -0400)]
build: Use `rm -fv` for BATCH_DELETE_OLD_FILES

It's possible to have files with odd permissions in the tmproot (or
sysroot), causing rm to prompt for each one during e.g. buildworld.
Add -f to forcibly delete these.

Reviewed by: brooks
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37111

20 months agobhyve: Address some signed/unsigned comparison warnings
Mark Johnston [Sun, 23 Oct 2022 14:32:45 +0000 (10:32 -0400)]
bhyve: Address some signed/unsigned comparison warnings

MFC after: 1 week

20 months agobhyve: Address signed/unsigned comparison warnings in the e1000 model
Mark Johnston [Tue, 25 Oct 2022 13:54:50 +0000 (09:54 -0400)]
bhyve: Address signed/unsigned comparison warnings in the e1000 model

No functional change intended.

MFC after: 1 week

20 months agobhyve: Address signed/unsigned comparison warnings in the AHCI model
Mark Johnston [Tue, 25 Oct 2022 13:39:07 +0000 (09:39 -0400)]
bhyve: Address signed/unsigned comparison warnings in the AHCI model

No functional change intended.

MFC after: 1 week

20 months agobhyve: Address warnings in blockif_proc()
Mark Johnston [Tue, 25 Oct 2022 13:16:23 +0000 (09:16 -0400)]
bhyve: Address warnings in blockif_proc()

- Use unsigned types for all arithmetic.  Use a new signed variable for
  holding the return value of pread() and pwrite().
- Handle short I/O from pwrite().

MFC after: 1 week

20 months agobhyve: Fix a typo in a function name
Mark Johnston [Tue, 25 Oct 2022 13:22:12 +0000 (09:22 -0400)]
bhyve: Fix a typo in a function name

MFC after: 1 week

20 months agobhyve: Avoid arithmetic on void pointers
Mark Johnston [Tue, 25 Oct 2022 13:07:14 +0000 (09:07 -0400)]
bhyve: Avoid arithmetic on void pointers

No functional change intended.

MFC after: 1 week

20 months agobhyve: Avoid shadowing global variables in bhyverun.c
Mark Johnston [Fri, 9 Sep 2022 00:40:02 +0000 (20:40 -0400)]
bhyve: Avoid shadowing global variables in bhyverun.c

- Rename the global cores/sockets/threads to cpu_cores/sockets/threads.
  This way, num_vcpus_allowed() doesn't shadow them.
- The global maxcpus is unused, remove it for the same reason.

MFC after: 1 week

20 months agosplit: add some tests
Kyle Evans [Tue, 23 Aug 2022 02:08:03 +0000 (21:08 -0500)]
split: add some tests

This should cover all of the basic functionality, as well as the recent
enhancement to use a dynamic buffer size rather than limiting patterns
and lines to MAXBSIZE.

Reviewed by: bapt
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D36324

20 months agosplit: switch to getline() for line/pattern matching
Kyle Evans [Tue, 23 Aug 2022 02:05:58 +0000 (21:05 -0500)]
split: switch to getline() for line/pattern matching

Get rid of split's home-grown logic for growing the buffer; arbitrarily
breaking at LONG_MAX bytes instead of 65536 bytes gives us much more
wiggle room.  Additionally, we'll actually fail out entirely if we can't
fit a line, which makes noticing this class of problem much easier.

Reviewed by: bapt, emaste, pauamma
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D36323

20 months agonetmap(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 25 Oct 2022 12:56:25 +0000 (14:56 +0200)]
netmap(4): Fix a typo in a source code comment

- s/microsconds/microseconds/

MFC after: 3 days

20 months agosmartpqi(4): Fix two typos in kernel error messages
Gordon Bergling [Tue, 25 Oct 2022 11:17:20 +0000 (13:17 +0200)]
smartpqi(4): Fix two typos in kernel error messages

- s/runnning/running/

MFC after: 2 weeks

20 months agodconschat(8): Fix a typo in an error message
Gordon Bergling [Tue, 25 Oct 2022 10:58:55 +0000 (12:58 +0200)]
dconschat(8): Fix a typo in an error message

- s/faild/failed/

MFC after: 1 week

20 months agoarcmsr(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 25 Oct 2022 10:57:37 +0000 (12:57 +0200)]
arcmsr(4): Fix a typo in a source code comment

- s/faild/failed/

MFC after: 3 days

20 months agozfsd(8): Fix a typo in an error message
Gordon Bergling [Tue, 25 Oct 2022 10:55:42 +0000 (12:55 +0200)]
zfsd(8): Fix a typo in an error message

- s/faild/failed/

MFC after: 1 week

20 months agofirewire(4): Fix a typo in an error message
Gordon Bergling [Tue, 25 Oct 2022 10:54:15 +0000 (12:54 +0200)]
firewire(4): Fix a typo in an error message

- s/faild/failed/

MFC after: 5 days

20 months agoocs_fc(4): Fix a typo in an error message
Gordon Bergling [Tue, 25 Oct 2022 10:52:24 +0000 (12:52 +0200)]
ocs_fc(4): Fix a typo in an error message

- s/faild/failed/

MFC after: 5 days

20 months agoCMSG_DATA.3: Fix a typo in the EXAMPLES section
Gordon Bergling [Tue, 25 Oct 2022 10:49:21 +0000 (12:49 +0200)]
CMSG_DATA.3: Fix a typo in the EXAMPLES section

- s/faild/failed/

MFC after: 3 days

20 months agorun.4: Fix a typo in the DIAGNOSTICS section
Gordon Bergling [Tue, 25 Oct 2022 10:47:29 +0000 (12:47 +0200)]
run.4: Fix a typo in the DIAGNOSTICS section

- s/faild/failed/

MFC after: 3 days

20 months agoman: hook acpi_ged.4 to build.
Takanori Watanabe [Mon, 24 Oct 2022 23:11:49 +0000 (08:11 +0900)]
man: hook acpi_ged.4 to build.

Submittet by: yuri@astern.org

Differential Revision: https://reviews.freebsd.org/D37114

20 months agonetpfil: Fix two typos in source code comments
Gordon Bergling [Tue, 25 Oct 2022 02:32:59 +0000 (04:32 +0200)]
netpfil: Fix two typos in source code comments

- s/missmatch/mismatch/

MFC after: 3 days

20 months agonet8021: Fix a typo in a kernel error message
Gordon Bergling [Tue, 25 Oct 2022 02:31:51 +0000 (04:31 +0200)]
net8021: Fix a typo in a kernel error message

- s/missmatch/mismatch/

MFC after: 1 week

20 months agoopencrypto: fix null esp crypt
Konstantin Belousov [Mon, 24 Oct 2022 23:02:58 +0000 (02:02 +0300)]
opencrypto: fix null esp crypt

Fixes: 3e9470482a1357eef90d007b27ec5d9725ae1111
Reviewed by: jhb
Sponsored by: Nvidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37113

20 months agoLinuxKPI: seq_file add "private" versions.
Bjoern A. Zeeb [Sat, 22 Oct 2022 18:07:37 +0000 (18:07 +0000)]
LinuxKPI: seq_file add "private" versions.

Add __seq_open_private() and seq_release_private() needed by iwlwifi
debugfs support.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D37089

20 months agobhyve: Drop a bogus const qualifier
Mark Johnston [Mon, 24 Oct 2022 21:35:16 +0000 (17:35 -0400)]
bhyve: Drop a bogus const qualifier

No functional change intended.

MFC after: 1 week

20 months agobhyve: Use the new vm_limit_rights() interface
Mark Johnston [Mon, 24 Oct 2022 21:32:04 +0000 (17:32 -0400)]
bhyve: Use the new vm_limit_rights() interface

This addresses a compiler warning arising from the fact that bhyve
needs to cast away a const qualifier in order to call free().

No functional change intended.

Reviewed by: jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37099

20 months agolibvmmapi: Provide an interface for limiting rights on the device fd
Mark Johnston [Mon, 24 Oct 2022 21:31:11 +0000 (17:31 -0400)]
libvmmapi: Provide an interface for limiting rights on the device fd

Currently libvmmapi provides a way to get a list of the allowed ioctls
on the vmm device file, so that bhyve can limit rights on the device
file fd.  The interface is rather strange: it allocates a copy of the
list but returns a const pointer, so the caller has to cast away the
const in order to free it without aggravating the compiler.

As far as I can see, there's no reason to make a copy of the array, but
changing vm_get_ioctls() to not do that would break compatibility.  So
this change just introduces a better interface: move all rights-limiting
logic into libvmmapi.

Any new operations on the fd should be wrapped by libvmmapi, so also
discourage use of vm_get_device_fd().  Currently bhyve uses it only when
limiting rights on the device fd.

No functional change intended.

Reviewed by: jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37098

20 months agodpaa2: cleanup some include files
Bjoern A. Zeeb [Mon, 24 Oct 2022 20:54:20 +0000 (20:54 +0000)]
dpaa2: cleanup some include files

2782ed8f6cd3d7f59219a783bc7fa7bbfb1fe26f fixed the standalone module
build.  REmove the now duplicate includes for opt_acpi.h and
opt_platform.h.  Als remove the if_mdio.h again in both the Makefile
and the implementation file as it is not (currently) used.

X-MFC with: ba7319e9091b4f6ef15a9c4be3d3d076f3047f72
MFC after: 70 days

20 months agoRack and BBR broken with the new timewait state purge.
Randall Stewart [Mon, 24 Oct 2022 19:47:29 +0000 (15:47 -0400)]
Rack and BBR broken with the new timewait state purge.

We recently got rid of the explicit INP_TIMEWAIT state, this has caused some
minor breakage to both rack and bbr. Basically the timewait check that was
in tcp_lro.c is now gone. This means that compressed_ack and mbuf_queued
packets will arrive at TCP without going through tcp_input_with_port(). We need
to expand the check that was stripped to look at the tcp_state (t_state) and
not "LRO" packets that are in the TCPS_TIMEWAIT state.

Reviewed by: tuexen, gliebus
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D37080

20 months agoif_ovpn: avoid netisr_queue name conflicts
Kristof Provost [Mon, 24 Oct 2022 18:45:39 +0000 (20:45 +0200)]
if_ovpn: avoid netisr_queue name conflicts

Rename the netisr_queue variable in if_ovpn.c to avoid naming conflicts.

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

20 months agoacpi_ged: Module build no longer needs to define INTRNG
Warner Losh [Mon, 24 Oct 2022 18:12:29 +0000 (12:12 -0600)]
acpi_ged: Module build no longer needs to define INTRNG

Now that we properly define INTRNG generically on all the platforms that
need it in opt_global.h, we don't need to define it here.

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D37110

20 months agoconfig.mk: All options in DEFAULTS are now defined in opt_global.h
Warner Losh [Mon, 24 Oct 2022 18:12:17 +0000 (12:12 -0600)]
config.mk: All options in DEFAULTS are now defined in opt_global.h

To simplify management of all the options that should be enabled for the
different architectures, adopt the convention that all options listed in
DEFAULTS will be #defined to 1 in opt_global.h for untied builds. Except
for GEOM_* and ISAPNP, they are all in opt_global.h. ISAPNP is a
opt_dontuse.h, so only filter GEOM_*.

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D37108

20 months agoconfig: Make ISAPNP be in opt_dontuse.h
Warner Losh [Mon, 24 Oct 2022 18:12:09 +0000 (12:12 -0600)]
config: Make ISAPNP be in opt_dontuse.h

Nothing uses ISAPNP today, apart from bringing in files or not. There's
really no need to ever do #ifdef ISAPNP in drivers and such. It means
use the ISA bus plug and play isolation protocol to enumerate the bus,
not the more useful 'you might have devices with isa pnp ids' which all
drivers hide behind DEV_ISA and/or an isa clause in the files files.

Sponsored by: Netflix
Reviewed by: kevans, emaste
Differential Revision: https://reviews.freebsd.org/D37109

20 months agoDEFAULTS: move intrng to DEFAULTS for its platforms.
Warner Losh [Mon, 24 Oct 2022 18:11:58 +0000 (12:11 -0600)]
DEFAULTS: move intrng to DEFAULTS for its platforms.

Sponsored by: Netflix
Reviewed by: manu, kevans
Differential Revision: https://reviews.freebsd.org/D37107

20 months agostand/efi: Simpler construct
Warner Losh [Mon, 24 Oct 2022 18:11:50 +0000 (12:11 -0600)]
stand/efi: Simpler construct

Use 'sizeof(long) == 8' for a compile time constant that can be used as
an initializer rather than #ifdefs.

Sponsored by: Netflix

20 months agoman4: Hook mac_ddb.4 up to the build
Mark Johnston [Tue, 18 Oct 2022 16:49:25 +0000 (12:49 -0400)]
man4: Hook mac_ddb.4 up to the build

Fixes: 287d467c5db5 ("mac: add new mac_ddb(4) policy")
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.

20 months agozfs: Fix a pair of bugs in zfs_fhtovp()
Mark Johnston [Mon, 24 Oct 2022 15:55:48 +0000 (11:55 -0400)]
zfs: Fix a pair of bugs in zfs_fhtovp()

This cherry-picks upstream ed566bf1cd0bdbf85e8c63c1c119e3d2ef5db1f6

    - Add a zfs_exit() call in an error path, otherwise a lock is
      leaked.
    - Remove the fid_gen > 1 check.  That appears to be Linux-specific:
      zfsctl_snapdir_fid() sets fid_gen to 0 or 1 depending on whether
      the snapshot directory is mounted.  On FreeBSD it fails, making
      snapshot dirs inaccessible via NFS.

PR: 266236
MFC after: 3 days

20 months agoacpi_ged: fix build with ACPI_DEBUG
Gleb Smirnoff [Mon, 24 Oct 2022 16:00:04 +0000 (09:00 -0700)]
acpi_ged: fix build with ACPI_DEBUG

20 months agoRELNOTES: Add an entry for if_bridge l3 filtering default change
Kristof Provost [Mon, 24 Oct 2022 15:58:00 +0000 (17:58 +0200)]
RELNOTES: Add an entry for if_bridge l3 filtering default change

20 months agocache: add cache_assert_no_entries
Mateusz Guzik [Mon, 24 Oct 2022 15:34:57 +0000 (15:34 +0000)]
cache: add cache_assert_no_entries

20 months agoacpi_ged: fix build, as module and non INTRNG case.
Takanori Watanabe [Mon, 24 Oct 2022 14:19:12 +0000 (23:19 +0900)]
acpi_ged: fix build, as module and non INTRNG case.

Reviewed-by: cy
Differential Revision: https://reviews.freebsd.org/D37104

20 months agobsd-family-tree: OpenBSD 7.2 and DragonFly BSD 6.0.1
Sergey A. Osokin [Mon, 24 Oct 2022 14:12:31 +0000 (10:12 -0400)]
bsd-family-tree: OpenBSD 7.2 and DragonFly BSD 6.0.1

Add two releases to the tree.

While I'm here correct DragonFly BSD 6.2.1 position, it's
been released after FreeBSD 12.3.

MFC after: 3 days

20 months agoOpenBSM: fix free() in au_read_rec error case
Ed Maste [Mon, 24 Oct 2022 13:45:59 +0000 (09:45 -0400)]
OpenBSM: fix free() in au_read_rec error case

buf is a char ** and *buf is the allocated buffer.

PR: 267050
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

20 months agoacpi_ged: New driver to ACPI generic event device
Takanori Watanabe [Tue, 18 Oct 2022 05:41:53 +0000 (14:41 +0900)]
acpi_ged:  New driver to ACPI generic event device

 New driver to ACPI generic event device, defined in ACPI spec.
Some ACPI power button may not work without this.

In qemu arm64 with "virt" machine, with ACPI firmware,
enable devd check devd message by
and invoke following command in qemu monitor
(qemu) system_powerdown
and make sure some power button input event appear.
(setting sysctl hw.acpi.power_button_state=S5 is not work,
because ACPI tree does not have \_S5 object.)

Reviewed by: andrew, hrs
Differential Revision: https://reviews.freebsd.org/D37032

20 months agobridge: default to not filtering L3
Kristof Provost [Fri, 14 Oct 2022 05:57:33 +0000 (07:57 +0200)]
bridge: default to not filtering L3

Change the default for net.link.bridge.pfil_member and
net.link.bridge.pfil_bridge to zero.

That is, default to not calling layer 3 firewalls on the bridge or its
member interfaces.

With either of these enabled the bridge will, during L2 processing,
remove the Ethernet header from packets, feed them to L3 firewalls,
re-add the Ethernet header and send them out.

Not only does this interact very poorly with firewalls which defer
packets, or reassemble and refragment IPv6, it also causes considerable
confusion for users, because the firewall gets called in unexpected
ways.

For example, a bridge which contains a bhyve tap and the host's LAN
interface. We'd expect traffic between the LAN and bhyve VM to pass, no
matter what (layer 3) firewall rules are set on the host. That's not the
case as long as pfil_bridge or pfil_member are set.

Reviewed by: Zhenlei Huang
MFC: never
Differential Revision: https://reviews.freebsd.org/D37009

20 months agoarm64: Hyper-V: fix couple more commit errors caused by duplicated lines
Wei Hu [Mon, 24 Oct 2022 07:55:15 +0000 (07:55 +0000)]
arm64: Hyper-V: fix couple more commit errors caused by duplicated lines

Remove those duplicated lines.

Reported by: Souradeep Chakrabarti <schakrabarti@microsoft.com>
Fixes: 6cf00ef80c20148
Sponsored by: Microsoft

20 months agoif_ovpn: add sysctls for netisr_queue() and crypto_dispatch_async()
Kristof Provost [Mon, 17 Oct 2022 09:06:34 +0000 (11:06 +0200)]
if_ovpn: add sysctls for netisr_queue() and crypto_dispatch_async()

Allow the choice between asynchronous and synchronous netisr and crypto
calls. These have performance implications, but depend on the specific
setup and OCF back-end.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37017

20 months agostress2: Added a regression test for D37024
Peter Holm [Mon, 24 Oct 2022 07:48:09 +0000 (09:48 +0200)]
stress2: Added a regression test for D37024

20 months agostress2: Update tool to list both DATA and HOLES in a file.
Peter Holm [Mon, 24 Oct 2022 07:45:32 +0000 (09:45 +0200)]
stress2: Update tool to list both DATA and HOLES in a file.
Added a regression test.

20 months agoLinuxKPI: add MSEC_PER_SEC
Bjoern A. Zeeb [Sat, 22 Oct 2022 18:01:30 +0000 (18:01 +0000)]
LinuxKPI: add MSEC_PER_SEC

Sponsored by: The FreeBSD Foundation
Reviewed by: imp, emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D37087

20 months agoLinuxKPI: 802.11: add MO tracing
Bjoern A. Zeeb [Sun, 23 Oct 2022 21:48:22 +0000 (21:48 +0000)]
LinuxKPI: 802.11: add MO tracing

Add a macro to each implemented mac80211 operation.  This currently
turns into a printf if LINUXKPI_80211_DEBUG is defined but in the
future could become a different probe as well.
This is helpful for quick analysis and boot-time problem debugging
when DTrace and other frameworks may be harder to use.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

20 months agobhyve: Handle snapshots of unconfigured virtio-net devices
Vitaliy Gusev [Sun, 23 Oct 2022 18:47:56 +0000 (14:47 -0400)]
bhyve: Handle snapshots of unconfigured virtio-net devices

In case of device reset or not configured - features_negotiated is not
set, calling calling pci_vtnet_neg_features is wrong and resume gets
"Segmentation fault".

Reviewed by: markj
Sponsored by: vStack
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36244

20 months agotime(3): Fix spelling.
Hans Petter Selasky [Sun, 23 Oct 2022 16:41:28 +0000 (18:41 +0200)]
time(3): Fix spelling.

Noted by: Gary Jennejohn <garyj@gmx.de>
MFC after: 1 week
Sponsored by: NVIDIA Networking

20 months agobhyve: Annotate an unused function as such
Mark Johnston [Sun, 23 Oct 2022 14:46:39 +0000 (10:46 -0400)]
bhyve: Annotate an unused function as such

No functional change intended.

MFC after: 1 week

20 months agobhyve: Make hda_ops function tables const
Mark Johnston [Sun, 23 Oct 2022 14:43:06 +0000 (10:43 -0400)]
bhyve: Make hda_ops function tables const

No functional change intended.

MFC after: 1 week

20 months agobhyve: Put the prototype for vga_render() in a header
Mark Johnston [Sun, 23 Oct 2022 14:22:39 +0000 (10:22 -0400)]
bhyve: Put the prototype for vga_render() in a header

No functional change intended.

MFC after: 1 week

20 months agobhyve: Put the prototype for vmexit_task_switch() in a header
Mark Johnston [Sun, 23 Oct 2022 14:21:50 +0000 (10:21 -0400)]
bhyve: Put the prototype for vmexit_task_switch() in a header

No functional change intended.

MFC after: 1 week

20 months agobhyve: Fix some warnings in the snapshot code
Mark Johnston [Sat, 22 Oct 2022 17:41:33 +0000 (13:41 -0400)]
bhyve: Fix some warnings in the snapshot code

- Qualify unexported symbols with "static".
- Drop some unnecessary and incorrect casts.
- Avoid arithmetic on void pointers.
- Avoid signed/unsigned comparisons in loops which use nitems() as a
  bound.

No functional change intended.

MFC after: 1 week

20 months agobhyve: Avoid arithmetic on void pointers
Mark Johnston [Sat, 22 Oct 2022 17:40:20 +0000 (13:40 -0400)]
bhyve: Avoid arithmetic on void pointers

No functional change intended.

MFC after: 1 week

20 months agobhyve: USB device model structures can be qualified with "static"
Mark Johnston [Sat, 22 Oct 2022 17:39:01 +0000 (13:39 -0400)]
bhyve: USB device model structures can be qualified with "static"

No functional change intended.

MFC after: 1 week

20 months agobhyve: Use the proper type for string literals
Mark Johnston [Sat, 22 Oct 2022 17:37:46 +0000 (13:37 -0400)]
bhyve: Use the proper type for string literals

No functional change intended.

MFC after: 1 week

20 months agobhyve: Fix some warnings in the ps2 emulation code
Mark Johnston [Sat, 22 Oct 2022 17:35:40 +0000 (13:35 -0400)]
bhyve: Fix some warnings in the ps2 emulation code

- Include headers containing prototypes for exported functions.
- Initialize all fields of the extended translation table.
- Qualify an unexported translation table as static.
- Fix error handling for a read(2).
- Fix some style bugs.

No functional change intended.

MFC after: 1 week

20 months agobhyve: Address some warnings in bhyverun.c
Mark Johnston [Sat, 22 Oct 2022 17:34:00 +0000 (13:34 -0400)]
bhyve: Address some warnings in bhyverun.c

- Annotate unused parameters as such.
- Avoid shadowing the global "vmexit".

No functional change intended.

MFC after: 1 week

20 months agoacpi: Create cppc_notify sysctl before it is checked
Tom Jones [Sun, 23 Oct 2022 09:09:28 +0000 (10:09 +0100)]
acpi: Create cppc_notify sysctl before it is checked

Reported by: Henrix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D37081

20 months agotime(3): Optimize tvtohz() function.
Hans Petter Selasky [Thu, 20 Oct 2022 16:49:51 +0000 (18:49 +0200)]
time(3): Optimize tvtohz() function.

List of changes:
- Use integer multiplication instead of long multiplication, because the result is an integer.
- Remove multiple if-statements and predict new if-statements.
- Rename local variable name, "ticks" into "retval" to avoid shadowing
the system "ticks" global variable.

Reviewed by: kib@ and imp@
MFC after: 1 week
Sponsored by: NVIDIA Networking
Differential Revision:  https://reviews.freebsd.org/D36859

20 months agotime(3): Declare the minimum and maximum hz values supported.
Hans Petter Selasky [Mon, 3 Oct 2022 09:08:53 +0000 (11:08 +0200)]
time(3): Declare the minimum and maximum hz values supported.

Reviewed by: kib@ and imp@
MFC after:      1 week
Sponsored by:   NVIDIA Networking
Differential Revision: https://reviews.freebsd.org/D37072

20 months agostand/efi: Call md_copymodules based on __LP64__ to fix 32-bit arm
Warner Losh [Sun, 23 Oct 2022 01:09:10 +0000 (19:09 -0600)]
stand/efi: Call md_copymodules based on __LP64__ to fix 32-bit arm

When I refactored everything, I neglected to pass in the proper is64
value on 32-bit platforms. This corrects that. This prevented armv7 and
armv6 platforms from booting due to misaligned data in the kernel.  The
only platform we support 32-bit booting in armv[67], which I apparently
neglected to test before commiting my refactoring.

Tested by: skibo
Fixes: 5d1531d9d4e7d
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D37095

20 months agostand/kboot: hostdisk isn't a DEVT_DISK, use a different value.
Warner Losh [Sat, 22 Oct 2022 15:09:23 +0000 (09:09 -0600)]
stand/kboot: hostdisk isn't a DEVT_DISK, use a different value.

We assume in all the code that a DEVT_DISK uses common/disk.c and/or
common/part.c and we can access a struct disk_devdesc. hostdisk.c
opens raw devices directly, so has no such structures. Define a
kboot-specific DEVT_HOSTDISK and use that instead.

In addition, disk_fmtdev assumes it is working with a struct
disk_devdesc, so write hostdisk_fmtdev as well.

Sponsored by: Netflix

20 months agogeli: Move check for DEVT_DISK into geli_probe_and_attach
Warner Losh [Sat, 22 Oct 2022 00:16:56 +0000 (18:16 -0600)]
geli: Move check for DEVT_DISK into geli_probe_and_attach

We only work on DEVT_DISK disks, so move that into the probe to drive
the point home better.

Sponsored by: Netflix

20 months agoLinuxKPI: 802.11: add changes to support debugfs in iwlwifi
Bjoern A. Zeeb [Sat, 22 Oct 2022 20:42:35 +0000 (20:42 +0000)]
LinuxKPI: 802.11: add changes to support debugfs in iwlwifi

Add new fields (also have to move a struct up, no changes there)
in order to make iwlwifi debugfs support compile.

Sposnored by: The FreeBSD Foundation
MFC after: 3 days

20 months agoiwlwifi: prepare to support debugfs
Bjoern A. Zeeb [Sat, 22 Oct 2022 17:40:17 +0000 (17:40 +0000)]
iwlwifi: prepare to support debugfs

Import two files left out initially from the driver needed for debugfs
support [1].  Adjust the driver further to make it compile on FreeBSD.
This is currently turned off and needs more LinuxKPI/lindebugfs work.
Being in the tree will allow us to collaboratively work on it and
then we can enable it for good.

Obtained from: Linux wireless-testing (tag: wt-2022-10-19) [1]
2c9078b9abcb884e27360340aaa7dfd4c0de29b3
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

20 months agoiwlwifi: constify another argument of iwl_print_hex_dump()
Bjoern A. Zeeb [Sat, 22 Oct 2022 17:33:18 +0000 (17:33 +0000)]
iwlwifi: constify another argument of iwl_print_hex_dump()

This is needed when enabling debugfs as it passes a const in which
would otherwise be dropped.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

20 months agosh: when loading profile, read only .sh files.
Dag-Erling Smørgrav [Tue, 18 Oct 2022 13:28:23 +0000 (15:28 +0200)]
sh: when loading profile, read only .sh files.

Reviewers: jilles, eugen_grosbein.net, cy

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D37034

20 months agolinprocfs: Add net/route.
John Grafton [Sat, 22 Oct 2022 10:52:58 +0000 (13:52 +0300)]
linprocfs: Add net/route.

PR: 266482
Reviewed by: melifaro, me
Differential revision: https://reviews.freebsd.org/D36949
MFC after: 1 week

20 months agox86/busdma: Limit reserved pages if low nsegs
Colin Percival [Fri, 21 Oct 2022 18:13:36 +0000 (11:13 -0700)]
x86/busdma: Limit reserved pages if low nsegs

When bus_dmamap_create is called, if bouncing might be required we
reserve enough pages for a maximum-length request, subject to the
MAX_BPAGES constraint (32 MB on amd64; 32 MB or 2 MB on i386
depending on the amount of RAM).

Since pages used for bouncing are typically non-consecutive, each
bounced page will typically constitute a busdma segment; as such, we
are unlikely to ever successfully use more pages than the nsegments
limit.  Limit the number of pages reserved to nsegments.

On FreeBSD/Firecracker, this reduces bounce page memory consumption
from 32 MB to 512 kB, making VMs with 128 MB of RAM usable.

Reviewed by: imp, mav
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D37082

20 months agortld: remove unused macro FPTR_TARGET
Konstantin Belousov [Sat, 22 Oct 2022 02:15:06 +0000 (05:15 +0300)]
rtld: remove unused macro FPTR_TARGET

It is a remnant from the ia64 removal

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

20 months agoctld: if adding a target fails, retry it on the next reload
Alan Somers [Wed, 12 Oct 2022 22:44:09 +0000 (16:44 -0600)]
ctld: if adding a target fails, retry it on the next reload

If the admin creates more CTL ports than kern.cam.ctl.max_ports, then
adding some will fail.  If he then removes some ports and does
"service ctld reload", he would expect that the new ports would get
added in the newly-freed port space. But they don't, because ctld
assigned them port numbers during their first creation attempts.

Fix this bug by removing newly created ports from ctld's internal list
if the kernel rejects them for any reason.  That way, a subsequent
config reload will attempt to add them again, possibly with new port
numbers.

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: jhb, mav
Differential Revision: https://reviews.freebsd.org/D36974

20 months agostabd/geli: Bail out if you can't get the disks size
Warner Losh [Fri, 21 Oct 2022 23:39:34 +0000 (17:39 -0600)]
stabd/geli: Bail out if you can't get the disks size

If the DIOCGMEDIASIZE ioctl fails, assume the disk doesn't have geli
encryption. While all disks should implement this, fail safe for disks /
partitions that do not.

Sponsored by: Netflix

20 months agoIncrease the maximum size of the journaled soft-updates journal.
Kirk McKusick [Fri, 21 Oct 2022 18:00:00 +0000 (11:00 -0700)]
Increase the maximum size of the journaled soft-updates journal.

The size of the journaled soft-updates journal should be big enough
to hold two minutes of filesystem metadata-update activity. The
maximum size of the soft updates journal was set in the 1990s. At
the time it was assummed that disk arrays would top out at 16 drives
and disk writes per drive would top out at 500 per second. Today's
I/O subsystems are considerably bigger and faster than those limits.
Thus this delta removes the hard upper limit and lets tunefs(8) and
newfs(8) set the upper bound based on the size of the filesystem and
its cylinder groups.

Sponsored by: The FreeBSD Foundation

20 months agoAdd a description of soft updates journaling to newfs(8).
Kirk McKusick [Fri, 21 Oct 2022 17:56:20 +0000 (10:56 -0700)]
Add a description of soft updates journaling to newfs(8).

Add a descrition to the newfs(8) -j (journal enablement) flag
that explains what soft updates journaling does, the tradeoffs
to using it, and the limitations that it imposes. Copied from
the description in tunefs(8).

PR:           261944
Sponsored by: The FreeBSD Foundation