PR lib/60949 pthread*_getname_np(3) - avoid UB if len == 0
Just make len == 0 be an EINVAL error.
Update pthread_attr_getname_np(3) man page, so it no longer says
there are no errors from pthread_attr_getname_np() - which was wrong
in any case, as there was already one (if attr is invalid), and
while there, one minor grammar fix.
No pullups currently planned.
In the fpfline trap handler, use the faultstkadj path rather than the
basic fault path. This is to handle FPU emulation faults on the 68LC040,
which use a format 4 frame; if the emulated FPU insn results in a signal,
kernel stack would be leaked.
Problem reported by Romain Dolbeau on port-m68k.
Allocate state for the FPU emulator on the kernel stack rather than as
static globals. Normally we wouldn't want to allocate this much on the
stack, but the emulator is only for user-space code, so the kernel stack
will have been idle when the F-line trap occurred; the only things on
the stack at this point are the trap frame and the small number of call
frames required to get us here.
This prevents concurrent FPU emuations from colliding with each other.
This is something that could happen when e.g. two FP-using programs are
running concurrently on a system under memory pressure and one of them
blocks during an emulation to service a page fault.
The alternatives are less than ideal: we either have to dynamically
allocate memory or wrap the emulator in a mutex.
Similarly, change __fpu_logn() and __fpu_modrem() to place their
temporaries on the stack, as well.
Problem reported by Romain Dolbeau on port-m68k.
Don't proceed with undefined results in the face of memory access
errors in the FPU emulator:
- fpu_load_ea() / fpu_store_ea(): if copyin() / copyout() return non-zero,
return SIGSEGV.
Catch some callers of fpu_load_ea() and fpu_store_ea() that were ignoring
the return value:
- fpu_emul_arith() / fpu_emul_fscale(): Pay attention to the return value
of fpu_load_ea().
- fpu_emul_fstore(): Pay attention to the return value of fpu_store_ea().
Problem reported by Romain Dolbeau on port-m68k.
secmodel.9: update some details in code examples
Back in 2009, refactoring changed where certain functionality is
located, but the examples in this man page weren't updated to match.
Avoid filename trucation of paths > NAME_MAX, change it to PATH_MAX and
detect truncation and beep (completion) or print an error message (save)
(Kilian Feess)
Fix cpu_{get,set}mcontext() vis a vis FP state in the presence of
FPU_NONE+FPU_EMULATE. Previously, the emulated 68881 registers,
which are present in the PCB, were completely ignored becaue fputype
is FPU_NONE in that case.
This fix entails a few things:
- In fpu_emulate(), when we've reached the point where we know an
FPU instruction is going to be performed, set the PCB's copy of
the FP frame to indicate an "idle" state. This sets the stage
for normal FPU handling code to use the saved emulator state
just as it would with a real FPU.
- In fpu_init(), if we set FPU_NONE, also initialize m68k_cached_fpu_idle_frame
to mimic an idle 68881 idle frame so that the _UC_FPU+_UC_M68K_UC_USER
case in cpu_setmcontext() works correctly.
- In cpu_{get,set}mcontext(), always use the saved FP registers in the
PCB, and only interact with the FPU if fputype != FPU_NONE and curlwp.
While here, simplify the construction of the FPFRAME_IS_NULL() expression.
Problem reported by Romain Dolbeau on port-m68k.
powerpc: oea: downgrade "failed to allocate DEAD ZONE" log to debug
0xDEA[CDE]xxxx may not exist on the platform, so no need to map them away.
Downgrade the log message to a debug message since it's not fatal.
texinfo: build makedoc as a host tool in src/tools
makedoc is necessary to generate files for info(1) and infokey(1)
and it was built in src/external/gpl2/texinfo/makedoc with config.h
prepared for the target NetBSD hosts, but it's really confusing.
Additional install rules is based on tools/Makefile.host and
afterinstall ordering follows tools/groff/Makefile.
Tested 'build.sh -U -m amd64 release' on ubuntu 26.04 with GCC 15.