Commit Graph

288573 Commits

Author SHA1 Message Date
Ricardo Branco e23954bd42 hexdump: Do not trust st_size if it equals zero.
Fix for hexdump -s not being able to skip files residing in
pseudo-filesystems that advertise a zero size value.

Historically, many pseudofs-based filesystems (e.g., procfs) report
a va_size of 0 for numerous files classified as regular files.
Typically, the contents of these files are generated on demand
from kernel data as sbuf(9) strings at the time they are read.
Accurately reporting the size of these files is challenging, as it
often involves generating their contents. These pseudofs implementations
frequently report the size as 0. This is a historical behavior and also
aligns with Linux behavior. To maintain compatibility, we have chosen
to preserve the existing behavior and address it in the userland
application, rather than modifying it in the kernel (by updating the
correct value for va_size).

PR:		bin/276106
MFC after:	1 week
2024-01-04 00:16:50 -08:00
Kyle Evans 67082f077f bhyveload: fix non -l use
explicit_loader_fd should have been initialized to -1, not 0, but my
last round of testing was only with -l...

Fixes:	bf7c4fcbbb ("bhyveload: hold /boot and do relative [...]")
Pointy hat:	kevans
2024-01-03 19:36:06 -06:00
Kyle Evans 8bf0882e18 bhyveload: enter capability mode after we setup the vcpu
Reviewed by:	allanjude (earlier version), emaste, markj
Differential Revision:	https://reviews.freebsd.org/D43286
2024-01-03 16:19:15 -06:00
Kyle Evans bf7c4fcbbb bhyveload: hold /boot and do relative lookups for the loader
The next change will push bhyveload into capability mode right after we
allocate vcpu state, before we've setup or entered the loader, to limit
the surface area that a rogue loader script can touch.

With an explicit -l loader, we don't need to preopen /boot because
changing interpreters isn't allowed.  We'll just dlopen() entirely in
advance in that case to eliminate some complexity.

Reviewed by:	allanjude (earlier version), markj
Differential Revision:	https://reviews.freebsd.org/D43285
2024-01-03 16:19:15 -06:00
Kyle Evans 6779d44bd8 bhyveload: use a dirfd to support -h
Don't allow lookups from the loader scripts, which in rare cases may be
in guest control depending on the setup, to leave the specified host
root.  Open the root dir and strictly do RESOLVE_BENEATH lookups from
there.

cb_open() has been restructured a bit to work nicely with this, using
fdopendir() in the directory case and just using the fd we already
opened in the regular file case.

hostbase_open() was split out to provide an obvious place to apply
rights(4) if that's something we care to do.

Reviewed by:	allanjude (earlier version), markj
Differential Revision:	https://reviews.freebsd.org/D43284
2024-01-03 16:19:15 -06:00
Mark Johnston ee7d5ba1b5 setfib.2: Consistently capitalize "FIB"
MFC after:	1 week
Sponsored by:	Klara, Inc.
2024-01-03 16:24:56 -05:00
Navdeep Parhar 0201eb29dd cxgbe(4): Fix virtual interface reattach.
Replace the DOOMED flag with a transient DETACHING flag that is cleared
when VI is detached.  This fixes VI reattach when only the VI and not
the parent nexus is detached.  The old flag was never cleared and
prevented subsequent synch op's related to the VI.

PR:		275260
Reviewed by:	jhb
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43287
Sponsored by:	Chelsio Communications
2024-01-03 11:21:46 -08:00
Warner Losh 2c5dcc5447 make_check: Deobit fmake support
We don't need make_check to work in a fmake world anymore (nor have we
in the past decade). Just remove it here.

Note in passing it's been 10 years since we've added a new test here and
maybe we're past the need for this part of the build (or need to revamp
it to include all the features added to bmake since 2016 that the build
system silently depends on).

