sbin/nvmecontrol: fix signedness comparison warning
sector_size is guaranteed to be non-zero here, so cast to
uint32_t to match the comparison.
This fixes the [gcc14 build in CI][0]:
/workspace/src/sbin/nvmecontrol/format.c: In function 'find_lbaf':
/workspace/src/sbin/nvmecontrol/format.c:132:60: error: comparison of integer expressions of different signedness: 'uint32_t' {aka 'unsigned int'} and 'int' [-Werror=sign-compare]
132 | if (NVMEV(NVME_NS_DATA_LBAF_LBADS, format) != lbads ||
| ^~
[0] https://ci.freebsd.org/job/FreeBSD-main-amd64-gcc14_build/5051/
Reviewed by: imp
Fixes: b991e2dd824c ("nvmecontrol: support controller-wide sector sizes")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
ipfw: fix off-by-one error in bdel()
After deleting an item from a sorted array, bdel() moves the tail
following it, but the size of the data to move was calculated with
an off-by-one error, causing memmove() to read one element past the
end of the array. This can happen when the table is full for ifidx
or numarray algorithms.
Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC
newvers.sh: Report -dirty also with staged changes
We add -dirty to the uname version string if the tree does not match the
reported hash. Previously, staged but uncommitted changes were ignored.
Noted by naddy@ in D60606.
Reviewed by: cperciva, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60722
(cherry picked from commit 617c700abae7aba74777fca137458395936f5053)
mkimg: Ignore redundant %align values
Partitions are trivially aligned to sector boundaries, so asking e.g.
for a partition to be aligned to a 64-byte boundary is pointless but
harmless. Treat it as such, with a warning (in case the request was
a mistake, e.g. requesting 1-byte instead of 1M-byte alignment) rather
than as an error.
Reviewed by: markj
Suggested by: markj
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D60819
(cherry picked from commit da04cf02c96b97c587580b336fa527392467f689)
tests/sys/vfs: use LIBADD for libutil, don't clobber LDFLAGS
"LDFLAGS= -lutil" dropped LDFLAGS from make.conf for every test in the
directory.
Approved by: glebius
Fixes: c3ac06161dd5 ("nmount: Introduce the "check_fsid" option")
Sponsored by: Netflix
vmimage.subr: Support partition alignment
If VM_PARTALIGN is set, pass %${VM_PARTALIGN} to mkimg in the
specification of swap, config, root, and ESP partitions. (Boot
partitions are not aligned, both because they're small and in
case firmware makes assumptions about their locations.)
Reviewed by: lwhsu, imp
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D60454
(cherry picked from commit f46269aba8a0bc2b60a0305bdafd8dfb42e0bb88)
mkimg: Don't ignore invalid partition offsets
When handling PART_KIND_FILE, the "error" variable is set to reflect
any errors in parsing the specified offset; but that value is then
overwritten by the return value of image_copyin.
Error out immediately instead. Note that it is not necessary to change
the code in PART_KIND_SIZE which parses the size, since in that case we
do not overwrite the value in "error".
Fixes: 8f3c71c85e5f ("mkimg: Add support for offset if the source is an image")
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D60422
(cherry picked from commit e7f84fe6cfac2de3471e4912b1ac82023976ccfa)
mkimg: Add per-partition alignment
This adds a "%align" field to partition specifications, resulting in
the start of a partition being shifted to the next aligned position.
When both :offset and %align are used, a relative offset is treated as
a minimum value, while an unaligned absolute offset is an error.
Reviewed by: imp (earlier version)
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D60450
(cherry picked from commit 729883c93e7fd89a4b88e8b9a7ef42938a431efa)
mkimg: Restore offset support for the SIZE partition form
Commit 50c1240ebfaf moved the offset parsing into the PART_KIND_FILE case of
the switch, leaving PART_KIND_SIZE with no offset handling.
The offset was then silently ignored, so "-p efi::$size:$start" as used by
release/${ARCH}/mkisoimages.sh packed the ESP immediately after the preceding
partition.
Parse the offset outside the switch so both forms honour it.
Add tests covering absolute and relative offsets in both forms.
Reviewed by: jrtc27, bsdimp, jlduran
Approved by: jlduran, bsdimp
Sponsored by: Netflix
Assisted-by: Claude Code (Opus 5)
(cherry picked from commit 61c27edf3e00ead2bde9669c5917cb1fb32e19db)
mkimg: Fix parsing of filenames containing colons
When using PART_KIND_FILE (-p type:=filename), mkimg uses a colon
to separate an optional offset (e.g., filename:offset).
strsep() was being used to split the string at the first colon.
This caused failures when the filename itself contained a colon
(e.g., "th:is").
This patch uses stat() to check if the entire string exists as a
file. If so, use it directly without splitting.
If the full string is not a valid file, fall back to splitting
at the right-most colon using strrchr().
Uses errc() to fail and exit immediately when an existing directory
is input instead of a file in PART_KIND_FILE mode.
PR: 257960
[4 lines not shown]
build: Support got
Add code for using got(1), matching how git(1) is currently used:
1. Determining the git branch,
2. Determining the checked-out hash,
3. Determining the commit count,
4. Determining the timestamp of the most recent commit,
5. Determining if the tree is "dirty",
6. Generating lists of files for the src and src-sys packages, and
7. Excluding .got directories from src.txz and ports.txz.
The release engineer hopes to use this functionality in release builds,
since got's minimalism makes it a far more manageable build tool than
git.
Reviewed by: naddy
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D60606
[2 lines not shown]
libthr/thr_mutex.c: make mutex asserts more useful
Print the file and line number of the caller where the assert fired.
Use _thread_exitf() directly for this.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
usr.bin/man: allow man(1) to search translated manpages in pure $man_lang subdirectory (+)
Currently our man(1) utility search manages only in $lang_country.$charset, $lang.$charset and,
as failover, in en.$charset which is historical behavior.
But nowadays most of ported software uses only $lang subdirectories for translated manpages
instead of use full locale notation, for example, share/ja/man1, share/de/man1, share/ru/man1.
In such cases, our man(1) utility cannot find any translated manpages and silently fallback to english version.
Add $man_lang in search path allows man(1) search and use translated manpages under historical and modern path traditions
MFC after: 1 day
MFC to: stable/15 stable/14
Reviewed by: ziaee, fernape
Approved by: fernape
Differential Revision: https://reviews.freebsd.org/D55805
(cherry picked from commit 5250c98908482babae8379b4dede10c64e8639ae)
usr.bin/man: allow man(1) to search translated manpages in pure $man_lang subdirectory (+)
Currently our man(1) utility search manages only in $lang_country.$charset, $lang.$charset and,
as failover, in en.$charset which is historical behavior.
But nowadays most of ported software uses only $lang subdirectories for translated manpages
instead of use full locale notation, for example, share/ja/man1, share/de/man1, share/ru/man1.
In such cases, our man(1) utility cannot find any translated manpages and silently fallback to english version.
Add $man_lang in search path allows man(1) search and use translated manpages under historical and modern path traditions
MFC after: 1 day
MFC to: stable/15 stable/14
Reviewed by: ziaee, fernape
Approved by: fernape
Differential Revision: https://reviews.freebsd.org/D55805
(cherry picked from commit 5250c98908482babae8379b4dede10c64e8639ae)
ipfw: declare the ipfw_nat module
The module declaration is necessary for 'kldstat -m' to see it,
and the rc(8) uses that to detect presence of ipfw_nat.
NB: the module(9) KPI lacks a way to declare a module without
providing an empty handler and no SYSINITs.
Reported by: ambrisko
Fixes: 9bcc1e97dda8e926483b81874884211bbe4f36e9
arm64: a local TLB invalidation suffices when enabling write access
When a PTE logically supports write access, as indicated by its DBM
field, but write access is nonetheless blocked by the PTE's protection
field, pmap_fault() can enable write access with only a local TLB
invalidation.
(cherry picked from commit 7dd9a8125f70f1fc40fd9907bdaae0d23c8586c9)
tests/pf/igmp: fix attribute error with newer versions of scapy
This fixes the flaky testcase in CI[0].
While here:
* fix a typo in a comment
* remove an unnecessary import
* fix this deprecation warning:
/usr/local/lib/python3.12/site-packages/scapy/contrib/igmp.py:12:
DeprecationWarning: scapy.contrib.igmp is deprecated. Please use
scapy.layers.igmp instead !
[0] https://ci.freebsd.org/job/FreeBSD-main-amd64-test/29813/testReport/junit/sys.netpfil.pf.igmp/py/TestIGMP__test_ip_opts/
Reviewed by: kp
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
amd64: Make the SYSENTER and INTn action same as for IDT case.
Fixes: 6e93f5e4d693 ("amd64: FRED support")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
amd64: do not pass SYSENTER frame to FRED fast syscall handler
With FRED, SYSCALL is delivered as event type syscall (7) and vector 1.
SYSENTER is syscall with vector 2. Handle SYSENTER in slow path,
otherwise 32bit code is able to execute 64bit syscalls.
Also check that SYSCALL comes from the 64bit mode. Intel already
specifies that SYSCALL causes #UD in compatibility mode, but there is no
AMD specification for SYSCALL under FRED yet, and SYSCALL is allowed
in compatibility mode on AMD with IDT event delivery.
Fixes: 6e93f5e4d693 ("amd64: FRED support")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week