Commit Graph

282055 Commits

Author SHA1 Message Date
Jessica Clarke
f13b4e460c .github: Test DISK_IMAGE_TOOLS_BOOTSTRAP in CI
Building the tools is quick so we should provide coverage of this to
ensure it keeps working, especially on non-FreeBSD.

Reviewed by:	emaste, arichardson
Differential Revision:	https://reviews.freebsd.org/D39073
2023-03-15 00:06:53 +00:00
Jessica Clarke
9e914c7af1 Add new DISK_IMAGE_TOOLS_BOOTSTRAP option
This will build etdump, makefs and mkimg as bootstrap tools to allow
easily creating disk images. Note that etdump is bootstrapped due to its
use in the release scripts for building ISO images.

Reviewed by:	emaste, arichardson
Differential Revision:	https://reviews.freebsd.org/D39072
2023-03-15 00:06:53 +00:00
Jessica Clarke
379954d06c src.conf.5: Regen after ZFS-related options changes
Since 9503d2704c LOADER_ZFS gets turned off when ZFS is, and since
63715498ac ZFS is no longer disabled on powerpc and powerpcspe.

Reviewed by:	emaste
Fixes:	9503d2704c ("opts: Minor cleanup of ZFS options")
Fixes:	63715498ac ("powerpc: enable ZFS on 32 bit powerpc/powerpcspe")
Differential Revision:	https://reviews.freebsd.org/D39071
2023-03-15 00:06:52 +00:00
Warner Losh
a06761e3f4 secure_getenv: Put under __BSD_VISIBLE
Sponsored by:		Netflix
Reviewed by:		delphij
Differential Revision:	https://reviews.freebsd.org/D39076
2023-03-14 17:43:13 -06:00
Rick Macklem
c0f94fee0b jail.8: Update the allow.nfsd section
This patch updates the information for "allow.nfsd"
and adds configuration information.

This is a content change.

Reviewed by:	karels, markj, pauamma (manpages)
MFC after:	3 months
Differential Revision:	https://reviews.freebsd.org/D39033
2023-03-14 15:28:02 -07:00
Bjoern A. Zeeb
d7fb679dc9 net80211: make ieee80211_scan_dump_channels private
ieee80211_scan_dump_channels() is only used locally and only when
IEEE80211_DEBUG is compiled.  Stop exporting it, make it file local
and hide under the #ifdef to reduce the footprint for production
kernels a tiny bit.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D38833
2023-03-14 22:17:03 +00:00
Bjoern A. Zeeb
3346164ce8 net80211: define mask for ss_flags rather than using hardcoded 0xfff
scan state ss_flags in two places cut off the "internal" GOTPICK
options.  Replace the hardcoded 0xfff with a defined mask.
Note that "internal" flags is confusing as we also supplement the
the 16bit by another 16bit of "internal flags" passed around but
comaparing to GOTPICK never stored to my understanding.

No functional change.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D38832
2023-03-14 22:16:41 +00:00
Vincenzo Maffione
6c9fe35743 netmap: get rid of save_if_input for emulated adapters
The save_if_input function pointer was meant to save the previous
value of ifp->if_input before replacing it with the emulated
adapter hook.
However, the same pointer value is already stored in the if_input
field of the netmap_adapter struct, to be used for host TX ring processing.

Reuse the netmap_adapter if_input field to simplify the code
and save some space.

MFC after:	14 days
2023-03-14 22:04:23 +00:00
Justin Hibbits
adf62e8363 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
2023-03-14 15:51:32 -04:00
Ed Maste
19aba210e1 ssh: fix leak and apply style(9) to hostname canonicalization
Fixes:		bf2e2524a2 ("ssh: canonicize the host name before...")
Fixes:		3e74849a1e ("ssh: canonicize the host name before...")
Reviewed by:	rew
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38441
2023-03-14 13:16:57 -04:00
Ed Maste
96ab5023fd 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
2023-03-14 13:13:51 -04:00
Ed Maste
d0f1f38202 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
2023-03-14 13:09:40 -04:00
Jose Luis Duran
6d33121337 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]: 203dfd3486
[3]: d83449c83c

