Commit graph

287271 commits

Author SHA1 Message Date
Mark Johnston
3e53fec002 fb: Explicitly handle errors when getting or setting a colour palette
In the VESA driver, simply ignore errors.  It is not clear to me how to
return them to userspace.

This is in preparation for annotating copyin() and related functions
with __result_use_check.

MFC after:	1 week

(cherry picked from commit ddc8576d297937a1395f47550a8f5b1fac79afc2)
2024-01-04 08:42:13 -05:00
Mark Johnston
0328de3def linux: Check for copyout errors in ioctl handlers
In preparation for annotating copyin() and friends with
__result_use_check.

Reviewed by:	dchagin
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43199

(cherry picked from commit b9924c202fc34004d4164cdc50f88d8fcef26279)
2024-01-04 08:42:13 -05:00
John Baldwin
8247b328ef riscv nexus: Sort bus_set_resource in DEVMETHOD table
(cherry picked from commit 7bf9223ca958aed45a998890f351afaae67550fe)
2024-01-03 12:48:50 -08:00
John Baldwin
c24913c904 riscv nexus: Use bus_generic_rman_*_resource
Custom activate/deactivate_resource methods are still needed to handle
IRQ resources.

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

(cherry picked from commit f8709c826be977471df5663833f291f43d93d54c)
2024-01-03 12:48:42 -08:00
John Baldwin
efdbdfa9fd aarch64 nexus: Fix a mismerge in nexus_activate_resource
Fixes:		658501d25930 aarch64 nexus: Use bus_generic_rman_*_resource
(cherry picked from commit 5622f52c98cda7df1faef11d847e04500158e107)
2024-01-03 12:48:35 -08:00
John Baldwin
25d378703a aarch64 nexus: Use bus_generic_rman_*_resource
Custom activate/deactivate_resource methods are still needed to handle
IRQ resources.

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

(cherry picked from commit 658501d25930bcf24839f3308ee1da971145c018)
2024-01-03 12:48:28 -08:00
John Baldwin
9d2b2ab93c x86 nexus: Use bus_generic_rman_*_resource
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42740

(cherry picked from commit a03a335a801246dfb95ccf35ec3f64b9fe968874)
2024-01-03 12:48:20 -08:00
John Baldwin
92991e8f8d new-bus: Disable assertions for rman mismatches for activate/deactivate
Bus drivers which use an rman to sub-divide a resource allocated from
a parent bus should handle mapping requests (and activate/deactivate
requests) for those sub-allocated resources by doing a subset mapping
of the resource allocated from the parent (and then using this to
handle activate/deactivate requests).

However, not all bus drivers which use internal rmans (such as acpi(4)
and pci_pci(4)) do that since not all nexus drivers support
bus_map/unmap.  Eventually bus drivers should be updated to do this
properly at which point these assertions can be reenabled.

Reported by:	delphij, kib

(cherry picked from commit ed88eef140a1c3d57d546f409c216806dd3da809)
2024-01-03 12:47:24 -08:00
John Baldwin
0c7aa9afb1 new-bus: Add comments for resource_*_map_request*
Requested by:	mhorne

(cherry picked from commit 46971d38de334a9418e2b66b37cea7d051b6731a)
2024-01-03 12:47:18 -08:00
John Baldwin
0962b9d086 newbus: Add a set of bus resource helpers for nexus-like devices
These routines can be used to implement
bus_alloc/adjust/activate/deactive/release_resource on bus drivers
which suballocate resources from rman(9) resource managers.

These methods require a new bus_get_rman method in the bus driver to
return the suitable rman for a given resource type.  The
activate/deactivate helpers also require the bus to implement the
bus_map/ummap_resource methods.

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

(cherry picked from commit 751615c538446ea0384f8faa9cb2508670c3799a)
2024-01-03 12:47:08 -08:00
John Baldwin
a6d562d415 new-bus: Add a comment for bus_generic_get_domain
(cherry picked from commit 00b3cde596dd3945d56aa12f2a4957b2910e1ee3)
2024-01-03 12:47:02 -08:00
John Baldwin
cb2ef37bef etc/mtree: Remove entry for /usr/tests/usr.sbin/mixer
These were removed when the new mixer(3) library was imported, and I
missed updating the mtree file when I added the entries to
ObsoleteFiles.inc.

Fixes:		903873ce15 Implement and use new mixer(3) library for FreeBSD.
(cherry picked from commit 7aa3bf6952b2c7d1b02d3a67e7f51b96fcf52b50)
2024-01-03 12:34:50 -08:00
John Baldwin
dfa6fdec56 ehci_ps3: Remove unused struct definition.
(cherry picked from commit 3578000a6f505148c5e0ecf5be9d644ed07a81bc)
2024-01-03 12:34:35 -08:00
John Baldwin
19cfade3f3 arm64/riscv nexus: Implement bus_unmap_resource
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42725

