]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
21 months agolibc: iconv: push option ignore into citrus_iconv_open()
Kyle Evans [Tue, 22 Feb 2022 07:10:05 +0000 (01:10 -0600)]
libc: iconv: push option ignore into citrus_iconv_open()

Make it vaguely aware of options in the sense that it now knows that it
can zap any trailing //.  It now copies the entire string in realsrc and
realdst, then terminates them at the options.

__bsd___iconv_open can now stop trying to allocate memory just for this
purpose, and the new version is technically more correct.  GNU libiconv
will ignore options on the `in` codeset and still do the right thing.

Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34343

21 months agoiconv: only conditionally use ICONV_SET_DISCARD_ILSEQ
Kyle Evans [Tue, 22 Feb 2022 05:05:28 +0000 (23:05 -0600)]
iconv: only conditionally use ICONV_SET_DISCARD_ILSEQ

If the -c flag is used, then we can set it with ICONV_SET_DISCARD_ILSEQ;
otherwise, leave it alone.  The user may have specified //IGNORE in the
'to' codeset specification, there's no reason we can't allow that but
we'll currently turn it off.

Reviewed by: thj
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34342

21 months agotools: test: iconv: fix open_2 to not segfault
Kyle Evans [Tue, 11 Jan 2022 23:41:10 +0000 (17:41 -0600)]
tools: test: iconv: fix open_2 to not segfault

Record error condition when iconv_open() fails rather than leaving a
bogus iconv_t that iconv_close() can later choke on; this is one failure
mode.

If we opened MAX_LIMIT files with success, we need to rewind one so that
we don't iconv_close() one past the end of cd; this is the second
failure mode.

Sponsored by: Klara, Inc.

21 months agostand: Make BIOS loader size limits settable
Warner Losh [Thu, 11 Aug 2022 16:24:58 +0000 (10:24 -0600)]
stand: Make BIOS loader size limits settable

It's sometimes desirable to override the size limit: It's a soft limit
and there are times we exceed the limit by just a little bit and don't
want the build to fail (or we are hitting runtime failures below the
510,000 byte limit).

Sponsored by: Netflix

21 months agostand: i386_fmtdev can be reduced to devformat
Warner Losh [Thu, 11 Aug 2022 15:09:03 +0000 (09:09 -0600)]
stand: i386_fmtdev can be reduced to devformat

devformat produces the same output as i386_fmtdev, so just use it to
reduce on the dependencies.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D35927

21 months agostand: uboot_fmtdev can be reduced to devformat
Warner Losh [Thu, 11 Aug 2022 15:08:52 +0000 (09:08 -0600)]
stand: uboot_fmtdev can be reduced to devformat

devformat produces the same output as uboot_fmtdev, so just use it to
reduce on the dependencies.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35926

21 months agostand: userboot_fmtdev can be reduced to devformat
Warner Losh [Thu, 11 Aug 2022 15:08:26 +0000 (09:08 -0600)]
stand: userboot_fmtdev can be reduced to devformat

