mca_log: add missing breaks when handling thresholds
Per the "Intel® 64 and IA-32 Architectures Software Developer’s Manual
Combined Volumes: Vol. 3B 17-7", the Green and Yellow threshold
indicators are mutually exclusive. Add the missing `break` statements so
they're treated that way.
MFC after: 1 week
Reported by: Coverity
Differential Revision: https://reviews.freebsd.org/D48722
netlink: consistently use unsigned types in the parser
Use uint32_t for anything that is derived from message length, use
uint16_t for anything that represents attribute length and use u_int for
array indices.
netlink/route: fix nlattr_get_multipath() to check length
of supplied nexthop sub-attributes. While here, use unsigned types for
length calculations and improve style(9).
PR: 283860
iwmbtfw(8): fix getopt flags, unify usage()/manual page contents
Seems like there was an intention to use command line switches
-m, -p and -v (each with argument), but there is no handling
for them.
Also, some enhancements to the usage()/manpage:
- use FreeBSD manpage style -- square brackets -- for denoting
optional arguments in usage();
- show default directory path in usage();
- update manual: -f is the optional flag;
- show descriptions for -I/-D together: they are logically related.
Signed-off-by: Eygene Ryabinkin <rea at FreeBSD.org>
Reviewed by: wulf
MFC after: 1 month
iwmbtfw(8): don't program hardware without existing firmware image
One should not start firmware update sequence just to understand
that there is no firmware image to program: update sequence for 7260
requires leaving manufacturing mode and in the case of missing
firmware file it will trigger complete re-initialization of BT adapter.
Which, in turn, will make the USB device to go away and reappear.
Since devd(8) has hooks for USB device attachment, in the case
of missing firmware it used to
- trigger the (failing) firmware download,
- which triggers device reset,
- which creates USB notification and devd(8) kicks back in.
Nice infinite cycle with many notifications via syslog:
{{{
Jan 3 09:00:01 kernel: ugen0.2: <vendor 0x8087 product 0x0a2a> at usbus0
Jan 3 09:00:01 kernel: ugen0.2: <vendor 0x8087 product 0x0a2a> at usbus0 (disconnected)
Jan 3 09:00:02 kernel: ugen0.2: <vendor 0x8087 product 0x0a2a> at usbus0
[6 lines not shown]
Refactor iwmbtfw: set default firmware_dir after argument parsing
Don't repeat firmware_dir stanza at all "if" branches: be more DRY.
Signed-off-by: Eygene Ryabinkin <rea at FreeBSD.org>
Reviewed by: wulf
MFC after: 1 month
Refactor iwmbtfw: modularize and de-constify
- Move logic for firmware download into different adapter types
to the own functions to allow main() to be simpler
- Use enums/typedefs for exit modes, image types, etc
- Purge most obvious comments: functions are named properly,
so most of their invocations self-document the code.
Signed-off-by: Eygene Ryabinkin <rea at FreeBSD.org>
Reviewed by: wulf
MFC after: 1 month
tcpdump: ppp: Use the buffer stack for the de-escaping buffer
This both saves the buffer for freeing later and saves the packet
pointer and snapend to be restored when packet processing is complete,
even if an exception is thrown with longjmp.
This means that the hex/ASCII printing in pretty_print_packet()
processes the packet data as captured or read from the savefile, rather
than as modified by the PPP printer, so that the bounds checking is
correct.
That fixes CVE-2024-2397, which was caused by an exception being thrown
by the hex/ASCII printer (which should only happen if those routines are
called by a packet printer, not if they're called for the -X/-x/-A
flag), which jumps back to the setjmp() that surrounds the packet
printer. Hilarity^Winfinite looping ensues.
Also, restore ndo->ndo_packetp before calling the hex/ASCII printing
routine, in case nd_pop_all_packet_info() didn't restore it.
[4 lines not shown]
tcpdump: specify OpenSSL 1.1 APIs
OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.
This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.
A future update should migrate to use the OpenSSL 3.0 APIs.
PR: 271615
Reviewed by: emaste
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation
(cherry picked from commit baef3a5b585f462d9256f3b5a771ab5508ef6fd2)
Makefile: Fix several issues with bmake upgrade
Firstly, if NEED_MAKE_UPGRADE isn't set, we shouldn't use whatever
bootstrapped bmake happens to be lying around. We're not going to re-run
the bmake target, so won't make sure it's up-to-date, and thus it could
be some ancient unsupported version. We can still, however, optimise
setting SUB_MAKE when the file exists, so long as it's guarded by
NEED_MAKE_UPGRADE.
Secondly, make kernel-toolchain should also bootstrap bmake if needed,
since it's supposed to be the subset of buildworld needed for building a
kernel.
Finally, if there is a stale bootstrapped bmake lying around that isn't
needed, delete it, since it will only cause confusion, and as far as I
can tell nothing else will clean it up, not even cleandir twice. So as
to ensure nobody's doing anything crazy with MYMAKE that would cause us
to delete something unexpected, or that would change behaviour by no
longer checking exists(${MYMAKE}) and using that regardless of version
[4 lines not shown]
tarfs: Fix the size of struct tarfs_fid and add a static assert
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.
This patch packs the structure and checks via a __Static_assert().
Approved by: so
Security: FreeBSD-SA-25:02.fs
Reviewed by: markj
MFC after: 2 weeks
(cherry picked from commit 4db1b113b15158c7d134df83e7a7201cf46d459b)
(cherry picked from commit 155987e2019089a5bd2eef77ed7bcc5cc26c362e)
ext2fs: Fix the size of struct ufid and add a static assert
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.
This patch packed the structure and checks via a __Static_assert().
Approved by: so
Security: FreeBSD-SA-25:02.fs
Reviewed by: markj
MFC after: 2 weeks
(cherry picked from commit bfc8e3308bee23d0f7836d57f32ed8d47da02627)
(cherry picked from commit 7a3a0402aeb626a7379addd344cbfd8900e83baa)
cd9660: Make sure that struct ifid fits in generic filehandle structure
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.
This patch packs the structure and checks via a __Static_assert().
Approved by: so
Security: FreeBSD-SA-25:02.fs
Reported by: Kevin Miller <mas at 0x194.net>
Reviewed by: olce, imp, kib, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D47879
(cherry picked from commit 205659c43d87bd42c4a0819fde8f81e8ebba068e)
(cherry picked from commit 54974e731f279941ef7aebd7d30ba2e9299a4056)