(cherry picked from commit 71cfd330fc008187ff41db795ae5e6372bf802ab)
2024-01-03 12:34:28 -08:00
John Baldwin
3125b3e82c nexus: Use resource_validate_map_request
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42724

(cherry picked from commit b887b665ebc044f246d261e8af543765b846ed38)
2024-01-03 12:34:20 -08:00
John Baldwin
d9c1d04ad5 new-bus: Add resource_validate_map_request function
This helper function for BUS_MAP_RESOURCE performs common argument
validation.

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

(cherry picked from commit 19f073c612afa0111d216e5ccab9525bfc97ec32)
2024-01-03 12:34:11 -08:00
John Baldwin
30ead05708 arm64/amd64/riscv nexus: Use bus_generic_rl_*
Reviewed by:	mhorne, imp
Differential Revision:	https://reviews.freebsd.org/D42716

(cherry picked from commit ecf2106c0701e522b8c643f8ea37550b3e58ba57)
2024-01-03 12:33:59 -08:00
John Baldwin
a4c3fdf96d gpiobus: Use bus_generic_rl_* methods
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42715

(cherry picked from commit a19ed3495d5556281ea39995d962b93a637183f0)
2024-01-03 12:33:51 -08:00
John Baldwin
bbfd697602 bsdinstall.8: Clarify the description of ZFSBOOT_FORCE_4K_SECTORS
This variable does not set the exact sector size of the pool, but
controls the minimum sector size.  The sector size of the underlying
disks can always be larger than the minium controlled by this knob.

PR:		274513
Reported by:	Albin "a12l" Otterhäll <bugs.freebsd.org@a12l.xyz>

(cherry picked from commit 84f773037ee4fc78585501a2ce2f5398f0bae9f4)
2024-01-03 12:18:56 -08:00
John Baldwin
904ebc903c bsdinstall zfsboot: Don't override ZFSBOOT_FORCE_4K_SECTORS if it is null.
Only set a default value of 1 if the shell variable is unset.  This allows
installer scripts to disable the variable.

PR:		274513
Reported by:	Albin "a12l" Otterhäll <bugs.freebsd.org@a12l.xyz>
Differential Revision:	https://reviews.freebsd.org/D42319

(cherry picked from commit de82aed1192470574a08d3e479d81c4c1280487a)
2024-01-03 12:18:50 -08:00
John Baldwin
b636e35bb7 vfs mount: Consistently use ENODEV internally for an invalid fstype
Change vfs_byname_kld to always return an error value of ENODEV to
indicate an unsupported fstype leaving ENOENT to indicate errors such
as a missing mount point or invalid path.  This allows nmount(2) to
better distinguish these cases and avoid treating a missing device
node as an invalid fstype after commit 6e8272f317.

While here, change mount(2) to return EINVAL instead of ENODEV for an
invalid fstype to match nmount(2).

PR:		274600
Reviewed by:	pstef, markj
Differential Revision:	https://reviews.freebsd.org/D42327

(cherry picked from commit 3eed4803f943e2937325e81140b88e2e8eea8deb)
2024-01-03 12:18:44 -08:00
John Baldwin
dbeb3fd25d Cirrus CI: Add manual jobs for amd64 and aarch64 using GCC 13
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D42840

(cherry picked from commit 9101746a6cce90314ad03c7ff06398a5f68d0cc7)
2024-01-03 09:50:29 -08:00
John Baldwin
bf63f0e7e3 qlnx: Fix a couple of type mismatches in function declarations
Reported by:	GCC 13 via -Wenum-int-mismatch
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D42586

(cherry picked from commit be909a79a8e2506b49ed81f9bd8115512dd613a4)
2024-01-03 09:43:48 -08:00
John Baldwin
fd3190c2da sys: Disable -Walloc-size-larger-than for GCC 9+
By default this warns about sizes larger than PTRDIFF_MAX passed to
malloc (rather than SIZE_MAX).  This doesn't trigger
deterministically, but it does trigger for kmalloc() of struct_size()
in iwlwifi's iwl_configure_rxq even when struct_size() is changed to
use PTRDIFF_MAX.  NB: struct_size() in Linux caps the size at
SIZE_MAX, not PTRDIFF_MAX via size_mul().

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

(cherry picked from commit ede077bf2a259c23923d1ab1231dc8c4577e6672)
2024-01-03 09:43:48 -08:00
John Baldwin
df8d325b8d ocs: Fix a couple of type mismatches in function prototypes
Reported by:	GCC 13 via -Wenum-int-mismatch
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D42585