devformat produces the same output as userboot_fmtdev, so just use it to
reduce on the dependencies. In addition, we don't need to use the
incomplete struct userboot_devdesc type, we can use struct devdesc
instead (in fact, there's no userboot_devdesc defined anywhere).

Sponsored by: Netflix
Reviewed by: jhb (prior version)
Differential Revision: https://reviews.freebsd.org/D35925

21 months agostand: efi_fmtdev can be reduced to devformat
Warner Losh [Thu, 11 Aug 2022 15:08:08 +0000 (09:08 -0600)]
stand: efi_fmtdev can be reduced to devformat

devformat produces the same output as efi_fmtdev, so just use it to
reduce on the dependencies.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35924

21 months agostand: Replace zfs_fmtdev with generic devformat()
Warner Losh [Thu, 11 Aug 2022 15:07:44 +0000 (09:07 -0600)]
stand: Replace zfs_fmtdev with generic devformat()

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35973

21 months agostand: For zfs, set dv_fmtdev to zfs_fmtdev
Warner Losh [Thu, 11 Aug 2022 15:07:26 +0000 (09:07 -0600)]
stand: For zfs, set dv_fmtdev to zfs_fmtdev

Add a generic way to get the string representation of a zfs device / mount.

Sponsored by: Netflix
Reviewed by: tsoome (prior version)
Differential Revision: https://reviews.freebsd.org/D35923

21 months agostand: Use devformat instead of disk_devfmt
Warner Losh [Thu, 11 Aug 2022 15:07:13 +0000 (09:07 -0600)]
stand: Use devformat instead of disk_devfmt

Use devformat instead of disk_devfmt. This allows us to avoid knowing
the details of the device that's underneath us. Remove disk.h include
and the -I${LDRSRC} from the build of ufs.c since they are no longer
needed.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35922

21 months agostand: Use devformat rather than disk_devfmt
Warner Losh [Thu, 11 Aug 2022 15:06:53 +0000 (09:06 -0600)]
stand: Use devformat rather than disk_devfmt

Fix layering violation and use devformat to get the string
representation of the device to see if we're mounted yet or not. Remove
added include to pickup disk.h.

Sponsored by: Netflix
Reviewed by: tsoome (prior version)
Differential Revision: https://reviews.freebsd.org/D35919

21 months agostand: Add disk_fmtdev for dv_fmtdev for all the disk devices
Warner Losh [Thu, 11 Aug 2022 15:06:28 +0000 (09:06 -0600)]
stand: Add disk_fmtdev for dv_fmtdev for all the disk devices

All of the archsw fmtdev functions treat DEVT_DISK as a call to
disk_fmtdev. Set all disks' dv_fmtdev to disk_fmtdev so devformat
will return the same thing.

Sponsored by: Netflix
Reviewed by: tsoome (prior version)
Differential Revision: https://reviews.freebsd.org/D35917

21 months agostand: Add devformat to return formatted string for a device
Warner Losh [Thu, 11 Aug 2022 15:06:09 +0000 (09:06 -0600)]
stand: Add devformat to return formatted string for a device

Use dv_fmtdev to return a formatted string for a device. If this is a
null pointer, return the device name and unit followed by a colon (eg
disk3:).

Sponsored by: Netflix
Reviewed by: tsoome (prior version)
Differential Revision: https://reviews.freebsd.org/D35916

21 months agostand: Add dv_devfmt to return a string represenation of the device
Warner Losh [Thu, 11 Aug 2022 15:05:34 +0000 (09:05 -0600)]
stand: Add dv_devfmt to return a string represenation of the device

Add a new pointer, dv_devfmt, to allow devices to format themselves. We
will use this to simplify many of the fmtdev functions in the tree as
they are all almost the same, or all are isomorphic to each other.

Sponsored by: Netflix
Reviewed by: tsoome (prior version)
Differential Revision: https://reviews.freebsd.org/D35915

21 months agostand: Change zfs_fmtdev to take a struct devdesc *
Warner Losh [Thu, 11 Aug 2022 15:05:15 +0000 (09:05 -0600)]
stand: Change zfs_fmtdev to take a struct devdesc *

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35974

21 months agostand: Change disk_fmtdev to take a struct devdesc *
Warner Losh [Thu, 11 Aug 2022 15:04:50 +0000 (09:04 -0600)]
stand: Change disk_fmtdev to take a struct devdesc *

We do a number of games with ploymorphism for different types struct
*devdesc. Adjust one place that this affects to take the address of the
base class (most others have void * at the moment). This is more type
safe than a bare void *.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35914

21 months agostand: Move i386_devdesc to a union
Warner Losh [Thu, 11 Aug 2022 15:04:08 +0000 (09:04 -0600)]
stand: Move i386_devdesc to a union

Rather than have the magic, hand-crafted fields that have to align with
fields in other structures at the end of i386_devdesc, make it into
anonymous union and adjust the code accordingly. This is safer and
similar to what CAM does.

Sponsored by: Netflix
Reviewed by: kevans, tsoome (prior version)
Differential Revision: https://reviews.freebsd.org/D35965

21 months agostand: Remove unnecessary include
Warner Losh [Thu, 11 Aug 2022 14:59:48 +0000 (08:59 -0600)]
stand: Remove unnecessary include

stdbool.h is implied by stand.h, so remove it.

Sponsored by: Netflix

21 months agoraw ip6: merge rip6_output() into rip6_send()
Gleb Smirnoff [Thu, 11 Aug 2022 16:19:37 +0000 (09:19 -0700)]
raw ip6: merge rip6_output() into rip6_send()

While here remove some code that was compat legacy back in 2005, added
in a1f7e5f8ee7fe.

Reviewed by: melifaro
Differential revision: https://reviews.freebsd.org/D36128

21 months agoraw ip: merge rip_output() into rip_send()
Gleb Smirnoff [Thu, 11 Aug 2022 16:19:37 +0000 (09:19 -0700)]
raw ip: merge rip_output() into rip_send()

While here, address the unlocked 'dst' read.  Solve that by storing
a pointer either to the inpcb or to the sockaddr.  If we end up
copying address out of the inpcb, that would be done under the read
lock section.

Reviewed by: melifaro
Differential revision: https://reviews.freebsd.org/D36127

21 months agoprotosw: retire pr_output method
Gleb Smirnoff [Thu, 11 Aug 2022 16:19:37 +0000 (09:19 -0700)]
protosw: retire pr_output method

The only place to execute this method was raw_usend(). Only those
protocols that used raw socket were able to actually enter that method.
All pr_output assignments being deleted by this commit were a dead code
for many years.

Reviewed by: melifaro
Differential revision: https://reviews.freebsd.org/D36126

21 months agoRetire 4.4BSD raw sockets
Gleb Smirnoff [Thu, 11 Aug 2022 16:19:36 +0000 (09:19 -0700)]
Retire 4.4BSD raw sockets

Until today the remnants of the original code had provided some aid
in implementation of routing socket and IPSEC key socket.  There were
more obfuscation rather than generalisation with this aid.

A historical reference on the original idea of the raw sockets can
be found in chapter 11 of 4.4BSD System Manager Manual:

https://raw.githubusercontent.com/sergev/4.4BSD-Lite2/master/usr/share/doc/smm/18.net.pdf

Reviewed by: melifaro
Differential revision: https://reviews.freebsd.org/D36124

21 months agokeysock: do not use raw socket code
Gleb Smirnoff [Thu, 11 Aug 2022 16:19:36 +0000 (09:19 -0700)]
keysock: do not use raw socket code

This makes key socket implementation self contained and removes one
of the last dependencies on the raw socket code and pr_output method.

There are very subtle API visible changes:
- now key socket would return EOPNOTSUPP instead of EINVAL on
  syscalls that are not supposed to be called on a key socket.
- key socket buffer sizes are now controlled by net.key sysctls instead
  of net.raw.  The latter were not documented anywhere, and even Internet
  search doesn't find any references or discussions related to them.

Reviewed by: melifaro
Differential revision: https://reviews.freebsd.org/D36123

21 months agortsock: do not use raw socket code
Gleb Smirnoff [Thu, 11 Aug 2022 16:19:36 +0000 (09:19 -0700)]
rtsock: do not use raw socket code

This makes routing socket implementation self contained and removes one
of the last dependencies on the raw socket code and pr_output method.

There are very subtle API visible changes:
- now routing socket would return EOPNOTSUPP instead of EINVAL on
  syscalls that are not supposed to be called on a routing socket.
- routing socket buffer sizes are now controlled by net.rtsock
  sysctls instead of net.raw.  The latter were not documented
  anywhere, and even Internet search doesn't find any references
  or discussions related to these sysctls.

Reviewed by: melifaro
Differential revision: https://reviews.freebsd.org/D36122

21 months agortsock: do not allocate mbufs_tags(9) just to store a 8-bit value
Gleb Smirnoff [Thu, 11 Aug 2022 16:19:36 +0000 (09:19 -0700)]
rtsock: do not allocate mbufs_tags(9) just to store a 8-bit value

Use local storage of the mbuf packet header instead.

Reviewed by: melifaro
Differential revision: https://reviews.freebsd.org/D36121

21 months agonetinet: get interface event notifications directly via EVENTHANDLER(9)
Gleb Smirnoff [Thu, 11 Aug 2022 16:19:36 +0000 (09:19 -0700)]
netinet: get interface event notifications directly via EVENTHANDLER(9)

The old mechanism of getting them via domains/protocols control input
is a relict from the previous century, when nothing like EVENTHANDLER(9)
existed yet.  Retire PRC_IFDOWN/PRC_IFUP as netinet was the only one
to use them.

Reviewed by: melifaro
Differential revision: https://reviews.freebsd.org/D36116

21 months agomakefs: Fix a memory leak in fs_layout_one()
Mark Johnston [Thu, 11 Aug 2022 14:18:13 +0000 (10:18 -0400)]
makefs: Fix a memory leak in fs_layout_one()

Check the canmount property before building the mountpoint string.

Reported by: Coverity
Fixes: 240afd8c1fcc ("makefs: Add ZFS support")
Sponsored by: The FreeBSD Foundation

21 months agomakefs: Fix memory leaks in dsl_dir_finalize_props()
Mark Johnston [Thu, 11 Aug 2022 14:18:06 +0000 (10:18 -0400)]
makefs: Fix memory leaks in dsl_dir_finalize_props()

nvstring_get() returns a copy of the string, not a pointer into the
nvlist's internal buffer.

Reported by: Coverity
Fixes: 240afd8c1fcc ("makefs: Add ZFS support")
Sponsored by: The FreeBSD Foundation

21 months agorouting: fix non-debug build
Mateusz Guzik [Thu, 11 Aug 2022 14:12:59 +0000 (14:12 +0000)]
routing: fix non-debug build

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

21 months agoAdjust function definition in subr_devmap.c to avoid clang 15 warning
Andrew Turner [Thu, 11 Aug 2022 12:04:58 +0000 (13:04 +0100)]
Adjust function definition in subr_devmap.c to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/kern/subr_devmap.c:87:19: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    devmap_print_table()
                      ^
                       void

This is because devmap_print_table() and devmap_lastaddr() are declared
with a (void) argument list, but defined with an empty argument list.
Make the definition match the declaration.

Sponsored by: The FreeBSD Foundation

21 months agoAdjust function definition in ofw to avoid clang 15 warning
Andrew Turner [Thu, 11 Aug 2022 12:02:50 +0000 (13:02 +0100)]
Adjust function definition in ofw to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/dev/ofw/openfirm.c:826:9: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    OF_enter()
            ^
             void

This is because OF_enter() and OF_exit are declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

Sponsored by: The FreeBSD Foundation

21 months agoAdjust function definition in hwpmc to avoid clang 15 warning
Andrew Turner [Thu, 11 Aug 2022 12:02:33 +0000 (13:02 +0100)]
Adjust function definition in hwpmc to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/dev/hwpmc/hwpmc_arm64.c:530:21: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pmc_arm64_initialize()
                        ^
                         void

This is because many of the functions are declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

Sponsored by: The FreeBSD Foundation

21 months agorouting: populate fibs with interface routes after growing net.fibs.
Alexander V. Chernikov [Sun, 7 Aug 2022 20:26:19 +0000 (20:26 +0000)]
routing: populate fibs with interface routes after growing net.fibs.

Currently it is possible to extend number of fibs in runtime, but this
 functionality is of limited use when net.add_addrs_all_fibs is
 non-zero, as the routing tables are created empty.

This change automatically populate newly-created fibs with the kernel-originated
 interface routes (filtered by RTF_PINNED flag) if net.add_addrs_all_fibs
 is set.

```
-> sysctl net.add_addr_allfibs=1
net.add_addr_allfibs: 0 -> 1
-> sysctl net.fibs
net.fibs: 2
-> sysctl net.fibs=3
net.fibs: 2 -> 3

BEFORE:
-> setfib 2 netstat -rn
Routing tables (fib: 2)

AFTER:
-> setfib 2 netstat -rn
Routing tables (fib: 2)

Internet:
Destination        Gateway            Flags     Netif Expire
10.0.0.0/24        link#1             U        vtnet0
10.0.0.5           link#1             UHS         lo0
127.0.0.1          link#2             UH          lo0

Internet6:
Destination                       Gateway                       Flags     Netif Expire
::1                               link#2                        UHS         lo0
2a01:4f9:3a:fa00::/64             link#1                        U        vtnet0
2a01:4f9:3a:fa00:5054:ff:fe15:4a3b link#1                       UHS         lo0
fe80::%vtnet0/64                  link#1                        U        vtnet0
fe80::5054:ff:fe15:4a3b%vtnet0    link#1                        UHS         lo0
fe80::%lo0/64                     link#2                        U           lo0
fe80::1%lo0                       link#2                        UHS         lo0
```

Differential Revision: https://reviews.freebsd.org/D36075
MFC after: 1 month

21 months agorouting: fixup empty mask prefix handling after 2ce553854cbd.
Alexander V. Chernikov [Thu, 11 Aug 2022 11:41:42 +0000 (11:41 +0000)]
routing: fixup empty mask prefix handling after 2ce553854cbd.

MFC after: 1 month

21 months agorouting: fix build warning without ROUTE_MPATH
Alexander V. Chernikov [Thu, 11 Aug 2022 09:46:28 +0000 (09:46 +0000)]
routing: fix build warning without ROUTE_MPATH

Reported by: Gary Jennejohn <garyj@gmx.de>
MFC after: 1 month

21 months agoif_ovpn tests: Test using a TCP socket for DCO
Kristof Provost [Thu, 11 Aug 2022 08:34:01 +0000 (10:34 +0200)]
if_ovpn tests: Test using a TCP socket for DCO

This used to trigger panics, so try to reproduce it.
Create an if_ovpn interface, set a new peer on it with a TCP fd (as
opposed to the expected UDP) and ensure that this is rejected.

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

21 months agoif_ovpn: reject non-UDP sockets
Kristof Provost [Thu, 11 Aug 2022 08:30:39 +0000 (10:30 +0200)]
if_ovpn: reject non-UDP sockets

We must ensure that the fd provided by userspace is really for a UDP
socket. If it's not we'll panic in udp_set_kernel_tunneling().

Reported by: Gert Doering <gert@greenie.muc.de>
Sponsored by: Rubicon Communications, LLC ("Netgate")

21 months agoAdd RockChip RK356X support to existing RockChip thermal driver.
Søren Schmidt [Thu, 11 Aug 2022 08:26:39 +0000 (08:26 +0000)]
Add RockChip RK356X support to existing RockChip thermal driver.

21 months agostress2: Added a regression test
Peter Holm [Thu, 11 Aug 2022 07:42:02 +0000 (09:42 +0200)]
stress2: Added a regression test

21 months agoAdd support for RK3568 to RockChip GRF and SPI drivers.
Ganbold Tsagaankhuu [Thu, 11 Aug 2022 05:32:48 +0000 (05:32 +0000)]
Add support for RK3568 to RockChip GRF and SPI drivers.
Partially from https://reviews.freebsd.org/D36027

Submitted by: sos

22 months agostand: impose 510,000 byte limit for /boot/loader and /boot/pxeldr
Warner Losh [Thu, 11 Aug 2022 03:19:01 +0000 (21:19 -0600)]
stand: impose 510,000 byte limit for /boot/loader and /boot/pxeldr

The BIOS method of booting imposes an absolute limit of 640k for the
size of the program being run due to btx. In practice, this means that
programs larger than about 500kiB will fail in odd ways as the stack /
heap will overflow.

Pick 510,000 as the cutoff line semi-arbitrarily. loader_lua is now
almost too big and we want to break the build when it crosses this
threshold. In my experience, below 500,000 always works, above 520,000
always seems to fail with things getting bad somewhere between 512,000
to 515,000. 510,000 is as close to the line as I think we can go, though
experience may dictate we need to lower this in the future.

This is at-best a stop-breakage until we have a better way to subset the
boot loader for BIOS booting to allow better, more fined-tuned
/boot/loaders for the many different environments they have to run
in. This likely means we'll have a graphical loader than understands a
few filesystmes for installation, and a non-graphical loader that
understands the most filesystems possible for everything else in the
future. Our build infrastructure needs some work before we can do that,
however.

At this late date, it likely isn't worth the efforts to move parts of
the loader into high memory. There's a number of assumptions about where
the stack is, where buffers reside, etc that are fulfilled when it lives
in the first 640k that would need bounce buffers and/or other counter
measures if we were to split it up. All BIOS calls are done in 16-bit
mode with SEG:OFF addresses, requiring them to be in the first 640k of
RAM. And nearly all machines in the last decade can boot with UEFI
(though there's some exceptions, so it isn't worth killing outright
yet).

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

22 months agostand: i386/amd64: Always use elf format for /boot/loader and pxeldr
Warner Losh [Thu, 11 Aug 2022 03:18:32 +0000 (21:18 -0600)]
stand: i386/amd64: Always use elf format for /boot/loader and pxeldr

The first level boot blocks have understood how to load ELF code since
1999. Switch /boot/loader and /boot/pxeldr over to being ELF format so
that in-tree tools can examine them more closely. In addition, one
could, in theory, now have a 'lo-mem' and a 'hi-mem' segment (though a
lot of work would need to be done with bounce buffers, btx, code segment
marking, etc for an arrangement like that to work).

As far as I can tell, this is the last a.out binary in the tree. There
are several raw binaries left, but everything else is ELF.

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

22 months agocontrib/tzdata: import tzdata 2022b
Philip Paeps [Thu, 11 Aug 2022 02:48:24 +0000 (10:48 +0800)]
contrib/tzdata: import tzdata 2022b

Changes: https://github.com/eggert/tz/blob/2022b/NEWS

MFC after: 3 days

22 months agoImport tzdata 2022b
Philip Paeps [Thu, 11 Aug 2022 02:23:48 +0000 (10:23 +0800)]
Import tzdata 2022b

22 months agoacpi: mark INVARIANTS variables as __diagused
Ed Maste [Wed, 10 Aug 2022 00:39:28 +0000 (20:39 -0400)]
acpi: mark INVARIANTS variables as __diagused

Fixes INVARIANTS build with Clang 15, which previously failed due to
set-but-not-used variable warnings.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36096

22 months agorouting: fix build without ROUTE_MPATH
Alexander V. Chernikov [Wed, 10 Aug 2022 20:44:43 +0000 (20:44 +0000)]
routing: fix build without ROUTE_MPATH

MFC after: 1 month

22 months agosdio: Add CCCR speed defines
Emmanuel Vadot [Wed, 14 Jul 2021 15:25:36 +0000 (17:25 +0200)]
sdio: Add CCCR speed defines

Those are the defines needed to change speed on a SDIO card.

22 months agosdio: Do not allow setting a block size if function doesn't support it
Emmanuel Vadot [Wed, 26 May 2021 11:15:58 +0000 (13:15 +0200)]
sdio: Do not allow setting a block size if function doesn't support it

22 months agosdio: Always use increment address for read/write_4
Emmanuel Vadot [Fri, 21 May 2021 11:33:34 +0000 (13:33 +0200)]
sdio: Always use increment address for read/write_4

SDIO CMD53 (RW Extented) can either write to the same address (useful for FIFO)
or auto increment the destination address (to write to multiple registers).
It is more logical to have read/write_4 to use incremental mode and make other
helper function for writing to a FIFO destination especially since most FIFO
write/read will be 8bits based and not 32bits based.

22 months agosdio: Change the sdio helper name and arg order
Emmanuel Vadot [Fri, 21 May 2021 09:56:39 +0000 (11:56 +0200)]
sdio: Change the sdio helper name and arg order

Do not use b/l but _1/_4 also address comes first and then data.
This makes them closer to something like bus_space_{read,write}
We have no users in the tree.

22 months agoopencrypto: mark INVARIANTS variables as __diagused
Ed Maste [Tue, 9 Aug 2022 23:23:19 +0000 (19:23 -0400)]
opencrypto: mark INVARIANTS variables as __diagused

Fixes INVARIANTS build with Clang 15, which previously failed due to
set-but-not-used variable warnings.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

22 months agodevd: move all devd notification logic to a separate file.
Alexander V. Chernikov [Tue, 9 Aug 2022 15:55:23 +0000 (15:55 +0000)]
devd: move all devd notification logic to a separate file.

Currently, subr_bus.c shares logic for (a) maintaining all HW devices
 (e.g. discovery/attach/detach logic) and (b) generic devctl notification
 layer for devices/PMU/GEOM/interfaces/etc).