Reviewed by:	markj
MFC after:	1 week
2023-03-14 11:58:03 -04:00
Jose Luis Duran
9185854d19 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
2023-03-14 11:58:02 -04:00
Jose Luis Duran
f32d6f745d 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
2023-03-14 11:58:02 -04:00
Mark Johnston
e9ea690ae8 udp: Fix a memory leak in udp6_send()
Reviewed by:	glebius
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D38993
2023-03-14 11:58:02 -04:00
dl
2ef8baba4c 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
2023-03-14 09:04:31 -06:00
Allan Jude
a849842f51 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
2023-03-14 14:18:29 +00:00
Gordon Bergling
21f2681828 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
2023-03-14 14:55:28 +01:00
Ed Maste
a2de35e1a4 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
2023-03-14 08:44:50 -04:00
Andrew Turner
93d574ea95 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
2023-03-14 10:37:36 +00:00
Andrew Turner
ae60314c94 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
2023-03-14 10:37:00 +00:00
Roger Pau Monné
a78e46a7db 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: 6f80738b22 ('xen: fetch dom0 video console information from Xen')
Sponsored by: Citrix Systems R&D
2023-03-14 09:59:08 +01:00
lucy
adeca21464 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>
2023-03-13 22:19:24 -06:00
Jessica Clarke
4f7b3120bc arm64: Delete redundant badly formatted and capitalised comment
Fixes:	9729f076e4 ("arm64: Hyper-V: enablement for ARM64 in Hyper-V (Part 3, final)")
2023-03-14 04:15:03 +00:00
Jessica Clarke
aa39abd8e5 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:	15e7fa83ef ("arm64: Hyper-V: Add vPCI and Mellanox driver modules into build")
2023-03-14 04:12:31 +00:00
Warner Losh
7f3c360646 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
2023-03-13 20:45:50 -06:00
Ed Maste
bc33c99234 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
2023-03-13 22:39:09 -04:00
Kyle Evans
91b2da1370 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
2023-03-13 19:30:28 -05:00
Warner Losh
370e009188 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
2023-03-13 14:38:36 -06:00
Pawel Biernacki
35b6e52c30 net.inet6.ip6.log_interval: use ppsratecheck(9) internally
Reported by:	mjg
Differential Revision:	https://reviews.freebsd.org/D38758
2023-03-13 16:47:06 +00:00
Pawel Biernacki
3eaffc6265 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
2023-03-13 16:46:21 +00:00
Dag-Erling Smørgrav
fc76ddee9b tftp: Add test cases for URL mode.
Sponsored by:	Klara, Inc.
Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D39014
2023-03-13 16:16:26 +00:00
Justin Hibbits
e620e088cb dtrace/powerpc: Remove accidental commented out line
Fixes:	3e1155ade1
2023-03-13 11:37:40 -04:00
Mark Johnston
aa71d6b4a2 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
2023-03-13 10:45:56 -04:00
Mark Johnston
29c9b16733 epair: Remove unneeded includes and sort some of the rest
No functional change intended.

MFC after:	1 week
2023-03-13 10:45:35 -04:00
Mark Johnston
cd133525fa 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
2023-03-13 10:45:35 -04:00
Mark Johnston
683853a924 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
2023-03-13 10:45:35 -04:00
Dimitry Andric
84f06098ef 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 bf1bec394e
 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
2023-03-13 13:48:05 +00:00
Mateusz Guzik
0a310c94ee vm: consistently prefix fault helpers with vm_fault_
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D39029
2023-03-13 11:00:28 +00:00
Alexander V. Chernikov
90bc2120b5 tests: fix python parsing of netlink nested attributes
MFC after:	2 weeks
2023-03-13 10:17:36 +00:00
Wei Hu
15e7fa83ef 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
2023-03-13 02:55:04 +00:00
David E. O'Brien
47d0f36c3c Document gethostbyname_r's public exposure in 6.2. 2023-03-12 18:43:05 -07:00
David E. O'Brien
65e9eb0701 Look in getlocalbase() for the calendar-data package data
Fix d20d655018 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
2023-03-12 18:40:07 -07:00
Rick Macklem
84eac07049 RELNOTES: Add an entry for NFS server support in vnet prisons 2023-03-12 14:55:46 -07:00
Konstantin Belousov
c383f4857f 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
2023-03-12 23:47:41 +02:00
Konstantin Belousov
94e3409e2d libc/csu: add powerpcspe
Reported and tested by:	alfredo
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2023-03-12 23:47:41 +02:00
Rick Macklem
0bb08f21cc rc.d: Fix NFS server startup scripts to enable vnet prison use
Now that commit cbbb22031f 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
2023-03-12 14:34:25 -07:00
Mateusz Guzik
35c872422c vfs: whack leftover cn_origflags
Unused since 5b5b7e2ca2 ("vfs: always retain path buffer after lookup")

Reported by:	dchagin
2023-03-12 19:06:46 +00:00
Ihor Antonov
298a392ec3 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
2023-03-12 10:57:41 -06:00