Sponsored by:		Netflix
Reviewed by: brooks
Pull Request: https://github.com/freebsd/freebsd-src/pull/980
2024-01-03 12:14:17 -07:00
Warner Losh 55197eade4 sys.mk: Remove support for building with fmake on modern systems.
We used to exclude a lot of extra hooks to allow for local
customizations of the build which couldn't be done outside of sys.mk,
but excluded that support for fmake. Remove those hacks.

Sponsored by:		Netflix
Reviewed by: brooks
Pull Request: https://github.com/freebsd/freebsd-src/pull/980
2024-01-03 12:14:13 -07:00
Warner Losh 5a4b548ab2 bsd.port.mk: No need to support fmake anymore
There's no need to support fmake anymore. Always assume we can use
bmake's :tA modifier. The ports tree hasn't supported fmake in about a
decade anyway. Simplify here.

Sponsored by:		Netflix
Reviewed by: brooks, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/980
2024-01-03 12:14:07 -07:00
Warner Losh 01918855cf bsd.own.mk: Assume a modern make
Commit 83cb5bae96 added a check for MAKE_VERSION being new enough to
handle CTFCONVERT_CMD being an empty string since fmake of the time
didn't support it until just a few commits before 83cb5bae96. Later,
it was augmented with a check for .PARSEDIR to see if bmake was
running. fmake and boostrapping from fmake haven't worked in maybe 6 or
8 years, so we can remove the check here. If you want to update from
your FreeBSD 7 or FreeBSD 8 systems, you're even more out of luck than
you were before and must jump to an older version before jumping to
current for the source upgrade path.

Sponsored by:		Netflix
Reviewed by: brooks, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/980
2024-01-03 12:13:57 -07:00
Warner Losh 883a1b00fd Makefile: Deorbit fmake support
fmake has been out of the tree for 10 years / 5 major releases now. The
need to bootstrap from it has been gone for at least 6 if not 8
years. While we may still need to bootstrap bmake, we don't need to do
it from fmake, so only retail the infrastructure to update from bmake to
bmake. Retain, for now, the WANT_MAKE_VERSION stuff, though we're always
up to date when building from supported and quasi-supported platforms.

Also remove all the checks to see if .PARSEDIR is defined. It is always
defined and was an early, fail-safe way to tell fmake from bmake during
the transition.

Adjust comments that refer to old fmake and remove those no longer
relevant.

Sponsored by:		Netflix
Reviewed by: brooks
Pull Request: https://github.com/freebsd/freebsd-src/pull/980
2024-01-03 12:13:26 -07:00
rilysh 4d8d9111a4 bin/timeout: remove unreachable break after usage()
Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/872
2024-01-03 12:05:50 -07:00
rilysh 8312a902f9 bin/setfacl: remove unreachable break after usage()
Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/872
2024-01-03 12:05:50 -07:00
rilysh e9910377a7 bin/cp: remove unreachable break
Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/872
2024-01-03 12:05:50 -07:00
Ed Maste c3786ca8bc capsicum(4): add cross-ref to capsicum_helpers(3)
Sponsored by:	The FreeBSD Foundation
2024-01-03 13:37:06 -05:00
Jose Luis Duran 8aafae6639 traceroute: Implement ECN bleaching detection
Explicit Congestion Notification (ECN) is a mechanism that allows
end-to-end notification of network congestion without dropping packets
by explicitly setting the ECN code point (2 bits).

Per RFC 8087, section 3.5, network devices should not be configured to
change the ECN code point in the packets that they forward, except to
set the CE (Congestion Experienced) code point ('11') to signal
incipient congestion.

The current commit adds an -E flag to traceroute that crafts a packet
with an ECT(1) code point ('01').

If the packet is received back with a zero ECN code point ('00'), it
outputs that the hop in question erases or "bleaches" the ECN code point
values.  Bleaching may occur for various reasons (including normalizing
packets to hide which equipment supports ECN).  This policy prevents the
use of ECN by applications.

