b0ce7dfc jrtc27 Aug. 18, 2022, 1:46 a.m.
Currently the code copies a struct timespec's raw bits as a pair of
uint64_t. On 64-bit systems this has the same representation, but on
32-bit issues there are two issues:

1. tv_sec is a time_t which is 32-bit on i386 specifically
2. tv_nsec is a long not a 64-bit integer

On i386, this means the assertion should fire as the size doesn't match.
On other 32-bit systems there are 4 bytes of padding after tv_nsec,
which in practice are probably 0, as this data is ultimately coming from
the kernel, so it's deterministic (though the padding bytes are not
required to be preserved by the compiler, so are strictly unspecified).
However, on 32-bit big-endian systems, the padding bytes are in the
wrong half to be harmless, resulting in the nanoseconds being multiplied
by 2^32.

Fix this all by marshalling via a real uint64_t pair like is done by the

Reviewed by:	markj
Fixes:		240afd8c1fcc ("makefs: Add ZFS support")
Differential Revision:	https://reviews.freebsd.org/D36131
2541dcaf lwhsu Aug. 18, 2022, 1:24 a.m.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
54854864 jhb Aug. 17, 2022, 11:19 p.m.
Rather than using 'git checkout' to move to the commit in question for
create and update, use the '--head' argument to 'arc diff'.  This
avoids the need to alter the current checkout and the related bits to
save/restore HEAD in the current checkout.

Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D36248
6080e073 glebius Aug. 17, 2022, 9:54 p.m.
On most architectures/kernels it was included implicitly, but powerpc
MPC85XX got broken.

Fixes:	81a34d374ed6e5a7b14f24583bc8e3abfdc66306
8502144d markj Aug. 17, 2022, 9:28 p.m.
Sponsored by:	The FreeBSD Foundation
582ce32f markj Aug. 17, 2022, 9:28 p.m.
Sponsored by:	The FreeBSD Foundation
8eca3207 markj Aug. 17, 2022, 9:28 p.m.
The fsnode tree traversal routines used in ZFS mode assume that all
children of a (directory) fsnode can be accessed using a directory fd
for the parent and the child name.  This is true when populating the
image using an mtree manifest or from a single staging directory, but
doesn't work when multiple staging directories are specified.

Change the traversal routines to use absolute path lookups when an mtree
manifest is not in use.  This isn't ideal, but it's the simplest way to
fix the problem.

Reported by:	imp
Sponsored by:	The FreeBSD Foundation
6bae6625 mckusick Aug. 17, 2022, 9:19 p.m.
The UFS filesystem expects to find '.' and '..' as the first two entries
in a directory. The kernel's UFS name cache can become quite confused
when these two entries are not present as the first two entries.

Prior to this change, when the fsck_ffs(8) utility detected that
'.' and/or '..' were missing, it would report them, but only offered
to replace them if the space at the beginning of the directory was
available. Otherwise it was left to the system administrator to
move the offending file(s) out of the way and then rerun fsck_ffs(8)
to create the '.' and '..' entries.

With this change, fsck_ffs(8) will always be able to create the '.'
and/or '..' entries. It moves any files in the way elsewhere in the
directory block. If there is no room in the directory block to which
to move them, they are placed in the lost+found directory.

Reported by:  Peter Holm
Sponsored by: The FreeBSD Foundation
4f9606c9 mckusick Aug. 17, 2022, 8:54 p.m.
When either searching for backup UFS superblocks or when explicitly asked
to use one with the -b option, report the reason for failure if it cannot
be used.

Reported by:  Peter Holm
Sponsored by: The FreeBSD Foundation
926cedd9 bryanv Aug. 17, 2022, 8:15 p.m.
Implement the virtio_bus_finalize_features method so the FEATURES_OK
status bit is set. Implement the virtio_bus_config_generation method
to ensure larger than 4-byte reads are consistent.

Reviewed by:	cperciva
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36150
3499df29 jhb Aug. 17, 2022, 7:10 p.m.
This permits inlining the comparisons even in the 16K page case.
Note that since PC_FREEN is -1, values can be compared efficiently
without having to fetch words of pc_freemask from memory via the
'cmn <reg>, #0x1' instruction.

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D36218
5567d6b4 jhb Aug. 17, 2022, 7:10 p.m.
- Define PC_FREEL and _NPCM in terms of _NPCPV rather than via magic

- Remove assertions about _NPC* values from pmap.c.  This is less
  relevant now that PC_FREEL and _NPCM are derived from _NPCPV.

- Add a helper inline function pc_is_full() which uses a loop to check
  if pc_map is all zeroes.  Use this to replace three places that
  check for a full mask assuming there are only 3 entries in pc_map.

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D36217
e7d02be1 glebius Aug. 17, 2022, 6:50 p.m.
o Assert that every protosw has pr_attach.  Now this structure is
  only for socket protocols declarations and nothing else.
o Merge struct pr_usrreqs into struct protosw.  This was suggested
  in 1996 by wollman@ (see 7b187005d18ef), and later reiterated
  in 2006 by rwatson@ (see 6fbb9cf860dcd).
o Make struct domain hold a variable sized array of protosw pointers.
  For most protocols these pointers are initialized statically.
  Those domains that may have loadable protocols have spacers. IPv4
  and IPv6 have 8 spacers each (andre@ dff3237ee54ea).
o For inetsw and inet6sw leave a comment noting that many protosw
  entries very likely are dead code.
o Refactor pf_proto_[un]register() into protosw_[un]register().
o Isolate pr_*_notsupp() methods into uipc_domain.c

Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D36232
d9f6ac88 glebius Aug. 17, 2022, 6:50 p.m.
For many years only TCP debugging used them, but relatively recently
TCP DTrace probes also start to use them.  Move their declarations
into tcp_debug.h, but start including tcp_debug.h unconditionally,
so that compilation with DTrace and without TCPDEBUG is possible.
f6dc5aa3 glebius Aug. 17, 2022, 6:50 p.m.
instead of using historic PRU_ flags that are now not used by anything
rather than TCP debugging.