]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
16 months agoinfiniband: Convert BPF handling for IfAPI
Justin Hibbits [Thu, 9 Feb 2023 02:32:47 +0000 (21:32 -0500)]
infiniband: Convert BPF handling for IfAPI

Summary:
All callers of infiniband_bpf_mtap() call it through the wrapper macro,
which checks the if_bpf member explicitly.  Since this is getting
hidden, move this check into the internal function and remove the
wrapper macro.

Reviewed by: hselasky
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39024

16 months agossh: fix leak and apply style(9) to hostname canonicalization
Ed Maste [Wed, 8 Feb 2023 13:16:53 +0000 (08:16 -0500)]
ssh: fix leak and apply style(9) to hostname canonicalization

Fixes: bf2e2524a2ce ("ssh: canonicize the host name before...")
Fixes: 3e74849a1ee2 ("ssh: canonicize the host name before...")
Reviewed by: rew
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38441

16 months agocompiler-rt: remove eprintf
Ed Maste [Tue, 14 Mar 2023 17:01:20 +0000 (13:01 -0400)]
compiler-rt: remove eprintf

It was used by ancient GCC assert.h.  Prior to 2001 GCC used to provide
its own assert.h  The GCC assert.h required __eprintf to emit the error
message.  FreeBSD's own assert.h never used this.

Reviewed by: ed (previously), imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2597

16 months agoReserve u2f group for FIDO/U2F key support (SSH, etc.)
Ed Maste [Fri, 18 Feb 2022 18:13:20 +0000 (13:13 -0500)]
Reserve u2f group for FIDO/U2F key support (SSH, etc.)

We have FIDO/U2F support in the base system now, so reserve a group ID
for it (maching the security/u2f-devd port).

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34341

16 months agoping: Remove ifndef icmp_data guards
Jose Luis Duran [Tue, 14 Mar 2023 15:22:33 +0000 (11:22 -0400)]
ping: Remove ifndef icmp_data guards

Early versions of <netinet/ip_icmp.h> [1] did not have icmp_data
defined, but FreeBSD has always had.  Remove these guards.

NetBSD [2] and OpenBSD [3] have already removed them.

[1]: https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/netinet/ip_icmp.h
[2]: https://github.com/NetBSD/src/commit/203dfd34867991fd002f747d74a96f26ae80d41c
[3]: https://github.com/openbsd/src/commit/d83449c83c03b86e72d642dc92bcea434310435a

Reviewed by: markj
MFC after: 1 week

16 months agoping: Fix the display of Flags/Fragment Offset
Jose Luis Duran [Tue, 14 Mar 2023 15:09:27 +0000 (11:09 -0400)]
ping: Fix the display of Flags/Fragment Offset

In the IP header, Flags + Fragment Offset is a 16-bit field.

Use ntohs() instead of ntohl(), otherwise the Flags/Fragment Offset
values may not display correctly.

Before (DF set)

    Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
     4  5  00 0054 0001   0 0000  40  01 b6a4 192.0.2.1  192.0.2.2

After (DF set)

    Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
     4  5  00 0054 0001   2 0000  40  01 b6a4 192.0.2.1  192.0.2.2

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38479

16 months agoping6: Use errx to avoid appending a specious error message
Jose Luis Duran [Tue, 14 Mar 2023 15:08:54 +0000 (11:08 -0400)]
ping6: Use errx to avoid appending a specious error message

Reviewed by: asomers, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38418

16 months agoudp: Fix a memory leak in udp6_send()
Mark Johnston [Tue, 14 Mar 2023 14:26:29 +0000 (10:26 -0400)]
udp: Fix a memory leak in udp6_send()

Reviewed by: glebius
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38993

16 months agoIncrease protection provided by veriexec with new unlink/rename hooks.
dl [Tue, 14 Mar 2023 04:26:41 +0000 (22:26 -0600)]
Increase protection provided by veriexec with new unlink/rename hooks.

Functions implemented :

- mac_veriexec_vnode_check_unlink: Unlink on a file has been
  requested and requires validation. This function prohibits the
  deleting a protected file (or deleting one of these hard links, if
  any).
- mac_veriexec_vnode_check_rename_from: Rename the file has been
  requested and must be validated. This function controls the renaming
  of protected file
- mac_veriexec_vnode_check_rename_to: File overwrite rename has been
  requested and must be validated. This function prevent overwriting of
  a file protected (overwriting by mv command).

The 3 fonctions together aim to control the 'removal' (via unlink) and
the 'mv' on files protected by veriexec. The intention is to reach the
functional level of NetBSD veriexec.

Add sysctl node security.mac.veriexec.unlink to toggle control on
syscall unlink.

Add tunable kernel variable security.mac.veriexec.block_unlink to toggle
unlink protection. Add the corresponding read-only sysctl.