If the packet is received back with an all-ones ECN code point ('11'),
it outputs that the hop in question is experiencing "congestion".

If the packet is received back with a different ECN code point ('10'),
it outputs that the hop in question changes or "mangles" the ECN code
point values.

If the packet is received with the same ECN code point that was sent
('01'), it outputs that the hop has "passed" the ECN bits appropriately.

Inspired by:	Darwin
Reviewed by:	imp, markj
MFC after:	1 month
Pull Request:	https://github.com/freebsd/freebsd-src/pull/879
2024-01-03 12:57:54 -05:00
Jose Luis Duran 0c2218d1d5 traceroute6: Implement ECN bleaching detection
Explicit Congestion Notification (ECN) is a mechanism that allows
end-to-end notification of network congestion without dropping packets
by explicitly setting the ECN code point (2 bits).

Per RFC 8087, section 3.5, network devices should not be configured to
change the ECN code point in the packets that they forward, except to
set the CE (Congestion Experienced) code point ('11') to signal
incipient congestion.

The current commit adds an -E flag to traceroute6 that crafts a packet
with an ECT(1) code point ('01').

If the packet is received back with a zero ECN code point ('00'), it
outputs that the hop in question erases or "bleaches" the ECN code point
values.  Bleaching may occur for various reasons (including normalizing
packets to hide which equipment supports ECN).  This policy prevents the
use of ECN by applications.

If the packet is received back with an all-ones ECN code point ('11'),
it outputs that the hop in question is experiencing "congestion".

If the packet is received back with a different ECN code point ('10'),
it outputs that the hop in question changes or "mangles" the ECN code
point values.

If the packet is received with the same ECN code point that was sent
('01'), it outputs that the hop has "passed" the ECN bits appropriately.

Inspired by:	Darwin
Reviewed by:	imp, markj
MFC after:	1 month
Pull Request:	https://github.com/freebsd/freebsd-src/pull/879
2024-01-03 12:57:29 -05:00
Jose Luis Duran b0e13f785b netinet: Define IPv6 ECN mask
Define a mask for the code point used for ECN in the Traffic Class field
(2 bits) of an IPv6 header.

     BE:    0       0       3       0       0       0       0       0
    Bit: 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        |Version| Traffic Class |           Flow Label                  |
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        |                              ...                              |

For BE (Big Endian), or network-byte order, this corresponds to 0x00300000.
For Little Endian, it corresponds to 0x00003000.

Reviewed by:	imp, markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/879
2024-01-03 12:56:28 -05:00
Jose Luis Duran 943a9f4e47 traceroute: style(9) fixes
No functional change intended.

Reviewed by:	imp, markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/879
2024-01-03 12:56:10 -05:00
Jose Luis Duran 777e494a76 traceroute6: style(9) fixes
No functional change intended.

Reviewed by:	imp, markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/879
2024-01-03 12:54:53 -05:00
Jose Luis Duran b023e965dc traceroute: Remove the $FreeBSD$ pattern
Reviewed by:	imp, markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/879
2024-01-03 12:54:18 -05:00
Brooks Davis a9174861ea posixshm largepage_mmap: fix a racy test
You can't ever safely map a single page and then map a superpage sized
mapping over it with MAP_FIXED.  Even in a single-threaded program, ASLR
might mean you land too close to another mapping and on CheriBSD we
don't allow the initial reservation to grow because doing so requires
program changes that are hard to automate.

To avoid this, map the entire region we want to use upfront.

Reviewed by:	markj
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43282
2024-01-03 16:39:53 +00:00
Brooks Davis 85c9d36497 acl_equiv_mode_np: zero mode on just inited ACL
You can't return 0 and not write the mode if mode_p is non-NULL.  That
violates the API contract and in common usage leaves stack trash in
*mode_p.

The acl_equiv_mode_test test passed by accident.

