Per discussions over how to lighten the load of armv6, move it to an
extra arch. You can still build TARGET_ARCH=armv6 if you desire, but
it won't be built as part of 'make universe' without -DEXTRA_TARGETS.
Sponsored by: Netflix
This asc/ascq code 2/0 ("No seek complete") is a fatal error on modern
drives indicating a sensor failure. One of our vendors noticed we
retried 2/0 so many times in their failure analysis and asked why (no
other OS else does). They've indicated that this failures means the
track couldn't be located (something that's not going to change, except
if the environment changes significantly, which won't happen on a
timescale useful to retries).
Sponsored by: Netflix
Currently for the MFS, firmware and VDSO template assembly files we pass
the path to include with .incbin unquoted and use __XSTRING within the
assembly file to stringify it. However, __XSTRING doesn't just perform a
single level of expansion, it performs the normal full expansion of the
macro, and so if the path itself happens to tokenise to something that
includes a defined macro in it that will itself be substituted. For
example, with #define MACRO 1, a path like /path/containing/MACRO/in/it
will expand to /path/containing/1/in/it and then, when stringified, end
up as "/path/containing/1/in/it", not the intended string. Normally,
macros have names that start or end witih underscores and are unlikely
to appear in a tokenised path (even if technically they could), but now
that we've switched to GNU C as of commit ec41a96daa ("sys: Switch the
kernel's C standard from C99 to GNU99.") there are a few new macros
defined which don't start or end with underscores: unix, which is always
defined to 1, and i386, which is defined to 1 on i386. The former
probably doesn't appear in user paths in practice, but the latter has
been seen to and is likely quite common in the wild.
Fix this by defining the macro pre-quoted instead of using __XSTRING.
Note that technically we don't need to do this for vdso_wrap.S today as
all the paths passed to it are safe file names with no user-controlled
prefix but we should do it anyway for consistency and robustness against
future changes.
This allows make tinderbox to pass when built with source and object
directories inside ~/path-with-unix, which would otherwise expand to
~/path-with-1 and break.
PR: 272744
Fixes: ec41a96daa ("sys: Switch the kernel's C standard from C99 to GNU99.")
Explicitly set ipcss/ipcse/ipcso for IPv6 per intel SDM as indicated in
inline comments.
Fix and consolidate 82543/82547 hwcsum exemption.
While here rearrange and expand some commentary.
During a driver reload stress test, after 50-300 reloads a panic occurs.
After adding sleeps in between loading and unloading the driver, the
issue does not occur. It's possible that loading/unloading too fast may
cause the gt_taskqueue pointer to be freed earlier than expected;
checking for a null pointer first fixes it.
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: erj@
Tested by: jeffrey.e.pieper@intel.com
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D39457
As per https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html
move to the modern uintXX_t. While here also migrate u_char to uint8_t.
Where other kernel interfaces allow, migrate u_long to uint64_t.
No functional changes intended.
MFC-after: 1 week
Sponsored-by: The FreeBSD Foundation
Initial libs such as csu are always built (.PHONY), and their
installation to WORLDTMP was causing all the subsequent libraries to
be considered out-of-date even when in reality they were not. Use
install -C more consistently everywhere to avoid unnecessarily
updating the mtimes in WORLDTMP, fixing this problem.
This cut down my no-change buildworld time from 30 to 15 seconds.
Fixes: https://lists.freebsd.org/pipermail/freebsd-current/2016-May/061481.html
TODO.1
Reviewed by: sjg
Sponsored by: https://www.patreon.com/valpackett
Differential Revision: https://reviews.freebsd.org/D39980
This option is a blanket for all the DTrace-related software. The option
when enabled passes in -fsanitize=address -fsanitize=undeifned, enabling
ASAN and UBSAN in the following components:
- libdtrace
- dtrace(1)
- lockstat(1)
- plockstat(1)
The option defaults to "no" and is intended as a developer aid.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D41157
Upon discovering a violation kmsan_check_arg() passes a pointer to
function parameter shadow state to kmsan_report_hook().
kmsan_report_hook() uses that address to find the origin cells, assuming
that the passed address belongs to the kernel map. This has two
problems:
1) Function parameter origin state is also located in TLS, not in the
origin map, but kmsan_report_hook() doesn't know this.
2) KMSAN TLS for thread0 is statically allocated and thus isn't shadowed
(because the kernel itself is not shadowed).
These bugs could result in inaccuracies in KMSAN reports, or a page
fault when trying to report a KMSAN violation (which by default panics
the kernel anyway).
Fix the problem by making callers of kmsan_report_hook() provide a
pointer to origin cells.
Sponsored by: The FreeBSD Foundation
Copy operands to an aligned buffer before performing operations which
require alignment. Otherwise it's possible for this code to trigger an
alignment fault on armv7.
Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D41211
If the unwinder somehow ends up with a stack pointer that lies outside
the stack, then an attempt to dereference can lead to a fault, which
causes the kernel to panic again and unwind the stack, which leads to a
fault...
Add kstack_contains() checks at points where we dereference the stack
pointer. This avoids the aforementioned infinite loop in one case I hit
where some OpenSSL assembly code apparently confuses the unwinder.
Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D41210
This spits out errors but seemingly isn't actually fatal, so was missed.
Fixes: 6853d893c7 ("release: Automatically generate MK_LIB${LIBCOMPAT} and lib${libcompat}-dbg lists")
Ringing the doorbell before making the BPF call can result in the
mbuf being freed before the BPF call.
Reviewed-by: markj
MFC-after: 3 days
Differential Revision: https://reviews.freebsd.org/D41189
During BUILD_WITH_STRICT_TMPPATH builds we need to symlink the host's
kbdcontrol into WORLDTMP/legacy/bin so that it can be used. For
completeness, also check if the host has it, since technically the host
could have been built with WITHOUT_LEGACY_CONSOLE (though given nobody's
screamed since this code was removed that's likely not something that
gets hit in practice), and handle BOOTSTRAP_ALL_TOOLS (especially since
that case will cover cross-building if and when kbdcontrol can be built
on non-FreeBSD).
This allows a BUILD_WITH_STRICT_TMPPATH tinderbox to pass.
This partially reverts commit 33550b4739.
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41202
These new targets avoid the need to invoke internal build system targets
or set internal variables when building, and also have the added benefit
of working with BUILD_WITH_STRICT_TMPPATH. Old source trees lacking such
targets will not work with BUILD_WITH_STRICT_TMPPATH; they could be made
to work by copying the steps, but it's not worth doing so, as they never
have worked in the past. The primary goal of this is to support changing
the default of BUILD_WITH_STRICT_TMPPATH to enabled.
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D41206
These implement the steps that etcupdate (and mergemaster) need in order
to build their pristine trees, avoiding the need to use internal targets
and variables. Additionally, buildetc includes the steps needed to build
with BUILD_WITH_STRICT_TMPPATH enabled, since we need some host tools to
be available during the various build and install steps.
Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D41205
The distrib-dirs and distribution steps are shared between the two, the
only difference is whether MAKEOBJDIRPREFIX is in the environment for
the latter. Having in the environment for the former is currently not
needed but does no harm and will be needed in future, so we can just
export it up-front in the subshell. When we do distrib-dirs relative to
_obj and everything also doesn't matter, so move it next to distribution
where it makes more sense. Finally, to avoid complicated && chains, use
"|| exit 1" everywhere to make the subshell fail, and add an extra one
on to the cd $SRCDIR to handle that failing (otherwise we'd go on and
try to build the current directory after cd prints its error, which is
unhelpful).
These changes will make it easier to bundle these steps up into new
top-level targets to allow the build system to manage the steps rather
than etcupdate, which will also handle BUILD_WITH_STRICT_TMPPATH, which
currently does not work with etcupdate.
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D41204
This mirrors _cleanobj vs _obj, and will be used by etcupdate to ensure
its build tree has host tools available when BUILD_WITH_STRICT_TMPPATH
is enabled by default (whether in the source tree, like CheriBSD, or in
a system config file).
Note that due to line length the .MAKE .PHONY dependency line is split
into two, one for the filtered WMAKE_TGTS and one for the filtered
.ALLTARGETS.
Reviewed by: brooks, jhb
Differential Revision: https://reviews.freebsd.org/D41190
If any of the toolchain variables are not absolute then we need to
create a symlink in WORLDTMP/legacy/bin in order to make them available
during a BUILD_WITH_STRICT_TMPPATH build.
Reviewed by: brooks, jhb
Differential Revision: https://reviews.freebsd.org/D41188
By passing through _ALL_libcompats we can avoid hard-coding the list of
libcompats in depend-cleanup.sh. This cleanup also makes clean_dep
shorter by using a loop instead of handling each case explicitly (at the
expense of slightly tweaked logging).
Reviewed by: brooks, jhb
Differential Revision: https://reviews.freebsd.org/D41187
Note that the pattern for matching is made slightly more specific, so as
to permit libcompats where one is a prefix of another (e.g. CheriBSD has
lib64 and lib64c).
Reviewed by: brooks, jhb, emaste
Differential Revision: https://reviews.freebsd.org/D41185
Note that the pattern for matching is made slightly more specific, so as
to permit libcompats where one is a prefix of another (e.g. CheriBSD has
lib64 and lib64c).
Reviewed by: brooks, jhb, emaste, imp, kib
Differential Revision: https://reviews.freebsd.org/D41183
Older entries in this file are left alone as hard-coding lib32 as
they're not worth the churn; downstreams will have already moved past
them (in particular, CheriBSD, which adds additional libcompats).
Reviewed by: brooks, jhb, emaste
Differential Revision: https://reviews.freebsd.org/D41181
Adding these to a new bsd.compat.pre.mk will allow other parts of the
tree to iterate over the set of possible libcompats (upper and/or lower)
rather than having to hard-code the list.
Reviewed by: brooks, jhb, emaste
Differential Revision: https://reviews.freebsd.org/D41178
Since f71cb9f748 socket stays connnected with inpcb through latter's
lifetime and there is no reason to complicate things and copy these
flags.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D41198
This deals with TCP endpoints in the SYN-RCVD state coming from the
SYN-SENT state.
Reviewed by: rscheff
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D41203
Patch base stack to correctly handle the RST bit independently
of other header flags per TCP RFC.
MFC after: 1 week
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D40982
The network and address fields were sometimes truncated for netstat -i
without -W, and often much too wide for netstat -i with the -W option.
Fields such as normal packet counts often overflowed. As a result,
columns didn't line up, and large white spaces made it harder to
follow a line across the display. Change the code to compute the
required field sizes for network, address, and various packet counts.
Hoist the code to format network and address into a subroutine that
can be called twice, once to measure the required field widths,
and once to emit the values. Use separate field widths for input
and output packets, byte counts, and error and drop counters.
These are left at defaults (the preceding values) with the -h
option, in which case the fields have a limited total width.
An extra space is included between the Network and Address, which
otherwise seemed too close.
Change the mention of -W with -i in the man page to say that most
field widths are computed dynamically in this case.
MFC after: 1 week
Reviewed by: sjg, glebius
Differential Revision: https://reviews.freebsd.org/D41160
When we are sending terminating signal to the group, killpg() needs
to guarantee that all group members are to be terminated (it does not
need to ensure that they are terminated on return from killpg()). The
pg_killsx change eliminates the largest window there, but still, if
a multithreaded process is signalled, the following could happen:
- thread 1 is selected for the signal delivery and gets descheduled
- thread 2 waits for pg_killsx lock, obtains it and forks
- thread 1 continue executing and terminates the process
This scenario allows the child to escape still.
Fix it by single-threading forking parent if a conflict with pg_killsx
is noted. We try to lock pg_killsx without sleeping, and failure to
acquire it means that a parallel killpg(2) is executed. Then, stop
other threads for running and in particular, receive signals, to avoid
the situation explained above.
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41128
This should improve signal delivery latency and better expose the
process state to the executing threads.
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41128
This reverts commits 81a37995c7 and
565a343ae3.
There is still a leakage of the p_killpg_cnt, some but not all sources
of which were identified.
Second, and more important, is that there is a fundamental issue with
blocked signals having KSI_KILLPG flag set. Queueing of such signal
increments p_killpg_cnt, but it cannot be decremented until the signal
is delivered. If, for instance, a single-threaded process with blocked
signal receives killpg-kill and executes fork(2), the fork enter check
returns with ERESTART. And since signal is blocked, the condition
cannot be cleared.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41128
converting user allocation address into overhead pointer
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41150