These two subsystems share really tiny interaction interface, composed of 3
 notification functions. With that in mind, move devctl layer to a
 separate file, establishing a clear notification interface between the
 sub.c bus layer and the provider (devctl).

The primary driver of this change is netlink implementation (D36002).
The idea is to propagate device-level events to netlink as well, so all
 netlink customers can subscribe to these changes.
The long-term goal is to deprecate devctl and to use netlink as the
 kernel<> userland transport provided netlink gets enough traction.

Reviewed by: imp, markj
Differential Revision: https://reviews.freebsd.org/D36091
MFC after: 1 month

22 months agorouting: move rtentry and subscription code out of route_ctl.c
Alexander V. Chernikov [Mon, 8 Aug 2022 13:54:17 +0000 (13:54 +0000)]
routing: move rtentry and subscription code out of route_ctl.c

route_ctl.c size has grown considerably since initial introduction.
Factor out non-relevant parts:
* all rtentry logic, such as creation/destruction and accessors
 goes to net/route/route_rtentry.c
* all rtable subscription logic goes to net/route/route_subscription.c

Differential Revision: https://reviews.freebsd.org/D36074
MFC after: 1 month

22 months agorouting: add rib_<add|del>_route_px() functions operating with nexthops.
Alexander V. Chernikov [Thu, 4 Aug 2022 14:55:30 +0000 (14:55 +0000)]
routing: add rib_<add|del>_route_px() functions operating with nexthops.