Reviewed by:	kevans, markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43278
2024-01-03 16:34:39 +00:00
Navdeep Parhar 8b144c015c cxgbe(4): Destroy the tick mutex during VI detach.
This avoids a mutex reinitialization when the VI is detached and
reattached.

Fixes:	516fe911a6 cxgbe(4): Always use the per-VI callout to read interface stats.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-01-02 14:08:00 -08:00
Jason A. Harmening 10f2e94acc vm_page_reclaim_contig(): update comment to chase recent changes
Commit 2619c5ccfe ("Avoid waiting on physical allocations that can't
possibly be satisfied") changed the return value from bool to errno.
Adjust the function description to match reality.
2024-01-02 15:39:36 -06:00
John Baldwin 67b0b90785 i386: Always bounce DMA requests above 4G for !PAE kernels
i386 kernels without 'options PAE' will still use PAE page tables if
the CPU supports PAE both to support larger amounts of RAM and for
PG_NX permissions.  However, to avoid changing the API, bus_addr_t and
related constants (e.g. BUS_SPACE_MAXADDR) are still limited to
32 bits.

To cope with this, the x86 bus_dma code included an extra check to
bounce requests for addresses above BUS_SPACE_MAXADDR.  This check was
elided (probably because it looks always-true on its face and had no
comment explaining its purpose) in recent refactoring.  To fix,
restore a custom address-validation function for i386 kernels without
options PAE that includes this check.

Reported by:	ci.freebsd.org
Reviewed by:	markj
Fixes:		3933ff56f9 busdma: tidy bus_dma_run_filter() functions
Differential Revision:	https://reviews.freebsd.org/D43277
2024-01-02 13:15:13 -08:00
Gleb Smirnoff 025007f391 netlink: remove stale comment
Fixes:	ff5ad900d2
2024-01-02 13:09:37 -08:00
Gleb Smirnoff ff5ad900d2 netlink: refactor control data generation for recvmsg(2)
Netlink should return a very simple control data on every recvmsg(2)
syscall.  This data is associated with a syscall, not with an nlmsg,
neither with internal our internal representation (nl_bufs).  There is
no need to pre-allocate it in non-sleepable context and attach to
nl_buf.  Allocate right in the syscall with M_WAITOK.  This also
shaves lots of code and simplifies things.

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D42989
2024-01-02 13:05:46 -08:00
Gleb Smirnoff 7e19c0186f netlink: improve nl_soreceive()
The previous commit conservatively mimiced operation of soreceive_generic().
The new code does two things:
- parses Netlink message headers and always returns at least one full nlmsg
- hides nl_buf boundaries from the userland, copying out several at once
More details can be found in the large comment block added.

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D42785
2024-01-02 13:05:25 -08:00
Gleb Smirnoff 17083b94a9 netlink: use protocol specific receive buffer
Implement Netlink socket receive buffer as a simple TAILQ of nl_buf's,
same part of struct sockbuf that is used for send buffer already.
This shaves a lot of code and a lot of extra processing.  The pcb rids
of the I/O queues as the socket buffer is exactly the queue.  The
message writer is simplified a lot, as we now always deal with linear
buf.  Notion of different buffer types goes away as way as different
kinds of writers.  The only things remaining are: a socket writer and
a group writer.
The impact on the network stack is that we no longer use mbufs, so
a workaround from d187154750 disappears.

Note on message throttling.  Now the taskqueue throttling mechanism
needs to look at both socket buffers protected by their respective
locks and on flags in the pcb that are protected by the pcb lock.
There is definitely some room for optimization, but this changes tries
to preserve as much as possible.

Note on new nl_soreceive().  It emulates soreceive_generic().  It
must undergo further optimization, see large comment put in there.

Note on tests/sys/netlink/test_netlink_message_writer.py. This test
boiled down almost to nothing with mbufs removed.  However, I left
it with minimal functionality (it basically checks that allocating N
bytes we get N bytes) as it is one of not so many examples of ktest
framework that allows to test KPIs with python.

Note on Linux support. It got much simplier: Netlink message writer
loses notion of Linux support lifetime, it is same regardless of
process ABI.  On socket write from Linux process we perform
conversion immediately in nl_receive_message() and on an output
conversion to Linux happens in in nl_send_one(). XXX: both
conversions use M_NOWAIT allocation, which used to be the case
before this change, too.

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D42524
2024-01-02 13:04:01 -08:00
Gleb Smirnoff 0ad011ecec tests/netlink: add netlink socket buffer test
With upcoming protocol specific socket buffer for Netlink we need some
additional tests that cover basic socket operations, w/o much of actual
Netlink knowledge.  Following tests are performed:

1) Overflow.  If an application keeps sending messages to the kernel,
but doesn't read out the replies, then first the receive buffer shall
fill and after that further messages from applications will be queued
on the send buffer until it is filled.  After that socket operations
should block.  However, reading from the receive buffer some data should
wake up the taskqueue and the send buffer should start draining again.