(cherry picked from commit 7aa5b2a9e7f5f3cd33e72cb1e95790fe7637f10f)
2024-01-03 09:43:48 -08:00
John Baldwin
6a1b9033d8 ath_hal: Fix a couple of type mismatches in function prototypes
Reported by:	GCC 13 via -Wenum-int-mismatch
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D42584

(cherry picked from commit 1e65df68403acac2231dda161fd12e62f888a031)
2024-01-03 09:43:48 -08:00
John Baldwin
2012748bd7 pkg: Allocate a suitably-sized string for the local ABI
Previously the local ABI string was written to an on-stack buffer and
the pointer to that buffer was saved in a global before the function
returned.  This had two issues: c[ABI].val pointed to a
no-longer-valid on-stack buffer after config_init returned, and the
string could potentially be truncated.  Fix both of those by changing
pkg_get_myabi to return a pointer to a string allocated by asprintf.

Note that the allocated string is left in the global config array
until it is implicitly freed on process exit.

Reported by:	GCC 13 -Wdangling-pointer
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D42623

(cherry picked from commit fd9ae9ac04edf9acef4a2ffbf663698a2b8e7ced)
2024-01-03 09:43:48 -08:00
John Baldwin
1d49143073 snmp_wlan: Fix a couple of type mismatches in function prototypes
Reported by:	GCC 13 via -Wenum-int-mismatch
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D42582

(cherry picked from commit cc61bf9eccd46592704f3e7bc189c94ccae8f524)
2024-01-03 09:43:48 -08:00
John Baldwin
23cd7dfee4 makefs: Quiet a -Wdangling-pointer warning in cd9660_generate_path_table
This function temporarily stores a pointer to an on-stack variable (a
TAILQ_HEAD of a temporary list) into a global variable (*n).

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

(cherry picked from commit 5fc8ed9313609fbafe505deaea253e6bde5ac165)
2024-01-03 09:43:48 -08:00
John Baldwin
3a54d200ae makefs cd9660: Unexpand a few TAILQ macros
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D42580

(cherry picked from commit c06962057bedb3f1ed8c3560c1d1147dbf04ba68)
2024-01-03 09:43:48 -08:00
John Baldwin
c2d4e8d4e9 bsd.sys.mk: Disable -Wdangling-reference for GCC 13+
GCC raises this warning for libc++'s istream.  It raises false
positives in other cases as well (GCC bugs 109640, 109642, 109671).

Warning from <istream>:

/usr/include/c++/v1/istream:1464:34: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
 1464 |             const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
      |                                  ^~~~
/usr/include/c++/v1/istream:1464:71: note: the temporary was destroyed at the end of the full expression 'std::__1::use_facet<ctype<char> >(std::__1::ios_base::getloc() const())'
 1464 |             const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D42579

(cherry picked from commit 28fc837b70372a1a99c28ef4f74325bce711960a)
2024-01-03 09:43:48 -08:00
John Baldwin
f7180e5d69 libgpio: Fix type mismatch for gpio_pin_[gs]et
Reported by:	GCC 13 via -Wenum-int-mismatch
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D42577

(cherry picked from commit 0355ecace82cce8322e5fcdf48f751d253792ce3)
2024-01-03 09:43:48 -08:00
John Baldwin
1dcd996104 libcasper: Neuter false positive -Wuse-after-free warnings from GCC 13
GCC 13 incorrectly thinks a call to free after a failed realloc is a
use after free.

lib/libcasper/services/cap_grp/cap_grp.c: In function 'group_resize':
lib/libcasper/services/cap_grp/cap_grp.c:65:17: error: pointer 'buf' may be used after 'realloc' [-Werror=use-after-free]
   65 |                 free(buf);
      |                 ^~~~~~~~~
lib/libcasper/services/cap_grp/cap_grp.c:63:19: note: call to 'realloc' here
   63 |         gbuffer = realloc(buf, gbufsize);
      |                   ^~~~~~~~~~~~~~~~~~~~~~

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D42576

(cherry picked from commit b7f7cc25c01aeacaafb86ebcffdeb258b7933b08)
2024-01-03 09:43:47 -08:00
John Baldwin
415aab2abb Merge commit 3537338d1ab9 from llvm git (by Nikolas Klauser):
[libc++][libunwind] Fixes to allow GCC 13 to compile libunwind/libc++abi/libc++

    These are changes to allow GCC 13 to successfully compile the runtimes stack.

    Reviewed By: ldionne, #libc, #libunwind, MaskRay

    Spies: MaskRay, zibi, SeanP, power-llvm-team, mstorsjo, arichardson, libcxx-commits

    Differential Revision: https://reviews.llvm.org/D151387

