[GlobalISel] Use source known bits in G_ASSERT_ALIGN (#246927)
Compute the source's known bits before setting the low zero bits from
the alignment.
Assisted-by: Claude Opus 5.5
[clang-doc][test] Avoid compdb lookups in clang-doc tests (#247381)
In #247006, it was pointed out that our tests are searching the build
dir and picking up the local compdb. This breaks w/ PCH enabled builds,
as the compiler has been modified.
Instead of passing `--` to every test, follow the clangd example and use
an empty compile_flags.txt file generated by the build, and a checked in
file for our test dir. This means we won't silently regress, when
someone forgets to suffix `--` on a RUN line, and tests that pass
specific combdb params will work per normal.
[M68k] ExpandMOVI - remove ambiguous cast (#245011)
MSVC fails to determine how to cast from the MachineInstrBuilder to a
MachineBasicBlock::iterator.
Since this is only used for a debugging message I've removed the code to
fix the build, but we can tweak the code (get buildClearRegister to
return the last created MachineInstr?) if necessary.
[RISCV][GlobalISel] Use Zfa fli for floating-point constants (#246564)
G_FCONSTANT always built the value in a GPR and moved it with fmv, so
even 1.0 took two instructions and f64 on RV32 went through the stack.
Select fli when Zfa can encode the constant, using fli + fneg for the
negative values that are not in the table, matching SelectionDAG.
tests/sys/kern/procdesc: test the debugger's wait after the last close
Attach a debugger to a PD_NOWAITPID child, let the child exit, and let
the parent close the last process descriptor before the debugger waits.
Check that a debugger which is neither the parent nor the reaper can
still wait for the child, which then goes to the reaper, and that a
reaper which is the debugger can collect the child.
The child exits on its own: kill(2) does not kill a traced process, it
only stops it for the debugger.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
amd64, powerpc64: treat procctl(P_PID, 0) as request for current process
Discussed with: markj
Fixes: f833ab9dd187 ("procctl(2): add consistent shortcut P_ID:0 as curproc")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D61919
tests/sys/kern/procdesc: test the reap by a close from a non-parent
The parent waits for its pdfork(2) child, and then another process,
which inherited the descriptor over fork(2), closes the last one and so
reaps the zombie. Check that the child's resource usage is accounted
to the parent and not to the closing process, and that the child's
SIGCHLD is no longer pending for the parent.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
proc_reap(): account the reaped child to its parent
When the last process descriptor of a zombie is closed by a process
other than its parent, proc_reap() added the child's resource usage to
the closing process instead of the parent. Add it to the parent, and do
it before dropping proctree_lock, which keeps the parent from being
reaped meanwhile.
Reported by: llm-postcr
Fixes: cfb5f7686588 ("Add experimental support for process descriptors")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
proc_reap(): dequeue the child's SIGCHLD under the parent's lock
p_ksi is only queued to the parent, but proc_reap() took it off the
queue with the caller locked. When the last process descriptor of a
zombie is closed by a process other than its parent, e.g. one which
inherited the descriptor over fork(2) or opened it with pdopenpid(2),
the parent's signal queue and p_pendingcnt were modified without the
parent's lock.
Since bcdb6ba94d08 this is easy to hit: a pdfork(2) child without
PD_NOWAITPID signals its parent with p_ksi on exit, and while the
descriptor is open, the parent's wait only drops PZOMBIEREF_PARENT and
leaves p_ksi queued if the parent blocks or catches SIGCHLD.
Lock the parent, as proc_reparent() does.
Reported by: llm-postcr
Fixes: cfb5f7686588 ("Add experimental support for process descriptors")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
procdesc_close(): leave a zombie parked at its debugger with it
A debugger which is not the parent of a PD_NOWAITPID child, and got the
child via PT_ATTACH, can wait for the child after it exited. If the
parent closed the last process descriptor before the debugger waited,
the close dropped the last zombie reference, and proc_reap() gave the
zombie back to the real parent. The real parent cannot wait for a
PD_NOWAITPID child, and the debugger got ECHILD, so the zombie stayed
until the real parent exited.
Handle a zombie parked at its debugger as procdesc_close() handles a
traced live process: keep it with the debugger, and make the reaper the
real parent. The debugger's wait then gives the zombie to the reaper,
which proc_reparent() lets wait for it. A debugger which is the reaper
gets PZOMBIEREF_PARENT right away.
Reported by: llm-postcr
Fixes: bcdb6ba94d08 ("processes: add zombie references, each of them prevents reap")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
kern.post.mk: Further refine ports module build
A handful of kmod ports have NO_PACKAGE set, which disables the package
target, which means the previous commit made things worse for those
ports rather than better. Work around this by explicitly building the
stage target first.
Fixes: b393df657811 ("kern.post.mk: Fix unprivileged ports module build")