2) Peek & trunc.  Check that socket correctly reports amount of readable
data with MSG_PEEK & MSG_TRUNC.  This is typical pattern of Netlink apps.

3) Sizes. Check that zero size read doesn't affect the socket, undersize
read will return one truncated message and the message is removed from
the buffer.  Check that large buffer will be filled in one read, without
any boundaries imposed by internal representation of the buffer.  Check
that any meaningful read is amended with control data if requested so.

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D42525
2024-01-02 13:03:49 -08:00
Gleb Smirnoff 67d9023f07 netlink: uninline some KPI functions that work with struct nl_writer
These functions work with a buffer embedded into nl_writer, which
is going to go opaque with upcoming changes.  Make them private to
the netlink module.  No functional change intended.

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D42523
2024-01-02 13:03:40 -08:00
Gleb Smirnoff 660bd40a59 netlink: use domain specific send buffer
Instead of using generic socket code, create Netlink specific socket
buffer.  It is a simple TAILQ of writes that came from userland.  This
saves us one memory allocation that could fail and one memory copy.

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D42522
2024-01-02 13:03:21 -08:00
Alex Richardson 30887c7d48 kldxref: fix bootstrapping on Linux with Clang 16
The glibc fts_open() callback type does not have the second const
qualifier and it appears that Clang 16 errors by default for mismatched
function pointer types. Add an ifdef to handle this case.
2024-01-02 11:06:51 -08:00
Christos Margiolis 2ee77056d2 vmrun.sh: allow device name arguments in pci-passthru option
This is more intuitive than having to run `pciconf -l` and figure out
the bus/slot/func entry manually.

Reviewed by:	markj
Sponsored by;	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43270
2024-01-02 20:20:42 +02:00
Christos Margiolis 029b10b16a vmrun.sh: add missing options in usage message
Reviewed by:	markj
Sponsored by;	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43269
2024-01-02 20:20:08 +02:00
Benedict Reuschling ffc4f93e96 Fix typos in man pages under /share/man
Found using: devel/py-proselint
2024-01-02 17:53:25 +00:00
Jose Luis Duran adc215de9c release: Add missing /var/crash ZFS dataset
This matches the layout from bsdinstall.

MFC after:	1 week
Fixes:	89585511cc ("release: Add support for creating ZFS-based VM images")
Pull Request:	https://github.com/freebsd/freebsd-src/pull/981
2024-01-02 12:51:13 -05:00
Jose Luis Duran 518a1fd7d3 makefs: Fix ZFS cross-reference sections
MFC after:	1 week
Fixes:		240afd8c1f ("makefs: Add ZFS support")
Pull Request:	https://github.com/freebsd/freebsd-src/pull/979
2024-01-02 09:20:26 -05:00
Peter Holm 1db45a4066 stress2: Handle the new output format of vmstat(8) 2024-01-02 14:43:46 +01:00
Richard Kümmel 7df9da47e8 Fix udp IPv4-mapped address
Do not use the cached route if the destination isn't the same.
This fix a problem where an UDP packet will be sent via the wrong route
and interface if a previous one was sent via them.