Reviewed by:	imp, dim, emaste
Differential Revision:	https://reviews.freebsd.org/D42578

(cherry picked from commit ab43851b0c7bd5f21ade72c3cae3d3ee09eb8891)
2024-01-03 09:43:47 -08:00
Kenneth D. Merry
ce6c84abe6 camcontrol: add support for Toshiba drive firmware update
Thanks to Toshiba for providing the SCSI spec for their latest
generation drives so I could confirm how they operate.

The firmware download works in a pretty standard way, so this
is a straightforward table addition.

sbin/camcontrol/camcontrol.8:
	Document that Toshiba drives are supported for fwdownload,
	and that it was tested on TOSHIBA MG10SFA22TE 22TB drives.

sbin/camcontrol/fwdownload.c:
	Add TOSHIBA to the known SCSI vendors list for fwdownload.

Sponsored by:	Spectra Logic

(cherry picked from commit cd95f18c477ca30c3ba6f98577d321f56b1e8439)
2024-01-03 10:33:12 -05:00
Kenneth D. Merry
31a363933e camcontrol: Add a sense subcommand
As the name suggests, this sends a SCSI REQUEST SENSE to a device,
and prints out decoded sense information.  It can also print out a
hexdump of the sense data.

sbin/camcontrol/camcontrol.c:
	Add the new sense subcommand.

sbin/camcontrol/camcontrol.8:
	Document camcontrol sense.

Sponsored by:	Spectra Logic
Reviewed by:	mav
Differential Revision:  https://reviews.freebsd.org/D43225

(cherry picked from commit 40a492d38ee10ecf9d9a099c5cdecc072e24d2d1)
2024-01-03 09:47:12 -05:00
Kyle Evans
bcfe05c6b6 calendar: correct the search order for files
Include files that don't begin with a '/' are documented to search the
current directory, then /usr/share/calendar.  This hasn't been accurate
for years, since e061f95e7b ("Rework calendar(1) parser") rewrote a
lot of this.

Stash off the cwd before we do any chdir()ing around and use that to
honor the same order we'll follow for the -f flag.  This may result in
an extra lookup that will fail for the initial calendar file, but I
don't think it's worth the complexity to avoid it.

While we're here, fix the documentation to just reference the order
described in FILES so that we only need to keep it up to date in one
place.

Reviewed by:	bapt
Sponsored by:	Klara, Inc.

(cherry picked from commit 0a82cd4f101c5eb8533a0049aaa3f06f005cf8af)
2024-01-02 22:47:22 -06:00
Kyle Evans
15b946de99 loader: lua: remove the default kernel if it doesn't exist
The `kernel` env var provides the default kernel, usually "kernel".  It
may be the case that the user doesn't have a "kernel" kernel, just
"kernel.*" kernels, but have left `kernel` to the default because we
autodetect entries by default anyways.

If we're doing autodetection, take note of whether the default kernel
exists or not and remove it from the list if it doesn't and we had found
any other kernels.  We avoid it in the #kernels == 1 case because
something fishy has likely happened and we should just trust the
configuration.

Reviewed by:	imp, manu

(cherry picked from commit d04415c520b031fb8eb93cb252e4acee66149c87)
2024-01-02 22:47:21 -06:00
Kyle Evans
346112fe3d kdump: use print_mask_arg0 appropriately
Some callers are using print_mask_arg() when they should be using
print_mask_arg0(); the latter should be used when all flags are optional
and there's not a flag to be decoded with a 0-mask.  This turns:

nmount(0x6991e009000,0x8,0<><invalid>0)

into:

nmount(0x6991e009000,0x8,0)

Reviewed by:	jhb

(cherry picked from commit a206524709bdfbd577bcfe76676da80b8250f84c)
2024-01-02 22:47:21 -06:00
Kyle Evans
566ac8bc76 loader: provide a features table for binary compatibility advertisement
liblua now provides a loader.has_feature() function to probe the loader
binary for features advertised.  name => desc mappings are provided in
loader.features to get a list of all of the features loader *can*
support.  core.hasFeature is provided as a shim to loader.has_feature
so that individual consumers don't need to think about the logic of the
loader module not providing has_feature; we know that means the feature
isn't enabled.

The first consumer of this will be EARLY_ACPI to advertise that the
loader binary probes for ACPI presence before the interpreter has
started, so that we know whether we can trust the presence of acpi.rsdp
as relatively authoritative.  In general, it's intended to be used to
avoid breaking new scripts on older loaders within reason.