This change adds public KPI to work with routes using pre-created
 nexthops, instead of using data from addrinfo structures. These
 functions will be later used for adding/deleting kernel-originated
 routes and upcoming netlink protocol.

As a part of providing this KPI, low-level route addition code has been
 reworked to provide more control over route creation or change.
 Specifically, a number of operation flags
 (RTM_F_<CREATE|EXCL|REPLACE|APPEND>) have been added, defining the
 desired behaviour the the route already exists (or not exists). This
 change required some changes in the multipath addition code, resulting
 in moving this code to route_ctl.c, rendering mpath_ctl.c empty.

Differential Revision: https://reviews.freebsd.org/D36073
MFC after: 1 month

22 months agorouting: split nexthop creation and rtentry creation.
Alexander V. Chernikov [Thu, 4 Aug 2022 12:35:31 +0000 (12:35 +0000)]
routing: split nexthop creation and rtentry creation.

This change is required for the upcoming introduction of the next
 nexhop-based operations KPI, as it will create rtentry and nexthops
 at different stages of route table modification.

Differential Revision: https://reviews.freebsd.org/D36072
MFC after: 2 weeks

22 months agorouting: refactor #2
Alexander V. Chernikov [Wed, 3 Aug 2022 08:20:40 +0000 (08:20 +0000)]
routing: refactor #2

