ppp: Avoid overflow when formatting endpoint discriminator options
Each byte of the address is represented by a pair of characters, so we
should be multiplying len by 2 when figuring out how much buffer space
we have. Previously, a sufficiently large option could cause an
overflow of the global "result" buffer.
Reported by: Joshua Rogers <joshua at joshua.hu>
Tested by: Décio Brandão (0xDBJ)
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58555
libelftc: Const correctness for C23
On some platforms, e.g. Linux Clang 22.1.8 / glibc 2.43, strchr()
now implements the C23 behaviour where passing a const pointer to
strchr() also returns a const pointer. This breaks libelftc during
the bootstrap build, since it assumes the return value is always
a mutable pointer.
Since the returned pointer is never modified in either case, make
it const.
MFC after: 1 week
Reviewed by: jkoshy, markj, dim, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58497
mandoc: Const correctness for C23
On some platforms, e.g. Linux Clang 22.1.8 / glibc 2.43, strchr()
now implements the C23 behaviour where passing a const pointer to
strchr() also returns a const pointer. This breaks mandoc during
the bootstrap build, since it assumes the return value is always
a mutable pointer.
In read.c, make the existing temporary pointer const, and for the
mandoc_asprintf() call, add a new mutable local.
In mdoc.c and out.c, since the data is mutable and is mutated here,
remove const from the temporary pointers.
MFC after: 1 week
Reviewed by: fuz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58495
m4: Const correctness for C23
On some platforms, e.g. Linux Clang 22.1.8 / glibc 2.43, strchr()
now implements the C23 behaviour where passing a const pointer to
strchr() also returns a const pointer. This breaks m4 during the
bootstrap build, since it assumes the return value is always a
mutable pointer.
Since the returned value is never modified, simply make the
temporary const.
MFC after: 1 week
Reviewed by: bapt, dim
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58494
mkimg: Const correctness for C23
On some platforms, e.g. Linux Clang 22.1.8 / glibc 2.43, strchr()
now implements the C23 behaviour where passing a const pointer to
strchr() also returns a const pointer. This breaks mkimg during
the bootstrap build, since it assumes the return value is always
a mutable pointer.
Make the existing 'sep' pointer const to fix the first case, and
for the second, introduce a new non-const pointer for strchr,
since we do modify the result in that case.
MFC after: 1 week
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58493
xinstall: Const correctness for C23
On some platforms, e.g. Linux Clang 22.1.8 / glibc 2.43, strchr()
now implements the C23 behaviour where passing a const pointer to
strchr() also returns a const pointer. This breaks xinstall during
the bootstrap build, since it assumes the return value is always
a mutable pointer.
As the returned pointer is never used to modify the value, fix this
by making the temporary variable const.
MFC after: 1 week
Reviewed by: ray, markj, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58492
sort: Const correctness for C23
On some platforms, e.g. Linux Clang 22.1.8 / glibc 2.43, strchr()
now implements the C23 behaviour where passing a const pointer to
strchr() also returns a const pointer. This breaks sort during
the bootstrap build, since it assumes the return value is always
a mutable pointer.
As the returned pointer is never used to modify the value, fix this
by making the temporary variable const.
MFC after: 1 week
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58491
libucl: Const correctness for C23
On some platforms, e.g. Linux Clang 22.1.8 / glibc 2.43, strchr()
now implements the C23 behaviour where passing a const pointer to
strchr() also returns a const pointer. This breaks libucl during
the bootstrap build, since it assumes the return value is always
a mutable pointer.
Instead of assigning directly to params->prefix (which is const),
use a non-const temporary variable and assign the result after
we've done the modification.
MFC after: 1 week
Reviewed by: bofh, bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58490
rpcgen: Const correctness for C23
On some platforms, e.g. Linux Clang 22.1.8 / glibc 2.43, strchr()
now implements the C23 behaviour where passing a const pointer to
strchr() also returns a const pointer. This breaks rpcgen during
the bootstrap build, since it assumes the return value is always
a mutable pointer.
For mkfile_output(), the pointed-to value is never modified, so
fix this by making the pointer const as well.
For open_log_file(), the current code modifies the supposedly const
value in-place to remove the filename suffix, which happens to work
but is wrong even in older versions of C. Change the code to use a
printf "%.*s" format specifier to strip the suffix instead.
MFC after: 1 week
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58489
libc: getopt{,_long}: Const correctness for C23
On some platforms, e.g. Linux Clang 22.1.8 / glibc 2.43, strchr()
now implements the C23 behaviour where passing a const pointer to
strchr() also returns a const pointer. This breaks getopt during
the bootstrap build, since it assumes the return value is always
a mutable pointer.
Since the pointed-to value is never modified, fix this by making
the pointer const.
MFC after: 1 week
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58488
ixgbe: supply PF transmit contexts under SR-IOV
X550-family malicious-driver detection validates the transmit
context selected by a data descriptor with Check Context set. ixgbe
sets that bit on every transmit data descriptor, but ordinary PF
packets without a VLAN or checksum offload do not create a context
descriptor. The empty context then reports an invalid MAC-header
length and blocks the PF queue as soon as MDD is enabled.
Create the existing context descriptor for every PF packet while
SR-IOV is active. This supplies the required MAC-header length and
keeps MDD from mistaking normal PF traffic for a malicious-driver
event.
MFC after: 1 week
igc: Add VLAN hardware filtering
Borrow the e1000 VLAN filter table
Ambiguous presence of the feature by Intel was settled by DPDK and
emperical testing.
MFC after: 2 weeks
Relnotes: yes
rc.subr: Fix premature return from wait_for_pids
Use pwait's new -r option to wait until the target processes have not
only terminated, but also been reaped.
PR: 293183
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D58391
(cherry picked from commit 356d0b79cf6fc693ed1a5564232e240ce15ccb8a)
pwait: Don't use init as a target
The time_unit test case uses PID 1 as a target for pwait. This doesn't
work in a jail. Since all we need is a process that we know won't die
while the test is running, we may as well use ourselves.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D58418
(cherry picked from commit 5922e9d7e72bfa8a85b0f37bcfd1a8b5d866ec3b)
kqueue: Fix delivery of unwanted events
In both procdesc_kqops_event() and filt_proc(), the event variable can
have more than one bit set. This means that:
* We cannot compare it directly with NOTE_EXIT; we must binary-and them
instead.
* We cannot binary-or it with the report mask; we must binary-and it
with the request mask first.
MFC after: 1 week
Fixes: 2a5e58c59694 ("procdesc: add NOTE_PDSIGCHLD")
Fixes: b328975b9d7c ("procdesc: report NOTE_PDSIGCHLD for traced and stopped process")
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58395
(cherry picked from commit 4627fe9e5afc0dce4469f5964f5d4b0e49a24274)
pwait: Test the new -r option
Test that pwait without -r reports a process as soon as it terminates,
while pwait with -r does not report it until it has been reaped.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D58385
(cherry picked from commit e115066370dcfec410d914362756d09c268a5b4e)
pwait: Add a SIGINFO handler
On SIGINFO, print a space-separated list or remaining processes to
standard error.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58386
(cherry picked from commit eddd8aa99ca84c85faea5761af800b5b089d6ba1)
pwait: Optionally wait until process is reaped
If the new -r option is specified, wait until the target process not
only terminates but is reaped.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58314
(cherry picked from commit c8f5e6819d4d81906c4a1641b5c9f02d8730481c)
kqueue: Add NOTE_REAP
Add a NOTE_REAP event for EVFILTER_PROC which provides a notification
when the process is reaped.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58313
(cherry picked from commit 2bacbbecb165dd761ea7ec2fc35630db61508cdf)
rc.subr: Fix premature return from wait_for_pids
Use pwait's new -r option to wait until the target processes have not
only terminated, but also been reaped.
PR: 293183
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D58391
(cherry picked from commit 356d0b79cf6fc693ed1a5564232e240ce15ccb8a)
kqueue: Add NOTE_REAP
Add a NOTE_REAP event for EVFILTER_PROC which provides a notification
when the process is reaped.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58313
(cherry picked from commit 2bacbbecb165dd761ea7ec2fc35630db61508cdf)
pwait: Test the new -r option
Test that pwait without -r reports a process as soon as it terminates,
while pwait with -r does not report it until it has been reaped.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D58385
(cherry picked from commit e115066370dcfec410d914362756d09c268a5b4e)
pwait: Add a SIGINFO handler
On SIGINFO, print a space-separated list or remaining processes to
standard error.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58386
(cherry picked from commit eddd8aa99ca84c85faea5761af800b5b089d6ba1)
pwait: Optionally wait until process is reaped
If the new -r option is specified, wait until the target process not
only terminates but is reaped.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58314
(cherry picked from commit c8f5e6819d4d81906c4a1641b5c9f02d8730481c)