nrelease: Simplify the adjustments to loader.conf for IMG boot
Use 'sed' similar to fstab adjustments instead of grep+echo to adjust
'boot/loader.conf' to the IMG boot.
nrelease: Adjust fstab and reuse it for IMG boot
The root '/' filesystem is mounted by the kernel, so it can be omitted
from 'etc/fstab'. This also makes the 'fstab' file be used by the IMG
boot, so just reuse it.
nrelease: Adjust fstab to remove '-C' option for /tmp tmpfs mount
For the /tmp mount, no need to copy the origin contents; also, there
shouldn't be any contents at this early boot stage.
nrelease: Add root_rw_mount="NO" to rc.conf to fix ISO boot
The ISO root filesystem is obviously readonly and cannot be remounted to
'rw'. Without setting 'root_rw_mount=NO', the ISO boot would abort
after failing to remount the root filesystem.
This is a follow-up fix to my previous commit
31b00396377857ebb62259aa944f9351fa62ea44.
Reported-by: Sergey Zigachev (servik)
cd9660 - Fix unexpected file/dir mode mask in 7764eb663ae501
* 7764eb663ae501 used the modes of the underlying mount point as the
default fmask and dmask for cd9660 mounts when no masking options
are specified. This is unexpected. Prior to that commit, the modes
from ISO were used verbatim.
* This commit returns to the old (more expected) operation when
-m/-M is not specified.
* Also make some adjustments to ensure that new kernels work with
old worlds and vise-versa. Make use of the fields require the
related mount flag and also default the fields to all modes when
-m/-M is not specified. Any mismatch will have the prior (expected)
operation.
Reported-by: Sergey Zigachev (servik)
initrd: Add diff/sdiff back to rescue and fix build
Update the rescue/Makefile to include the updated diff/sdiff utilities;
however, diff3 is excluded because it's a shell script and relies on
libexec/diff3prog. As a result, we must remove /rescue/diff3 via
"make upgrade"; otherwise, /rescue/diff3 would become a separate binary
(because of hardlinks) and break initrd build because of exceeded size.
Bug: https://bugs.dragonflybsd.org/issues/3376
mail(1): Catch SIGWINCH to adapt to terminal size changes
Turn setscreensize() into a signal handler for SIGWINCH. This
allows users to resize their terminal and have long subject lines
become visible in "h(eader)" listings without the need to restart
mail(1).
Submit: https://bugs.dragonflybsd.org/issues/3375
mail(1): Catch SIGWINCH to adapt to terminal size changes
Turn setscreensize() into a signal handler for SIGWINCH. This
allows users to resize their terminal and have long subject lines
become visible in "h(eader)" listings without the need to restart
mail(1).
Submit: https://bugs.dragonflybsd.org/issues/3375
dsynth - Include "add" in "help" output.
* Include a blurb on the "add" directive in the dsynth help output.
Submitted-by: Pierre-Alain TORET <daftaupe at dragonflybsd.org>
rc.conf.5: Document the missing dhclient_flags_<interface>
This interface-specific dhclient(8) flags variable is supported by the
rc script, but was missing in the man page.
Obtained-from: FreeBSD
rc.d: Improve dhclient script
* Make use of the pid file to check the current status
* Improve the handling of arguments
* Improve error reporting
Obtained-from: FreeBSD
rc.conf.5: Document the missing dhclient_flags_<interface>
This interface-specific dhclient(8) flags variable is supported by the
rc script, but was missing in the man page.
Obtained-from: FreeBSD
rc.d: Fix nfsd/yp* scripts to set ${command_args}
These scripts were failing to set ${command_args} because they set
"command_args=${<name>_flags}" before performing "load_rc_config".
As a result, the "command_args" variable was empty and the "<name>_flags"
settings in rc.conf were effectively ignored.
Fix this issue by moving the "command_args" assignment after calling
"load_rc_config".
Reported-by: kentish (on IRC)
Referred-to: FreeBSD
libstdc++: Fix unsigned wraparound in codecvt::do_length [PR105857]
When the max argument to std::codecvt<wchar_t, char, mbstate_t>::length
is SIZE_MAX/4+1 or greater the multiplication with sizeof(wchar_t) will
wrap to a small value, and the alloca call will have a buffer that's
smaller than requested. The call to mbsnrtowcs then has a buffer that is
smaller than the value passed as the buffer length. When libstdc++.so is
built with -D_FORTIFY_SOURCE=3 the mismatched buffer and length will get
detected and will abort inside Glibc.
When it doesn't abort, there's no buffer overflow because Glibc's
mbsnrtowcs has the same len * sizeof(wchar_t) calculation to determine
the size of the buffer in bytes, and that will wrap to the same small
number as the alloca argument. So luckily Glibc agrees with the caller
about the real size of the buffer, and won't overflow it.
Even when the max argument isn't large enough to wrap, it can still be
much too large to safely pass to alloca, so we should limit that. We
already have a loop that processes chunks so that we can handle null
[4 lines not shown]
kernel - Fix signal / signal-mask-change race
* Fix race between incoming signals and sigsuspend(), ppoll(),
or pselect() when used to change the signal mask. A signal can
be received and queued to a process that is in the middle of
unmasking said signal without triggering signal processing.
* Our kernel *sleep*() and wakeup functions avoid whole-process
locks to ensure high thread performance, but this can result in
a race when a signal cannot be delivered to a thread and gets
queued to the process instead.
In order to keep the high-performance sleep, we instead use
atomic ops and a ref-counter only in code paths related to
general signal delivery to the process. Code which changes the
signal mask then waits for the ref-counter to become zero as
needed to ensure proper interlocked tests across signal mask
changes to close the race.
kernel - Fix auto port assignment collision in network code
* When the SO_REUSEADDR or SO_REUSEPORT socket option is set on a
socket undergoing automatic lport assignment, the auto network port
assignment code in the kernel improperly ignores collisions against
ports assigned to wildcard sockets and may assign the same port. This
causes later connect() calls to fail.
* Can cause gdb services to sometimes fail to connect.
* Fixed by ignoring the options for the purposes of finding an unused
port.
Reported-by: Sergey Zigachev (servik)
rtld - do not allow both dynamic DTV index and static TLS offset
* If we are allocating static offset for an object with dynamic index,
return failure. In the opposite case, if dynamic index is requested for
statically allocated TLS area, directly use the offset instead of
setting the index.
Taken from FreeBSD, commit 91880e07f605edb90339685bc934699a4344de3b.
* While there, fix dtv timing race between threads.
Co-authored-by: Matthew Dillon <dillon at apollo.backplane.com>
Reported-by: Stephane Russell <srussell at prodigeinfo.qc.ca>