* Use same filter func (rib_filter_f_t) for nexhtop groups to
 simplify callbacks.
* simplify conditional route deletion & remove the need to pass
 rt_addrinfo to the low-level deletion functions
* speedup rib_walk_del() by removing an additional per-prefix lookup

Differential Revision: https://reviews.freebsd.org/D36071
MFC after: 1 month

22 months agorouting: refactor control cmds #1
Alexander V. Chernikov [Tue, 2 Aug 2022 12:44:20 +0000 (12:44 +0000)]
routing: refactor control cmds #1

This and the follow-up routing-related changes target to remove or
 reduce `struct rt_addrinfo` usage and use recently-landed nhop(9)
 KPI instead.
Traditionally `rt_addrinfo` structure has been used to propagate all necessary
information between the protocol/rtsock and a routing layer. Many
functions inside routing subsystem uses it internally. However, using
this structure became somewhat complicated, as there are too many ways
of specifying a single state and verifying data consistency is hard.
For example, arerouting flgs consistent with mask/gateway sockaddr pointers?
Is mask really a host mask? Are sockaddr "valid" (e.g. properly zeroed, masked,
have proper length)? Are they mutable? Is the suggested interface specified
 by the interface index embedded into the sockadd_dl gateway, or passed
 as RTAX_IFP parameter, or directly provided by rti_ifp or it needs to
 be derived from the ifa?
These (and other similar) questions have to be considered every time when
 a function has `rt_addrinfo` pointer as an argument.

The new approach is to bring more control back to the protocols and
construct the desired routing objects themselves - in the end, it's the
protocol/subsystem who knows the desired outcome.

This specific diff changes the following:
* add explicit basic low-level radix operations:
 add_route() (renamed from add_route_nhop())
 delete_route() (factored from change_route_nhop())
 change_route() (renamed from change_route_nhop)
* remove "info" parameter from change_route_conditional() as a part
 of reducing rt_addrinfo usage in the internal KPIs
* add lookup_prefix_rt() wrapper for doing re-lookups after
 RIB lock/unlock

Differential Revision: https://reviews.freebsd.org/D36070
MFC after: 2 weeks

22 months agotcp: utilize new solisten_clone() and solisten_enqueue()
Gleb Smirnoff [Wed, 10 Aug 2022 18:09:34 +0000 (11:09 -0700)]
tcp: utilize new solisten_clone() and solisten_enqueue()

This streamlines cloning of a socket from a listener.  Now we do not
drop the inpcb lock during creation of a new socket, do not do useless
state transitions, and put a fully initialized socket+inpcb+tcpcb into
the listen queue.

Before this change, first we would allocate the socket and inpcb+tcpcb via
tcp_usr_attach() as TCPS_CLOSED, link them into global list of pcbs, unlock
pcb and put this onto incomplete queue (see 6f3caa6d815).  Then, after
sonewconn() we would lock it again, transition into TCPS_SYN_RECEIVED,
insert into inpcb hash, finalize initialization of tcpcb.  And then, in
call into tcp_do_segment() and upon transition to TCPS_ESTABLISHED call
soisconnected().  This call would lock the listening socket once again
with a LOR protection sequence and then we would relocate the socket onto
the complete queue and only now it is ready for accept(2).

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D36064

22 months agosockets: provide solisten_clone(), solisten_enqueue()
Gleb Smirnoff [Wed, 10 Aug 2022 18:09:34 +0000 (11:09 -0700)]
sockets: provide solisten_clone(), solisten_enqueue()

