After installing the Perl modules from the source tree, the install copied
every .pm in the build tree's lib/ over them, though only Base, Config,
Memory, ConfigData and ONVIF are generated there. Copies of other modules
left in a build directory by an older build replaced current ones on
install: a stale ZoneMinder/Server.pm without systemdRunning() left
zoneminder.service failing in zmpkg.pl. The five generated modules are now
named one by one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
For a signal sent with kill(), raise() or sigqueue() rather than raised by
a fault, si_addr shares its storage with the sender's pid and uid, so the
crash report printed "unknown segfault code (signal code 0)" and a fault
address that was really those two numbers. The report now says
"Sent by process <pid> (uid <uid>)" and gives only the instruction
pointer for SI_USER, SI_QUEUE and, where defined, SI_TKILL. Reports of
real faults are unchanged; a test checks that a write to address 0x10
still reports that address.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment said a process made non-dumpable with PR_SET_DUMPABLE is still
dumped when fs.suid_dumpable is 2. The kernel only uses that setting when a
process changes credentials or runs a setuid or unreadable program; a
process made non-dumpable is not dumped at all. Checked on a box with
suid_dumpable=2 and core_pattern piping to systemd-coredump: a zmc killed
with SIGSEGV under ZM_DUMP_CORES=0 left no systemd-coredump entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A zero RLIMIT_CORE stops the kernel writing a core file, but when
core_pattern pipes to a program such as systemd-coredump or apport the
kernel hands it the dump anyway and leaves the limit to that program.
With ZM_DUMP_CORES off, the die handler now also calls
prctl(PR_SET_DUMPABLE, 0) when it starts reporting, so the kernel skips
the dump unless fs.suid_dumpable is 2, in which case the limit still
applies. It is done only at crash time because it also stops ptrace and
makes root the owner of the process's /proc files. Linux only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The die handler's 5 second report timeout replaced the child's alarm()
watchdog and ends a stuck report on the original signal, so a test whose
report stalled still passed. run_crashing_child() now waits in the parent
with its own deadline, 4 seconds by default, and kills the child and
fails the test once it passes. The blocked-stderr test, which is meant to
reach the timeout, gets 8 seconds; the other-thread test, which ends
through its 3 second wait, gets 4.5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The die handler is installed only when ZM_DUMP_CORES is off. It used to end
the process with exit(), so no core was written; it now re-raises the fault
with the default action, which dumps core wherever the core size limit
allows. zmSetDefaultDieHandler() now lowers the soft RLIMIT_CORE to 0 in
that case. The hard limit is left as it was, and with ZM_DUMP_CORES on
nothing changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only zms handles SIGPIPE; in zmc, zma and zmu it is fatal. A crash report
written to a stderr pipe whose reader had gone raised SIGPIPE, which killed
the process before the report reached the log file or syslog and replaced
the fault as the cause of death. SIGPIPE is now blocked while the die
handler runs, so the write fails with EPIPE and the report goes on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A write in the die handler that never completes, such as to a stderr pipe
nobody reads when a daemon is run by hand, left the process hung with the
fault never reaching zmdc. The handler now sets a 5 second alarm when it
starts reporting; if it fires, a SIGALRM handler ends the process on the
signal that was being reported. alarm() and sigaction() are
async-signal-safe and nothing else in ZoneMinder uses SIGALRM.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>