[ tidied up commit message, trailing whitespace, long lines, { placement ]

Reviewed by: sjg, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/613

16 months agoloader: Add support for booting from a ZFS snapshot
Allan Jude [Sat, 26 Nov 2022 18:11:13 +0000 (18:11 +0000)]
loader: Add support for booting from a ZFS snapshot

When booting from a snapshot we need to follow a different code path
to turn the objset ID into the name, and for forward lookups we need
to walk the parent's snapnames_zap.

With this, it is possible to set the pools BOOTFS property to a
snapshot and boot with a read-only filesystem of that snapshot.

Reviewed by: tsoome, rew, imp
Sponsored By: Beckhoff Automation GmbH & Co. KG
Sponsored By: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38600

16 months agoroute.8: Don't reference an external command in EXAMPLES
Gordon Bergling [Tue, 14 Mar 2023 13:55:28 +0000 (14:55 +0100)]
route.8: Don't reference an external command in EXAMPLES

It is better to mention the externel command for showing
the routing table as using an explicit command.

PR: 231579
Suggested by: karels
Reviewed by: karles, gbe
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39075

16 months agoCI: update QEMU command line to avoid deprecated option format
Ed Maste [Tue, 7 Mar 2023 16:38:01 +0000 (11:38 -0500)]
CI: update QEMU command line to avoid deprecated option format

> warning: short-form boolean option 'readonly' deprecated
> Please use readonly=on instead

Sponsored by: The FreeBSD Foundation

16 months agoAlways enable the virtual timer for userspace
Andrew Turner [Fri, 10 Mar 2023 12:43:59 +0000 (12:43 +0000)]
Always enable the virtual timer for userspace

We always have it, some languages assume it's present, e.g. go
before 1.20. Enable it by default on arm and arm64.

PR: 269070
Reviewed by: kevans
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39059

16 months agoFix the ofw parent check in arm64 nexus
Andrew Turner [Mon, 6 Mar 2023 09:54:57 +0000 (09:54 +0000)]
Fix the ofw parent check in arm64 nexus

OF_parent returns 0 for no parent. Fix the check in teh arm64
nexus_fdt_activate_resource.

Sponsored by: Arm Ltd

16 months agoxen: take struct size into account for video information
Roger Pau Monné [Mon, 13 Mar 2023 14:17:21 +0000 (15:17 +0100)]
xen: take struct size into account for video information

The xenpf_dom0_console_t structure can grow as more data is added, and
hence we need to check that the fields we accesses have been filled by
Xen.  The only extra field FreeBSD currently uses is the top 32 bits
for the frame buffer physical address.

Note that this field is present in all the versions that make the
information available from the platform hypercall interface, so the
check here is mostly cosmetic, and to remember us that newly added
fields require checking the size of the returned data.

Fixes: 6f80738b228c ('xen: fetch dom0 video console information from Xen')
Sponsored by: Citrix Systems R&D

16 months agoAdd GNU glibc compatible secure_getenv
lucy [Mon, 13 Mar 2023 22:01:12 +0000 (16:01 -0600)]
Add GNU glibc compatible secure_getenv

Add mostly glibc and msl compatible secure_getenv. Return NULL if
issetugid() indicates the process is tainted, otherwise getenv(x).  The
rational behind this is the fact that many Linux applications use this
function instead of getenv() as it's widely consider a, "best
practice".

Reviewed by: imp, mjg (feedback)
Pull Request: https://github.com/freebsd/freebsd-src/pull/686
Signed-off-by: Lucy Marsh <seafork@disroot.org>
16 months agoarm64: Delete redundant badly formatted and capitalised comment
Jessica Clarke [Tue, 14 Mar 2023 04:15:03 +0000 (04:15 +0000)]
arm64: Delete redundant badly formatted and capitalised comment

Fixes: 9729f076e4d9 ("arm64: Hyper-V: enablement for ARM64 in Hyper-V (Part 3, final)")

16 months agoarm64: Move Azure-specific config from std.hyperv to std.azure
Jessica Clarke [Tue, 14 Mar 2023 04:12:31 +0000 (04:12 +0000)]
arm64: Move Azure-specific config from std.hyperv to std.azure

Hyper-V does not provide Mellanox hardware, some of Azure's instances
do, thus the configuration to enable them does not belong in the generic
std.hyperv config.

Fixes: 15e7fa83ef3c ("arm64: Hyper-V: Add vPCI and Mellanox driver modules into build")

16 months agoParse /kboot.conf
Warner Losh [Tue, 14 Mar 2023 02:33:35 +0000 (20:33 -0600)]
Parse /kboot.conf

If there's a kboot.conf, prase it after the command line args are
parsed. It's not always easy to get all the right command line args
depending on the environment. Allow an escape hatch. While we can't do
everything one might like in this file, we can do enough.

Sponsored by: Netflix

16 months agomakefs: do not call brelse if bread returns an error
Ed Maste [Mon, 13 Mar 2023 20:51:51 +0000 (16:51 -0400)]
makefs: do not call brelse if bread returns an error

If bread returns an error there is no bp to brelse.  One of these
changes was taken from NetBSD commit 0a62dad69f62 ("This works well
enough to populate..."), the rest were found by looking for the same
pattern.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39069

16 months agoarm: generic_timer: use interrupt-names when available
Kyle Evans [Sun, 5 Mar 2023 00:49:04 +0000 (18:49 -0600)]
arm: generic_timer: use interrupt-names when available

Offsets for all of thse can be a bit complicated as not all interrupts
will be present, only phys and virt are actually required, and sec-phys
could optionally be specified before phys.  Push idx/name pairs into
a new config struct and maintain the old indices while still getting the
correct timers.

Split fdt/acpi attach out independently and allocate interrupts before
we head into the common attach().  The secure physical timer is also
optional there, so mark it so to avoid erroring out if we run into
problems.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D38911

16 months agomakefs: make msdos creation go fast
Warner Losh [Mon, 13 Mar 2023 20:28:51 +0000 (14:28 -0600)]
makefs: make msdos creation go fast

Add missing brelse(bp). Without it the cache grows and we have a n^2
lookup.  I'm not entirely sure why we read the block before we write it
back out, since the only side effect of that is to allocate memory,
clear the memory, read it in from disk, throw it away with the contents
of the file being written out. We likely should just do a getblk() here
instead, but even with all that, this takes the time it takes to create
a 150MB msdos fs image down from 5 minutes to 30 seconds.

Old: 317.663u 0.685s 5:18.34 100.0% 198+360k 0+19io 1009pf+0w
New: 7.330u 23.841s 0:31.17 100.0% 198+360k 0+250522io 4pf+0w

See code review for how we got this. tl;dr: netbsd move brelse
into bwrite and we picked up msdos code after that, but not the
move. That change should be picked up later.

Sponsored by: Netflix
Reviewed by: emaste
MFC After: 1 day (13.2 is coming fast)
Differential Revision: https://reviews.freebsd.org/D39025

16 months agonet.inet6.ip6.log_interval: use ppsratecheck(9) internally
Pawel Biernacki [Mon, 13 Mar 2023 16:39:20 +0000 (16:39 +0000)]
net.inet6.ip6.log_interval: use ppsratecheck(9) internally

Reported by: mjg
Differential Revision: https://reviews.freebsd.org/D38758

16 months agonetinet6: allow disabling excess log messages
Pawel Biernacki [Mon, 13 Mar 2023 16:36:11 +0000 (16:36 +0000)]
netinet6: allow disabling excess log messages

RFC 4443 specifies cases where certain packets, like those originating from
local-scope addresses destined outside of the scope shouldn't be forwarded.
The current practice is to drop them, send ICMPv6 message where appropriate,
and log the message:

cannot forward src fe80:10::426:82ff:fe36:1d8, dst 2001:db8:db8::10, nxt
58, rcvif vlan5, outif vlan2

At times the volume of such messages cat get very high. Let's allow local
admins to disable such messages on per vnet basis, keeping the current
default (log).

Reported by: zarychtam@plan-b.pwste.edu.pl
Reviewed by: zlei (previous version), pauamma (docs)
Differential Revision: https://reviews.freebsd.org/D38644

16 months agotftp: Add test cases for URL mode.
Dag-Erling Smørgrav [Mon, 13 Mar 2023 16:16:10 +0000 (16:16 +0000)]
tftp: Add test cases for URL mode.

Sponsored by: Klara, Inc.
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D39014

16 months agodtrace/powerpc: Remove accidental commented out line
Justin Hibbits [Mon, 13 Mar 2023 15:33:17 +0000 (11:33 -0400)]
dtrace/powerpc: Remove accidental commented out line

Fixes: 3e1155ade1b

16 months agonetinet: Disallow unspecified addresses in ICMP-embedded packets
Mark Johnston [Mon, 13 Mar 2023 14:45:56 +0000 (10:45 -0400)]
netinet: Disallow unspecified addresses in ICMP-embedded packets

Reported by: glebius
Reported by: syzbot+981c528ccb5c5534dffc@syzkaller.appspotmail.com
Reviewed by: tuexen, glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38936

16 months agoepair: Remove unneeded includes and sort some of the rest
Mark Johnston [Mon, 13 Mar 2023 13:27:47 +0000 (09:27 -0400)]
epair: Remove unneeded includes and sort some of the rest

No functional change intended.

MFC after: 1 week

16 months agosmr: Remove the return value from smr_wait()
Mark Johnston [Tue, 7 Feb 2023 21:38:07 +0000 (16:38 -0500)]
smr: Remove the return value from smr_wait()

This is supposed to be a blocking version of smr_poll(), so there's no
need for a return value.  No functional change intended.

MFC after: 1 week

16 months agosendfile tests: Mount filesystems under the test workdir
Mark Johnston [Sun, 12 Mar 2023 18:50:14 +0000 (14:50 -0400)]
sendfile tests: Mount filesystems under the test workdir

Otherwise they can't be run in parallel as they share a mount point.

MFC after: 1 week

16 months agozfs: Use .section .rodata instead of .rodata on FreeBSD
Dimitry Andric [Sat, 25 Feb 2023 00:45:48 +0000 (01:45 +0100)]
zfs: Use .section .rodata instead of .rodata on FreeBSD

In commit 0a5b942d4 the FreeBSD SECTION_STATIC macro was set to
".rodata". This assembler directive is supported by LLVM (as a
convenience alias for ".section .rodata") by not by GNU as.

This caused the FreeBSD builds that are done with gcc to fail.
Therefore, use ".section .rodata" instead, similar to the other
asm_linkage.h headers.

[mjg: cherry-picked from upstream zfs bf1bec394e715de9f7ac4a54b5b1b884d7e41a32
 to unbreak gcc12 build]

Reviewed-by: Mateusz Guzik <mjguzik@gmail.com>
Reviewed-by: Attila Fülöp <attila@fueloep.org>
Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Signed-off-by: Dimitry Andric <dimitry@andric.com>
Closes #14526

16 months agovm: consistently prefix fault helpers with vm_fault_
Mateusz Guzik [Sun, 12 Mar 2023 18:38:29 +0000 (18:38 +0000)]
vm: consistently prefix fault helpers with vm_fault_

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D39029

16 months agotests: fix python parsing of netlink nested attributes
Alexander V. Chernikov [Mon, 13 Mar 2023 10:17:36 +0000 (10:17 +0000)]
tests: fix python parsing of netlink nested attributes

MFC after: 2 weeks

16 months agoarm64: Hyper-V: Add vPCI and Mellanox driver modules into build
Wei Hu [Mon, 13 Mar 2023 02:55:04 +0000 (02:55 +0000)]
arm64: Hyper-V: Add vPCI and Mellanox driver modules into build

These changes in conf and std.hyperv files got missed in previous commit.
Reviewed by: whu
Tested by: whu
Obtained from: Souradeep Chakrabarti <schakrabarti@microsoft.com>
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D38529

16 months agoDocument gethostbyname_r's public exposure in 6.2.
David E. O'Brien [Mon, 13 Mar 2023 01:43:05 +0000 (18:43 -0700)]
Document gethostbyname_r's public exposure in 6.2.

16 months agoLook in getlocalbase() for the calendar-data package data
David E. O'Brien [Wed, 8 Mar 2023 03:51:27 +0000 (19:51 -0800)]
Look in getlocalbase() for the calendar-data package data

Fix d20d6550187a95a78bb532909aad8ef7ac62be66 where getlocalbase()
wasn't used to fill out the printf(3) format of _PATH_INCLUDE_LOCAL.

Differential Revision: https://reviews.freebsd.org/D38975
Reviewed by: imp

16 months agoRELNOTES: Add an entry for NFS server support in vnet prisons
Rick Macklem [Sun, 12 Mar 2023 21:55:46 +0000 (14:55 -0700)]
RELNOTES: Add an entry for NFS server support in vnet prisons

16 months agolib/csu: do not compile the body of handle_static_init() for PIC build at all
Konstantin Belousov [Sun, 12 Mar 2023 01:45:37 +0000 (03:45 +0200)]
lib/csu: do not compile the body of handle_static_init() for PIC build at all

The referenced symbols that provide init array boundaries are weak,
hidden, and undefined.  The code that iterates over that arrays is not
used for the case when libc is compiled as dso.

This should fix linking with ld.bfd.

Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

16 months agolibc/csu: add powerpcspe
Konstantin Belousov [Sun, 12 Mar 2023 09:59:16 +0000 (11:59 +0200)]
libc/csu: add powerpcspe

Reported and tested by: alfredo
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

16 months agorc.d: Fix NFS server startup scripts to enable vnet prison use
Rick Macklem [Sun, 12 Mar 2023 21:34:25 +0000 (14:34 -0700)]
rc.d: Fix NFS server startup scripts to enable vnet prison use

Now that commit cbbb22031f9b is in main,
it is possible to run nfsd(8), nfsuserd(8), mountd(8),
gssd(8) and rpc.tlsservd(8) in an appropriately configured vnet
prison if the "allow.nfsd" option is specified in jail.conf.

This patch fixes the rc scripts for this.
Mostly just replaces the "nojail" KEYWORD with "nojailvnet",
but also avoids setting vfs.nfsd.srvmaxio in a prison, since it
must be set outside of the prisons and applies to all
nfsd(8) instances.

Reviewed by: jamie
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D38809

16 months agovfs: whack leftover cn_origflags
Mateusz Guzik [Sun, 12 Mar 2023 19:06:46 +0000 (19:06 +0000)]
vfs: whack leftover cn_origflags

Unused since 5b5b7e2ca2fa9a24 ("vfs: always retain path buffer after lookup")

Reported by: dchagin

16 months agodaemon: move variables into struct daemon_state
Ihor Antonov [Sun, 12 Mar 2023 16:07:34 +0000 (10:07 -0600)]
daemon: move variables into struct daemon_state

The fact that most of the daemon's state is stored on the stack
of the main() makes it hard to split the logic smaller chunks.
Which in turn leads to huge main func that does a a lot of things.
struct log_params existed because some variables need to be passed
into other functions together.

This change renames struct log_params into daemon_state
and moves the rest of the variables into it. This is a necessary
preparation step for further refactroing.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/687

16 months agopowerpc/pmap: Add pmap_sync_icache() for radix pmap
Justin Hibbits [Sun, 12 Mar 2023 15:46:57 +0000 (11:46 -0400)]
powerpc/pmap: Add pmap_sync_icache() for radix pmap

DTrace pid provider writes to user space to set breakpoints.  Failing to
sync the icache can lead to SIGTRAP.  Radix pmap is the only one missing
a pmap_sync_icache() method, so the pid provider would only potentially
crash a process on a POWER9 or later system.

16 months agopowerpc: enable ZFS on 32 bit powerpc/powerpcspe
Alfredo Dal'Ava Junior [Sun, 12 Mar 2023 06:20:11 +0000 (03:20 -0300)]
powerpc: enable ZFS on 32 bit powerpc/powerpcspe

Enable ZFS on powerpc 32 bit since it appears to build and work
correctly.

MFC after: 3 weeks
Relnotes: yes

16 months agolibc/csu: rename ignore_init.c to libc_start1.c
Konstantin Belousov [Sat, 11 Mar 2023 22:56:46 +0000 (00:56 +0200)]
libc/csu: rename ignore_init.c to libc_start1.c

The current name was a historical curiosity that started when init array
support was added, and then the file appeared a convenient place for the
addition of the MI common code to csu.  It is now referenced by name in
single place and the rename is easy, so do it.

Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

16 months agolibc: move declaration of 'char **environ' to common private header
Konstantin Belousov [Sun, 6 Nov 2022 04:08:36 +0000 (06:08 +0200)]
libc: move declaration of 'char **environ' to common private header

Suggested by: imp
Reviewed by: markj
Tested by: markj (aarch64)
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D37220

16 months agox86: microoptimize static PIE startup
Konstantin Belousov [Tue, 1 Nov 2022 01:42:50 +0000 (03:42 +0200)]
x86: microoptimize static PIE startup

Do not call CPUID on each ireloc, instead call it once and cache
results, similar to how it is done on powerpc64.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D37220

16 months agocsu: move common code to libc
Konstantin Belousov [Sun, 30 Oct 2022 23:47:44 +0000 (01:47 +0200)]
csu: move common code to libc

Why? Most trivial point, it shaves around 600 bytes from the dynamic
binaries on amd64. Less trivial, the removed code is no longer part of
the ABI, and we can ship updates to it with libc updates. Right now most
of the csu is linked into the binaries and require us to do somewhat
tricky ABI compat when it needs to change. For instance, the init_array
change would be much simpler and does not require note tagging if we
have init calling code in libc.

This could be improved more, by splitting dynamic and static
initialization. For instance, &_DYNAMIC tests can be removed then.
Such change, nonetheless, would require building libc three times.
I left this for later, after this change stabilizes, if ever.

Reviewed by: markj
Discussed with: jrtc27 (some objections, see the review), imp
Tested by: markj (aarch64)
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D37220

16 months agovm: avoid lock upgrade if possible in vm_fault_next
Mateusz Guzik [Sat, 11 Mar 2023 20:57:24 +0000 (20:57 +0000)]
vm: avoid lock upgrade if possible in vm_fault_next

In my tests during buildkernel fs->m was always NULL at that stage.

Note the change has no impact on vm obj contention during said workload.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D39027

16 months agorc.conf.5: a stray whitespace removed
Maxim Konovalov [Sat, 11 Mar 2023 21:08:04 +0000 (21:08 +0000)]
rc.conf.5: a stray whitespace removed

PR: 270124

16 months agonetmap: get rid of WNA() macro
Vincenzo Maffione [Sat, 11 Mar 2023 17:19:01 +0000 (17:19 +0000)]
netmap: get rid of WNA() macro

MFC after: 7 days

16 months agodtrace/powerpc: "Fix" stack traces across trap frames
Justin Hibbits [Sat, 11 Mar 2023 16:30:00 +0000 (11:30 -0500)]
dtrace/powerpc: "Fix" stack traces across trap frames

In function boundary tracing the link register is not yet saved to the
save stack location, so the save point contains whatever the previous
'lr' save was, or even garbage, at the time the trap is taken.  Address
this by explicitly loading the link register from the trap frame instead
of the stack, and propagate that out.

16 months agodtrace/powerpc: Adjust AFRAMES for fbt and profile
Justin Hibbits [Sat, 11 Mar 2023 16:23:38 +0000 (11:23 -0500)]
dtrace/powerpc: Adjust AFRAMES for fbt and profile

FBT_AFRAMES was skipping over too many frames, while PROFILE_AFRAMES was
skipping over too few.  Adjust them empirically.

16 months agophyp_llan: Mechanically convert to IfAPI
Justin Hibbits [Sat, 11 Mar 2023 16:25:25 +0000 (11:25 -0500)]
phyp_llan: Mechanically convert to IfAPI

Sponsored by: Juniper Networks, Inc.

16 months agodtsec: Complete mechanical conversion to IfAPI
Justin Hibbits [Tue, 7 Mar 2023 20:41:38 +0000 (15:41 -0500)]
dtsec: Complete mechanical conversion to IfAPI

Some changes were missed in 0083fc5c76.

Sponsored by: Juniper Networks, Inc.

16 months agorc.conf.5: fix typo of route6d that I introduced while nitpicking
Ceri Davies [Sat, 11 Mar 2023 14:56:40 +0000 (14:56 +0000)]
rc.conf.5: fix typo of route6d that I introduced while nitpicking

16 months agorc.conf.5: dhclient came from OpenBSD, but now isn't the OpenBSD client
Ceri Davies [Sat, 11 Mar 2023 14:54:11 +0000 (14:54 +0000)]
rc.conf.5: dhclient came from OpenBSD, but now isn't the OpenBSD client

16 months agovm: read-locked fault handling for backing objects
Mateusz Guzik [Tue, 7 Mar 2023 20:56:54 +0000 (20:56 +0000)]
vm: read-locked fault handling for backing objects

This is almost the simplest patch which manages to avoid write locking
for backing objects, as a result mostly fixing vm object contention
problems.

What is not fixed:
1. cacheline ping pong due to read-locks
2. cacheline ping pong due to pip
3. cacheling ping pong due to object busying
4. write locking on first object

On top of it the use of VM_OBJECT_UNLOCK instead of explicitly tracking
the state is slower multithreaded that it needs to be, done for
simplicity for the time being.

Sample lock profiling results doing -j 104 buildkernel on tmpfs:
before:
71446200 (rw:vmobject)
14689706 (sx:vm map (user))
4166251 (rw:pmap pv list)
2799924 (spin mutex:turnstile chain)

after:
19940411 (rw:vmobject)
8166012 (rw:pmap pv list)
6017608 (sx:vm map (user))
1151416 (sleep mutex:pipe mutex)

Reviewed by: kib
Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D38964

16 months agovm: add VM_OBJECT_UNLOCK
Mateusz Guzik [Tue, 7 Mar 2023 20:47:44 +0000 (20:47 +0000)]
vm: add VM_OBJECT_UNLOCK

Reviewed by: kib
Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D38964

16 months agovm: move up object lock asserts in fault functions
Mateusz Guzik [Sun, 7 Aug 2022 13:05:47 +0000 (13:05 +0000)]
vm: move up object lock asserts in fault functions

No functional changes.

Reviewed by: kib
Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D38964

16 months agoqat: Reconnect qat.4 to the build
Mark Johnston [Fri, 10 Mar 2023 23:30:08 +0000 (18:30 -0500)]
qat: Reconnect qat.4 to the build

It was disconnected when the new QAT driver was imported, and never
reconnected.

16 months agonetbsd-tests: Serialize message queue tests
Mark Johnston [Fri, 10 Mar 2023 22:07:06 +0000 (17:07 -0500)]
netbsd-tests: Serialize message queue tests

They can fail when run in parallel since they all share a global queue
key.

MFC after: 1 week

16 months agonetbsd-tests: Remove some pointless sleeps from message queue tests
Mark Johnston [Fri, 10 Mar 2023 22:06:46 +0000 (17:06 -0500)]
netbsd-tests: Remove some pointless sleeps from message queue tests

- In the msgctl tests, there is no point in sleeping after a fork().
  Just block immediately in wait().
- In non-blocking send/recv tests, just wait for the child to exit once
  it's reached a message limit.  If a bug prevents the child from
  exiting promptly, the test will time out.

MFC after: 1 week

16 months agoopts: fix silly typo
Warner Losh [Fri, 10 Mar 2023 16:00:38 +0000 (09:00 -0700)]
opts: fix silly typo

It's powerpcspe not powerpcspc

Pointy Hat To: imp
Noticed by: jhibbits
Fixes: 41cf798e8206
Sponsored by: Netflix

16 months agoopts: popwerpcspc is also 32-bit
Warner Losh [Fri, 10 Mar 2023 15:45:05 +0000 (08:45 -0700)]
opts: popwerpcspc is also 32-bit

Mark ZFS broken here too, add comment about why.  Add comments about
OFED being disabled on 32-bit arm, add comment about why too.

Sponsored by: Netflix

16 months agoopts: Minor cleanup of ZFS options
Warner Losh [Fri, 10 Mar 2023 13:55:11 +0000 (06:55 -0700)]
opts: Minor cleanup of ZFS options

Remove redundant CPUARCH test: we really just want a plain MACHINE_ARCH
here.

Second, always turn off LOADER_ZFS when we turn off ZFS. Not 100%
required, but we did it some places and not others. There's no current
mechanism to say that if X is disabled then X_Y must be too.

Sponsored by: Netflix

16 months agotftpd: Gracefully skip tests if networking is not enabled.
Dag-Erling Smørgrav [Fri, 10 Mar 2023 13:25:00 +0000 (13:25 +0000)]
tftpd: Gracefully skip tests if networking is not enabled.

Sponsored by: Klara, Inc.
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D39012

16 months agotftp: Add tests.
Dag-Erling Smørgrav [Fri, 10 Mar 2023 13:24:56 +0000 (13:24 +0000)]
tftp: Add tests.

Sponsored by: Klara, Inc.
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D38969

16 months agotftpd: Don't forget to close stderr on startup.
Dag-Erling Smørgrav [Fri, 10 Mar 2023 13:24:50 +0000 (13:24 +0000)]
tftpd: Don't forget to close stderr on startup.

Just like stdin and stdout, stderr is a copy of the listen socket inherited from inetd.  We need to close it so inetd can process further requests, be restarted, etc.

Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38968

16 months agotftpd: Don't consume arbitrary requests when failing to fork.
Dag-Erling Smørgrav [Fri, 10 Mar 2023 13:24:44 +0000 (13:24 +0000)]
tftpd: Don't consume arbitrary requests when failing to fork.

We've already consumed one request, which is sufficient to prevent inetd from endlessly restarting us in this particular and extremely unlikely case.

Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38967

16 months agotftpd: Use poll() instead of alarm() + setjmp().
Dag-Erling Smørgrav [Fri, 10 Mar 2023 13:24:36 +0000 (13:24 +0000)]
tftpd: Use poll() instead of alarm() + setjmp().

While there, don't log an error when timing out waiting for a possible retransmit after a successful transfer.

Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38966

16 months agotftpd: Make the -d option behave as documented.
Dag-Erling Smørgrav [Fri, 10 Mar 2023 13:24:32 +0000 (13:24 +0000)]
tftpd: Make the -d option behave as documented.

Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38965

16 months agotftp: Correctly propagate transfer errors.
Dag-Erling Smørgrav [Fri, 10 Mar 2023 13:24:28 +0000 (13:24 +0000)]
tftp: Correctly propagate transfer errors.

Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38958

16 months agotftpd: Make the transfer functions return success / failure.
Dag-Erling Smørgrav [Fri, 10 Mar 2023 13:24:23 +0000 (13:24 +0000)]
tftpd: Make the transfer functions return success / failure.

Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38957

16 months agotftpd: Ensure that tftp_log() preserves errno.
Dag-Erling Smørgrav [Fri, 10 Mar 2023 13:24:19 +0000 (13:24 +0000)]
tftpd: Ensure that tftp_log() preserves errno.

Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38956

16 months agotftpd: Fix max block size calculation.
Dag-Erling Smørgrav [Fri, 10 Mar 2023 13:24:15 +0000 (13:24 +0000)]
tftpd: Fix max block size calculation.

Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38953

16 months agocontrib/bc: update to version 6.4.0
Stefan Eßer [Fri, 10 Mar 2023 10:33:33 +0000 (11:33 +0100)]
contrib/bc: update to version 6.4.0

This version contains a fix for an issue that can affect complex
bc scripts that use multiple read() functions that receive input from
an interactive user. The same value could be returned multiple times.

MFC after: 2 weeks

16 months agokern: physmem: don't create a new exregion for different flags...
Kyle Evans [Fri, 10 Mar 2023 05:27:39 +0000 (23:27 -0600)]
kern: physmem: don't create a new exregion for different flags...

... if the region we're adding is an exact match to one that we already
have.  Simply extend the flags of the existing entry as needed so that
we don't end up with duplicate regions.

It could be that we got the exclusion through two different means, e.g.,
FDT memreserve and the EFI memory map, and we may derive different
characteristics from each.  Apply the most restrictive set to the
region.

Reported by: Mark Millard <marklmi yahoo com>
Reviewed by: mhorne

16 months agocap_*(2): Document ENOSYS behavior.
Xin LI [Fri, 10 Mar 2023 02:10:50 +0000 (18:10 -0800)]
cap_*(2): Document ENOSYS behavior.

Summary:
All cap_* system calls would fail when capability mode support is
not present.

MFC after: 2 weeks
Reviewed by: emaste, pauamma
Differential Revision: https://reviews.freebsd.org/D38976

16 months agoheimdal: Fix CVE-2022-4152, signature validation error
Cy Schubert [Fri, 10 Mar 2023 01:03:52 +0000 (17:03 -0800)]
heimdal: Fix CVE-2022-4152, signature validation error

When CVE-2022-3437 was fixed by changing memcmp to be a constant
time and the workaround for th e compiler was to add "!=0". However
the logic implmented was inverted resulting in CVE-2022-4152.

Reported by: Timothy E Zingelman <zingelman _AT_ fnal.gov>
MFC after: 1 day
Security: CVE-2022-4152
Security: https://www.cve.org/CVERecord?id=CVE-2022-45142
Security: https://nvd.nist.gov/vuln/detail/CVE-2022-45142
Security: https://security-tracker.debian.org/tracker/CVE-2022-45142
Security: https://bugs.gentoo.org/show_bug.cgi?id=CVE-2022-45142
Security: https://bugzilla.samba.org/show_bug.cgi?id=15296
Security: https://www.openwall.com/lists/oss-security/2023/02/08/1

16 months agosctp: initial implementation of draft-tuexen-tsvwg-sctp-zero-checksum
Michael Tuexen [Fri, 10 Mar 2023 00:45:46 +0000 (01:45 +0100)]
sctp: initial implementation of draft-tuexen-tsvwg-sctp-zero-checksum

16 months agonetmap: Remove obsolete compatibility defines
Mark Johnston [Thu, 9 Mar 2023 23:16:53 +0000 (18:16 -0500)]
netmap: Remove obsolete compatibility defines

No functional change intended.

Reviewed by: vmaffione
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39001

16 months agoAdd WITH_LOADER_VERIEXEC_VECTX description
Brooks Davis [Thu, 9 Mar 2023 21:39:41 +0000 (21:39 +0000)]
Add WITH_LOADER_VERIEXEC_VECTX description

PR: 270017
Reviewed by: emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D39002

16 months agoinclude: Remove no longer existing netgraph/atm
Michael Butler [Thu, 9 Mar 2023 21:39:41 +0000 (21:39 +0000)]
include: Remove no longer existing netgraph/atm

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D39005

16 months agoman5/rc.conf.5: finally retire references to pccard_ifconfig variable
Ceri Davies [Thu, 9 Mar 2023 21:38:46 +0000 (21:38 +0000)]
man5/rc.conf.5: finally retire references to pccard_ifconfig variable

It was removed in June 2005.

16 months agoman5/rc.conf.5: minor nitpicks to formatting, grammar, spelling
Ceri Davies [Thu, 9 Mar 2023 21:35:03 +0000 (21:35 +0000)]
man5/rc.conf.5: minor nitpicks to formatting, grammar, spelling

16 months agorc.conf: update comment referring to /etc/motd
Ceri Davies [Thu, 9 Mar 2023 21:28:30 +0000 (21:28 +0000)]
rc.conf: update comment referring to /etc/motd

16 months agopkg(7): now that we do use libmd, use it completly
Baptiste Daroussin [Thu, 9 Mar 2023 20:29:15 +0000 (21:29 +0100)]
pkg(7): now that we do use libmd, use it completly

Use SHA256_Fd and SHA256_Data instead of home made equivalent.
wrap those functions into hash.c to avoid header collition between
openssl and libmd

Suggested by: kevans

16 months agoman5/rc.conf.5: document hostid and machine-id related variables
Ceri Davies [Thu, 9 Mar 2023 20:05:52 +0000 (20:05 +0000)]
man5/rc.conf.5: document hostid and machine-id related variables

16 months agoRemove WITH(OUT)_ATM option
Brooks Davis [Thu, 9 Mar 2023 18:04:36 +0000 (18:04 +0000)]
Remove WITH(OUT)_ATM option

With the removal of NgATM it no longer controls anything.

Reviewed by: manu, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D38882

16 months agong_atmllc: remove
Brooks Davis [Thu, 9 Mar 2023 18:04:21 +0000 (18:04 +0000)]
ng_atmllc: remove

This standalone module is the last vestage of ATM support in the tree so
send it on its way.

Reviewed by: manu, emaste
Relnotes: yes
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D38880

16 months agoNgATM: Remove netgraph ATM support
Brooks Davis [Thu, 9 Mar 2023 18:04:02 +0000 (18:04 +0000)]
NgATM: Remove netgraph ATM support

Most ATM support was removed prior to FreeBSD 12.  The netgraph support
was kept as it was less intrusive, but it is presumed to be unused.

Reviewed by: manu
Relnotes: yes
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D38879

16 months agopkg(7): use libmd for sha256 instead of openssl
Baptiste Daroussin [Thu, 9 Mar 2023 16:38:30 +0000 (17:38 +0100)]
pkg(7): use libmd for sha256 instead of openssl

OpenSSL 3.0 has deprecated the sha256 api, let's use libmd which has the
same API instead.

In order to avoid the collision in definitions (sha256.h cannot be
included in the same file as a file where openssl headers has been
included) let's move the sha256 related code in its own file

PR: 270023
Reported by: ngie

16 months agovm_fault: Update a comment to reflect the removal of the default pager
Mark Johnston [Thu, 9 Mar 2023 16:15:49 +0000 (11:15 -0500)]
vm_fault: Update a comment to reflect the removal of the default pager

Fixes: 5d32157d4e5c ("vm_object: Modify vm_object_allocate_anon() to return OBJT_SWAP objects")
Reviewed by: alc, kib
Differential Revision: https://reviews.freebsd.org/D38985

16 months agoxen: fetch dom0 video console information from Xen
Roger Pau Monné [Mon, 21 Nov 2022 11:40:08 +0000 (12:40 +0100)]
xen: fetch dom0 video console information from Xen

It's possible for Xen to switch the video mode set by the boot loader,
so that the information passed in the kernel metadata is no longer
valid.  Fetch the video mode used by Xen using an hypercall and update
the medatada for the kernel to use the correct video mode.

Sponsored by: Citrix Systems R&D

16 months agoxen: bump used interface version
Roger Pau Monné [Mon, 21 Nov 2022 15:21:16 +0000 (16:21 +0100)]
xen: bump used interface version

This is required for a further change that will make use of a field
that was added in version 0x00040d00.

No functional change expected.

Sponsored by: Citrix Systems R&D

16 months agofix buildworld after 595d23f777dc.
Alexander V. Chernikov [Thu, 9 Mar 2023 15:44:59 +0000 (15:44 +0000)]
fix buildworld after 595d23f777dc.

Reported by: se

16 months agonvmecontrol: Fix default ns create parameters.
Alexander Motin [Thu, 9 Mar 2023 15:19:00 +0000 (10:19 -0500)]
nvmecontrol: Fix default ns create parameters.

Instead of passing 0xff's for all unset parameters, prefer reasonable
defaults.  It is much easier to use it this was without specs in hand.

MFC after: 1 week

16 months agonetlink: add snl(3) default parsers for routes and links.
Alexander V. Chernikov [Thu, 9 Mar 2023 14:43:56 +0000 (14:43 +0000)]
netlink: add snl(3) default parsers for routes and links.

This change adds the "default" parsers of _all_ route/link attributes
 exported by the kernel.
It removes the need to declare similar parsers in the userland applications,
 simplifying their logic.

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

16 months agonetlink: add rtsock-compatible header to use with netlink snl(3).
Alexander V. Chernikov [Thu, 9 Mar 2023 14:36:52 +0000 (14:36 +0000)]
netlink: add rtsock-compatible header to use with netlink snl(3).

Some routing socket defines (`RTM_` and `RTA_` ones) clash with the ones
 used by the the Netlink.
As some rtsock definitions like interface flags or route flags are used in
 both netlink and rtsock, provide a convenient way to include those without
 running into the define collision.

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