as alternative KPI to sonewconn().  The latter has three stages:
- check the listening socket queue limits
- allocate a new socket
- call into protocol attach method
- link the new socket into the listen queue of the listening socket

The attach method, originally designed for a creation of socket by the
socket(2) syscall has slightly different semantics than attach of a socket
cloned by listener.  Make it possible for protocols to call into the
first stage, then perform a different attach, and then call into the
final stage.  The first stage, that checks limits and clones a socket
is called solisten_clone(), and the function that enqueues the socket
is solisten_enqueue().

Reviewed by: tuexen
Differential revision: https://reviews.freebsd.org/D36063

22 months agoinpcb: gather v4/v6 handling code into in_pcballoc() from protocols
Gleb Smirnoff [Wed, 10 Aug 2022 18:09:34 +0000 (11:09 -0700)]
inpcb: gather v4/v6 handling code into in_pcballoc() from protocols

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D36062

22 months agomodules: if_awg: Add miibus_if.h to the source
Emmanuel Vadot [Sun, 14 Nov 2021 19:53:10 +0000 (20:53 +0100)]
modules: if_awg: Add miibus_if.h to the source

Needed by the module.

22 months agomodules: aw_mmc: Add mmc_pwrseq_if to the source
Emmanuel Vadot [Sun, 14 Nov 2021 19:52:44 +0000 (20:52 +0100)]
modules: aw_mmc: Add mmc_pwrseq_if to the source

Needed by the module.

22 months agoarm64: rockchip: rk_gpio: Improve mode switching
Emmanuel Vadot [Wed, 22 Sep 2021 14:55:54 +0000 (16:55 +0200)]
arm64: rockchip: rk_gpio: Improve mode switching

Changing mode on a pin (input/output/pullup/pulldown) is a bit slow.
Improve this by caching what we can.
We need to check if the pin is in gpio mode, do that the first time
that we have a request for this pin and cache the result. We can't do
that at attach as we are a child of rk_pinctrl and it didn't finished
its attach then.
Cache also the flags specific to the pinctrl (pullup or pulldown) if the
pin is in input mode.
Cache the registers that deals with input/output mode and output value. Also
remove some register reads when we change the direction of a pin or when we
change the output value since the bit changed in the registers only affect output
pins.

22 months agoSimplify setting a non-4k PAGE_SIZE on arm64
Andrew Turner [Tue, 9 Aug 2022 15:15:56 +0000 (16:15 +0100)]
Simplify setting a non-4k PAGE_SIZE on arm64

Define PAGE_SIZE and PAGE_MASK based on PAGE_SHIFT. With this we only
need to set one value to change one value to change the page size.

While here remove the unused PAGE_MASK_* macros.

Sponsored by: The FreeBSD Foundation

22 months agogpio: mark INVARIANTS variables as __diagused
Ed Maste [Tue, 9 Aug 2022 23:30:13 +0000 (19:30 -0400)]
gpio: mark INVARIANTS variables as __diagused

Fixes INVARIANTS build with Clang 15, which previously failed due to
set-but-not-used variable warnings.

Reviewed by: dim
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36097

22 months agotcp: address a wire level race with 2 ACKs at the end of TCP handshake
Gleb Smirnoff [Wed, 10 Aug 2022 14:32:37 +0000 (07:32 -0700)]
tcp: address a wire level race with 2 ACKs at the end of TCP handshake

Imagine we are in SYN-RCVD state and two ACKs arrive at the same time,
both valid, e.g. coming from the same host and with valid sequence.

First packet would locate the listening socket in the inpcb database,
write-lock it and start expanding the syncache entry into a socket.
Meanwhile second packet would wait on the write lock of the listening
socket.  First packet will create a new ESTABLISHED socket, free the
syncache entry and unlock the listening socket.  Second packet would
call into syncache_expand(), but this time it will fail as there
is no syncache entry.  Second packet would generate RST, effectively
resetting the remote connection.

It seems to me, that it is impossible to solve this problem with
just rearranging locks, as the race happens at a wire level.

To solve the problem, for an ACK packet arrived on a listening socket,
that failed syncache lookup, perform a second non-wildcard lookup right
away.  That lookup may find the new born socket.  Otherwise, we indeed
send RST.

Tested by: kp
Reviewed by: tuexen, rrs
PR: 265154
Differential revision: https://reviews.freebsd.org/D36066

22 months agonetinet6: allow ND entries creation for all directly-reachable
Alexander V. Chernikov [Wed, 10 Aug 2022 11:51:58 +0000 (11:51 +0000)]
netinet6: allow ND entries creation for all directly-reachable
destinations.

The current assumption is that kernel-handled rtadv prefixes along with
 the interface address prefixes are the only prefixes considered in
 the ND neighbor eligibility code.
Change this by allowing any non-gatewaye routes to be eligible. This
 will allow DHCPv6-controlled routes to be correctly handled by
 the ND code.
Refactor nd6_is_new_addr_neighbor() to enable more deterministic
 performance in "found" case and remove non-needed
 V_rt_add_addr_allfibs handling logic.

Reviewed By: kbowling
Differential Revision: https://reviews.freebsd.org/D23695
MFC after: 1 month

22 months agoarm64: rockchip: pinctrl: Do not rely on the node name
Emmanuel Vadot [Wed, 10 Aug 2022 13:47:22 +0000 (15:47 +0200)]
arm64: rockchip: pinctrl: Do not rely on the node name

Node names for gpio bank were made generic in Linux 5.16 so stop
using them to map the gpio controller to the pin controller bank unit.

Sponsored by: Beckhoff Automation GmbH & Co. KG

22 months agoImport device-tree files from Linux 5.18
Emmanuel Vadot [Wed, 10 Aug 2022 12:32:46 +0000 (14:32 +0200)]
Import device-tree files from Linux 5.18

Sponsored by:   Beckhoff Automation GmbH & Co. KG

22 months agoImport device-tree files from Linux 5.18
Emmanuel Vadot [Wed, 10 Aug 2022 12:31:09 +0000 (14:31 +0200)]
Import device-tree files from Linux 5.18

