coredump: restore compatibility with older patterns
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 29 Apr 2025 12:47:59 +0000 (14:47 +0200)
committerCarlos Henrique Lima Melara <charlesmelara@riseup.net>
Thu, 26 Jun 2025 00:44:53 +0000 (21:44 -0300)
commite5cadffa48b9058308b792e2958bd0bdc7e7b4a0
tree16b0cbfd50df3f9b371d045d6c03b148f74d4544
parent6a6c6b2e6addc47c8c7bc68d28e4a4c9be099712
coredump: restore compatibility with older patterns

This was broken in f45b8015513d38ee5f7cc361db9c5b88c9aae704. Unfortunately
the review does not talk about backward compatibility at all. There are
two places where it matters:
- During upgrades, the replacement of kernel.core_pattern is asynchronous.
  For example, during rpm upgrades, it would be updated a post-transaction
  file trigger. In other scenarios, the update might only happen after
  reboot. We have a potentially long window where the old pattern is in
  place. We need to capture coredumps during upgrades too.
- With --backtrace. The interface of --backtrace, in hindsight, is not
  great. But there are users of --backtrace which were written to use
  a specific set of arguments, and we can't just break compatiblity.
  One example is systemd-coredump-python, but there are also reports of
  users using --backtrace to generate coredump logs.

Thus, we require the original set of args, and will use the additional args if
found.

A test is added to verify that --backtrace works with and without the optional
args.

(cherry picked from commit ded0aac389e647d35bce7ec4a48e718d77c0435b)
(cherry picked from commit f9b8b75c11bba9b63096904be98cc529c304eb97)
(cherry picked from commit 385a33b043406ad79a7207f3906c3b15192a3333)
(cherry picked from commit c6f79626b6d175c6a5b62b8c5d957a83eb882301)
(cherry picked from commit 9f02346d50e33c24acf879ce4dd5937d56473325)
(cherry picked from commit ac0aa5d1fdc21db1ef035fce562cb6fc8602b544)

Origin: upstream, https://github.com/systemd/systemd-stable/commit/cadd1b1a1f39fd13b1115a10f563017201d7b56a
Forwarded: not-needed
Last-Update: 2025-06-23

Gbp-Pq: Name CVE-2025-4598-0.patch
src/coredump/coredump.c