This will be used in lua as `core.hasFeature("EARLY_ACPI")`, while the
C bits of loader will `feature_enable(FEATURE_EARLY_ACPI)`.

Reviewed by:	imp

(cherry picked from commit 1631382cf2820245cc72965498ff174bb548dd63)
2024-01-02 22:47:21 -06:00
Alexander Motin
78c98588c9 nvme: Add some bits from NVMe 2.0c spec.
MFC after:	1 week

(cherry picked from commit b46c7b1ed4e5307c689df72ea8a0b69e02456905)
2024-01-02 20:40:31 -05:00
Alexander Motin
5791b17844 stand/zfs: Remove one more read-compatible feature
This feature is marked as ZFEATURE_FLAG_READONLY_COMPAT and so
irrelevant for read-only pool imports by the loader:

	"com.delphix:spacemap_v2"

This should cause no functional changes, just a code cleanup.

I'm sorry, missed it in previous commit.

MFC after:	2 months

(cherry picked from commit c2588f5e066bbeb37e6bbdd5faf14320c60c1cbd)
2024-01-02 20:37:34 -05:00
Alexander Motin
78e1cf110e stand/zfs: Remove read-compatible features
These features are marked as ZFEATURE_FLAG_READONLY_COMPAT and so
irrelevant for read-only pool imports by the loader:

	"com.datto:resilver_defer",
	"com.delphix:obsolete_counts",
	"com.delphix:spacemap_histogram",
	"com.delphix:zpool_checkpoint",
	"com.intel:allocation_classes",
	"org.zfsonlinux:allocation_classes"

This should cause no functional changes, just a code cleanup.

MFC after:	2 months

(cherry picked from commit 939a62d673e6c340ee2b7243074a529919e39196)
2024-01-02 20:37:34 -05:00
Rick Macklem
2f3ff6fe1a 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

(cherry picked from commit 2319ca6a01816f7fc85d623097c639f239e18c6a)
2024-01-02 17:22:26 -08:00
John Baldwin
e74b03451f abort2: Generate a core dump
Call sigexit rather than exit1 so that a core is generated.

If running the SIGABRT handler is desired, this would need to use
kern_psignal() instead.  In that case a userspace wrapper in libc
would be needed to force an exit if the handler doesn't exit.  Given
that abort2(2)'s intended use case is when userland is in a
sufficiently bad state such that it can't safely call syslog(3) before
abort(3), a userspace abort2(3) wrapper in libc might be dubious.

Reviewed by:	Olivier Certner <olce.freebsd@certner.fr>, emaste
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42163

(cherry picked from commit 9b57e30cf5b6036263a1a2551df8574571c6f5a4)
2024-01-02 11:20:37 -08:00
John Baldwin
8ff950573c bsdinstall partedit: Use snprintf instead of sprintf for error messages
When generating a message for a dialog box into a static buffer, use
snprintf instead of sprintf to avoid buffer overflows.

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

(cherry picked from commit 6e8bf24073a1867c4b21bd84438a8b01ce91d82d)
2024-01-02 11:20:37 -08:00
John Baldwin
10415f6341 bsdinstall partedit: Use asprintf to build wrapper command for newfs
Don't abuse the message[] static buffer used elsewhere for error
messages to generate the command that actually newfs's each
filesystem.  Use asprintf to a more aptly-named 'char *command'
variable to construct the string instead.  This avoids potential bugs
from truncation of the command string.

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

(cherry picked from commit a8676bf367b099dcc97ff61031cbf4ceb5e37899)
2024-01-02 11:20:37 -08:00
John Baldwin
bb049096be bsdinstall partedit: Replace malloc + sprintf with asprintf
This avoids potential bugs with the length passed to malloc not
matching the string written via sprintf.

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

(cherry picked from commit 51749e05e96eb07134a38984a8c06608b20f07ea)
2024-01-02 11:20:37 -08:00
John Baldwin
89806d373a bsdinstall partedit: Avoid potential buffer overflow in newfs_command
Allocate the buffer holding the newfs command string dynamically
(building the string via open_memstream) rather than storing the
command into a caller-supplied buffer of unknown length.

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

(cherry picked from commit ae2fc74fe76ca8b89c5ef0081ef3f4008f83de41)
2024-01-02 11:20:37 -08:00
John Baldwin
950162c4d3 ctl: Use ctl_io_sbuf in ctl_process_done
This reduces a second copy of (mostly) the same code.

Reviewed by:	ken, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D42210

(cherry picked from commit e846a3e0168f9188a6eccedd52707c63fd83cba2)
2024-01-02 11:20:37 -08:00