22 months agoImport device-tree files from Linux 5.17
Emmanuel Vadot [Wed, 10 Aug 2022 12:29:43 +0000 (14:29 +0200)]
Import device-tree files from Linux 5.17

Sponsored by:   Beckhoff Automation GmbH & Co. KG

22 months agoImport device-tree files from Linux 5.17
Emmanuel Vadot [Wed, 10 Aug 2022 12:28:38 +0000 (14:28 +0200)]
Import device-tree files from Linux 5.17

22 months agoImport device-tree files from Linux 5.16
Emmanuel Vadot [Wed, 10 Aug 2022 12:27:16 +0000 (14:27 +0200)]
Import device-tree files from Linux 5.16

Sponsored by:   Beckhoff Automation GmbH & Co. KG

22 months agoImport device-tree files from Linux 5.16
Emmanuel Vadot [Wed, 10 Aug 2022 12:25:35 +0000 (14:25 +0200)]
Import device-tree files from Linux 5.16

22 months agoImport device-tree files from Linux 5.15
Emmanuel Vadot [Wed, 10 Aug 2022 12:21:52 +0000 (14:21 +0200)]
Import device-tree files from Linux 5.15

Sponsored by: Beckhoff Automation GmbH & Co. KG

22 months agoImport device-tree files from Linux 5.15
Emmanuel Vadot [Wed, 10 Aug 2022 12:20:33 +0000 (14:20 +0200)]
Import device-tree files from Linux 5.15

22 months agoImport device-tree files from Linux 5.14
Emmanuel Vadot [Wed, 10 Aug 2022 12:11:47 +0000 (14:11 +0200)]
Import device-tree files from Linux 5.14

22 months agoImport device-tree files from Linux 5.14
Emmanuel Vadot [Wed, 10 Aug 2022 12:05:33 +0000 (14:05 +0200)]
Import device-tree files from Linux 5.14

22 months agoZTS: Fix zpool_expand_001_pos
Tony Hutter [Tue, 9 Aug 2022 20:26:46 +0000 (13:26 -0700)]
ZTS: Fix zpool_expand_001_pos