PR:	275774
Reviewed by:	glebius, tuexen
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2024-01-02 07:49:12 +01:00
Mark Johnston 78cd75393e ctfconvert: Handle DW_AT_data_bit_offset
This attribute is new in DWARF 4 and supersedes DW_AT_bit_offset.

PR:		276059
Reported by:	rscheff
Tested by:	rscheff
MFC after:	1 week
2024-01-01 23:12:29 -05:00
Mark Johnston c3268c23de libdtrace: Fix TCP data offset handling in the tcpinfo_t translator
The header gives an offset in 32-bit words, and the translator is
supposed to convert that to a byte count.  But, the conversion was
incorrect.

Reviewed by:	tuexen, rscheff
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43264
2024-01-01 18:03:54 -05:00
Mark Johnston 09af4bf2c9 zfs: Fix SPA sysctl handlers
sbuf_cpy() resets the sbuf state, which is wrong for sbufs allocated by
sbuf_new_for_sysctl().  In particular, this code triggers an assertion
failure in sbuf_clear().

Simplify by just using sysctl_handle_string() for both reading and
setting the tunable.

Apply to FreeBSD directly since this bug causes "sysctl -a" to crash the
kernel.

PR:		276039
Reported by:	pho
Reviewed by:	mav
Pull Request:	https://github.com/openzfs/zfs/pull/15719
2024-01-01 13:59:03 -05:00
Warner Losh 499e84e16f copyright: Bump the copyright date.
Sponsored by:		Netflix
2023-12-31 23:15:43 -07:00
Warner Losh 259e6fefc0 test-includes: Add -ansi to the compile line to catch problems
We support C89 files, but compile everything in the tree with C99 or
newer. By compiling these -ansi, that will force C89 which doesn't
understand inline. All our header files must use __inline instead of
inline when they define inline functions.

Sponsored by:		Netflix
Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D43235
2023-12-31 23:14:08 -07:00
Warner Losh 39e39ba056 nanobsd: Revert back to 1G (really 927M) partitions for rescue.
The last bump to 8G was caused by all the new symbols and debug info we
install by default. Turning those off gets us back to a reasonable size:

Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/md1s1a    927M    771M     83M    90%    /mnt

Sponsored by:		Netflix
Reviewed by:		jlduran@gmail.com
Differential Revision:	https://reviews.freebsd.org/D43232
2023-12-31 23:13:57 -07:00
Mark Johnston 91d2a093df isp: Fix endianness conversion in isp_read_flash_data()
Reported by:	Jenkins
Fixes:	10ed63fc06 ("isp(4): Rework firmware handling/loading")
2023-12-31 18:59:06 -05:00
Rick Macklem 2319ca6a01 vfs_vnops.c: Fix vn_generic_copy_file_range() for truncation
When copy_file_range(2) was first being developed,
*inoffp + len had to be <= infile_size or an error was
returned. This semantic (as defined by Linux) changed
to allow *inoffp + len to be greater than infile_size and
the copy would end at *inoffp + infile_size.

Unfortunately, the code that decided if the outfd should
be truncated in length did not get updated for this
semantics change.
As such, if a copy_file_range(2) is done, where infile_size - *inoffp
is less that outfile_size but len is large, the outfd file is truncated
when it should not be. (The semantics for this for Linux is to not
truncate outfd in this case.)

This patch fixes the problem. I believe the calculation is safe
for all non-negative values of outsize, *outoffp, *inoffp and insize,
which should be ok, since they are all guaranteed to be non-negative.

Note that this bug is not observed over NFSv4.2, since it truncates
len to infile_size - *inoffp.

PR:	276045
Reviewed by:	asomers, kib
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D43258
2023-12-31 15:55:24 -08:00