`zpool_expand_001_pos` was often failing due to not seeing autoexpand
commands in the `zpool history`.  During testing, I found this to be
unreliable (sometimes the "online" wouldn't appear in `zpool history`)
and unnecessary, as we could simply check that the pool increased in
size.

This commit revamps the test to check for the expanded pool size
and corresponding new free space.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #13743

22 months agoAdd comment on acb_zio_dummy
Christian Schwarz [Mon, 8 Aug 2022 23:55:13 +0000 (01:55 +0200)]
Add comment on acb_zio_dummy

Thanks to George Wilson for clarifying this on Slack.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Wilson <gwilson@delphix.com>
Signed-off-by: Christian Schwarz <christian.schwarz@nutanix.com>
Closes #13698

22 months agoLinux 6.0 compat: register_shrinker() now var-arg
Coleman Kane [Mon, 8 Aug 2022 23:18:30 +0000 (19:18 -0400)]
Linux 6.0 compat: register_shrinker() now var-arg

The 6.0 kernel added a printf-style var-arg for args > 0 to the
register_shrinker function, in order to add names to shrinkers, in
commit e33c267ab70de4249d22d7eab1cc7d68a889bac2. This enables the
shrinkers to have friendly names exposed in /sys/kernel/debug/shrinker/.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Coleman Kane <ckane@colemankane.org>
Closes #13748

22 months agotcp: improve BBLog for output events when using the FreeBSD stack
Michael Tuexen [Mon, 8 Aug 2022 11:07:10 +0000 (13:07 +0200)]
tcp: improve BBLog for output events when using the FreeBSD stack

Put the return value of ip_output()/ip6_output in the output event
instead of adding another one in case of an error. This improves
consistency with other similar places.

Reviewed by: rscheff
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D36085

22 months agosctp: improve handling of send() calls with no user data`
Michael Tuexen [Mon, 8 Aug 2022 10:53:42 +0000 (12:53 +0200)]
sctp: improve handling of send() calls with no user data`

In particular, don't report EAGAIN on send() calls with no user
data, which might trigger a KASSERT in asyc IO.

Reported by: syzbot+3b4dc5d1d63e9bd01eda@syzkaller.appspotmail.com
MFC after: 1 week

22 months agoarc4random(3): Reduce diff with OpenBSD.
Xin LI [Wed, 10 Aug 2022 00:27:54 +0000 (17:27 -0700)]
arc4random(3): Reduce diff with OpenBSD.

The main change was v1.57 by djm@:

  Randomise the rekey interval a little. Previously, the chacha20
  instance would be rekeyed every 1.6MB. This makes it happen at a
  random point somewhere in the 1-2MB range.

Reviewed by: csprng (markm, cem)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36088

22 months agotests: Add more shared shadow regression tests
Mark Johnston [Tue, 9 Aug 2022 20:17:56 +0000 (16:17 -0400)]
tests: Add more shared shadow regression tests

The new tests exercise simulated COW that occurs when the protections on
a wired, copy-on-write mapping are changed from read-only to read-write.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35636

22 months agoatomic: Add plain atomic_load/store_bool()
Mark Johnston [Tue, 9 Aug 2022 20:08:29 +0000 (16:08 -0400)]
atomic: Add plain atomic_load/store_bool()

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36078

22 months agodtrace/amd64: Implement emulation of call instructions
Mark Johnston [Tue, 9 Aug 2022 20:08:13 +0000 (16:08 -0400)]
dtrace/amd64: Implement emulation of call instructions

Here, the provider is responsible for updating the trapframe to redirect
control flow and for computing the return address.  Once software-saved
registers are restored, the emulation shifts the remaining context down
on the stack to make space for the return address, then copies the
address provided by the invop handler.  dtrace_invop() is modified to
allocate temporary storage space on the stack for use by the provider to
return the return address.

This is to support a new provider for amd64 which can instrument
arbitrary instructions, not just function entry and exit instructions as
FBT does.

In collaboration with: christos
Sponsored by: Google, Inc. (GSoC 2022)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

22 months agofbt/x86: Extract arg1 for return probes from the trapframe
Mark Johnston [Tue, 9 Aug 2022 20:08:09 +0000 (16:08 -0400)]
fbt/x86: Extract arg1 for return probes from the trapframe

dtrace invop handlers have access to the whole trapframe, just use that
to extract %rax/%eax for return probes instead of relying on an
additional parameter to the handler.  No functional change intended.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

22 months agorelease: Include an etcupdate tree in -DNO_ROOT release image builds
Jessica Clarke [Tue, 9 Aug 2022 21:58:01 +0000 (22:58 +0100)]
release: Include an etcupdate tree in -DNO_ROOT release image builds

This makes use of the new -N etcupdate flag and merges the resulting
METALOG into base.meta re-rooted to /var/db/etcupdate/current.

Reviewed by: gjb
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D35858

22 months agoetcupdate: Add a -N flag to perform a NO_ROOT build
Jessica Clarke [Tue, 9 Aug 2022 21:57:47 +0000 (22:57 +0100)]
etcupdate: Add a -N flag to perform a NO_ROOT build

This is in preparation for including an etcupdate tree when performing a
-DNO_ROOT release image build. Although -DNO_ROOT can be passed via -M,
to be useful we need to mangle the resulting METALOG to mirror the
various cleanups to the tree that are done after the build (removing
generated files, empty files and empty directories), so etcupdate needs
its own flag.

Reviewed by: jhb, pauamma
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D35857

22 months agoetcupdate: Prefer POSIX -depth to BSD -d
Jessica Clarke [Tue, 9 Aug 2022 21:57:22 +0000 (22:57 +0100)]
etcupdate: Prefer POSIX -depth to BSD -d

This is in preparation for building an etcupdate tree on non-FreeBSD
when building release images. The -d option is documented as a
BSD-specific equivalent to the POSIX -depth primary. Whilst GNU find
sort of accepts it in an attempt to be compatible, it still doesn't
permit it coming before the paths, unlike BSD find, and prints a
deprecation warning either way. Thus, use the equivalent POSIX -depth to
ensure it works correctly and without warning everywhere.

Reviewed by: jhb
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D35856

22 months agorelease: Forward ${MAKE} to etcupdate via the new -m flag
Jessica Clarke [Tue, 9 Aug 2022 21:57:01 +0000 (22:57 +0100)]
release: Forward ${MAKE} to etcupdate via the new -m flag

This is in preparation for non-FreeBSD builds where make is GNU make and
so etcupdate needs to know the name of or path to the bmake binary to
use for its own builds.

Reviewed by: gjb
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D35855

22 months agoetcupdate: Add a -m flag to change the make binary that's run
Jessica Clarke [Tue, 9 Aug 2022 21:56:19 +0000 (22:56 +0100)]
etcupdate: Add a -m flag to change the make binary that's run

This will allow release/Makefile to forward on ${MAKE} to allow building
on non-FreeBSD systems where ${MAKE} is something other than make, as
make is typically GNU make in such situations.

Reviewed by: jhb, pauamma
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D35854

22 months agorelease: Use in-tree etcupdate for build
Jessica Clarke [Tue, 9 Aug 2022 21:52:47 +0000 (22:52 +0100)]
release: Use in-tree etcupdate for build

This is in preparation for non-FreeBSD and -DNO_ROOT builds. On
non-FreeBSD there is no host etcupdate to use, and -DNO_ROOT will
require additional flags that may not be supported by the host's
etcupdate when building on FreeBSD. Moreover, there's no guarantee
anyway that the host's etcupdate is quite right for the current tree;
upgrading from source only requires that the host's is good enough for
-p which just manually copies master.passwd and group, the rest of the
upgrade is done post-installworld. For example, should a new set of
autogenerated files be added that etcupdate is taught about, the host
won't know about them and so the bootstrapped current tree will
incorrectly contain them, leading to spurious diffs on the installed
system.

Reviewed by: gjb, delphij
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D35853

22 months agovm_fault: Shoot down shared mappings in vm_fault_copy_entry()
Mark Johnston [Mon, 25 Jul 2022 20:53:21 +0000 (16:53 -0400)]
vm_fault: Shoot down shared mappings in vm_fault_copy_entry()

As in vm_fault_cow(), it's possible, albeit rare, for multiple vm_maps
to share a shadow object.  When copying a page from a backing object
into the shadow, all mappings of the source page must therefore be
removed.  Otherwise, future operations on the object tree may detect
that the source page is fully shadowed and thus can be freed.

Approved by: so
Security: FreeBSD-SA-22:11.vm
Reviewed by: alc, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35635

22 months agoelf_note_prpsinfo: handle more failures from proc_getargv()
Konstantin Belousov [Fri, 3 Jun 2022 08:21:23 +0000 (11:21 +0300)]
elf_note_prpsinfo: handle more failures from proc_getargv()

Resulting sbuf_len() from proc_getargv() might return 0 if user mangled
ps_strings enough. Also, sbuf_len() API contract is to return -1 if the
buffer overflowed. The later should not occur because get_ps_strings()
checks for catenated length, but check for this subtle detail explicitly
as well to be more resilent.

The end result is that p_comm is used in this situations.

Approved by: so
Security: FreeBSD-SA-22:09.elf
Reported by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: delphij, markj
admbugs: 988
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35391

22 months agorelease: ensure enforce_chs sysctl is 0
Ed Maste [Tue, 19 Jul 2022 20:47:49 +0000 (16:47 -0400)]
release: ensure enforce_chs sysctl is 0

We do not want CHS-based alignment for VM or SD card release images.

(Other images use makefs/mkimg, not kernel gpart and so do not depend
on this sysctl.)

Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
MFC after: 1 week

22 months agoAdd "heard" to the dictionary
Ed Maste [Mon, 8 Aug 2022 18:57:32 +0000 (14:57 -0400)]
Add "heard" to the dictionary

PR: 265671
Reported by: J.R. Oldroyd
MFC after: 3 days

22 months agoAdd the PHY driver for the Marvell 88E1512.
Luiz Souza [Fri, 29 Jul 2022 15:43:56 +0000 (17:43 +0200)]
Add the PHY driver for the Marvell 88E1512.

This driver supports the auto negotiation mode between the copper and fiber
ports.

This PHY has two independent PHYs (one for copper and other for fiber) but in
this case the functionality is presented as a single PHY for easy management.

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