#1092450 rsyslog: In the init path, rsyslogd crashes with segfault on receipt of SIGTERM in rsyslogdDoDie() as runConf is NULL

Package:
rsyslog
Source:
rsyslog
Description:
reliable system and kernel logging daemon
Submitter:
Paul Pradhan
Date:
2025-01-11 14:54:03 UTC
Severity:
normal
Tags:
#1092450#5
Date:
2025-01-08 00:16:32 UTC
From:
To:
Dear Maintainer,

This issue has been fixed in the upstream version by Wang Haitao as
detailed below

Could you please backport it to Debian Bookworm?

==

 git log rsyslogd.c
 commit d38e4b7bfc5bd0137914859837dcc04076b9e1ea
 Author: Wang Haitao 45086632+apple-ouyang@users.noreply.github.com
 Date:   Fri Sep 20 17:50:37 2024 +0800

    Fix runConf NULL pointer refence

    `systemd restart rsyslog` in the early start of OS will let rsyslog segmentation fault.
    This cmd will send sigTerm to rsylogd, and rsyslogd will handle the signal in rsyslogdDoDie.

    If the rsyslogd havn't parse the conf, the runConf will be NULL
    So check the pointer before reference it.

==

Backtrace ::
(gdb) bt
#0  rsyslogdDoDie (sig=15) at ./tools/rsyslogd.c:1837
#1  <signal handler called>
#2  0x00007f320925211f in __libc_sigaction () from
/lib/x86_64-linux-gnu/libc.so.6
#3  0x000055dba54f6a9b in hdlr_enable (sig=sig@entry=17,
hdlr=hdlr@entry=0x55dba54f6880 <hdlr_sigchld>) at
./tools/rsyslogd.c:1251
#4  0x000055dba54f8574 in initAll (argc=<optimized out>, argv=<optimized
out>) at ./tools/rsyslogd.c:1640
#5  0x000055dba54f60a9 in main (argc=3, argv=0x55dba555921c) at
./tools/rsyslogd.c:2213

(gdb) f 0
#0  rsyslogdDoDie (sig=15) at ./tools/rsyslogd.c:1837
1837     in ./tools/rsyslogd.c

(gdb) p runConf
$1 = (rsconf_t *) 0x0

==

#1092450#16
Date:
2025-01-11 14:52:00 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
rsyslog, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1092450@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Biebl <biebl@debian.org> (supplier of updated rsyslog package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Wed, 08 Jan 2025 19:13:05 +0100
Source: rsyslog
Architecture: source
Version: 8.2302.0-1+deb12u1
Distribution: bookworm
Urgency: medium
Maintainer: Michael Biebl <biebl@debian.org>
Changed-By: Michael Biebl <biebl@debian.org>
Closes: 1092450
Changes:
 rsyslog (8.2302.0-1+deb12u1) bookworm; urgency=medium
 .
   * Fix runConf NULL pointer reference.
     If rsyslogd hasn't fully parsed its configuration, runConf will be NULL.
     Receiving a SIGTERM at this point will trigger a segmentation fault.
     So check the pointer before referencing it to allow for a clean restart.
     Patch cherry-picked from upstream Git. (Closes: #1092450)
   * Switch debian-branch to debian/bookworm
Checksums-Sha1:
 0b57e5d815228e1603db8a90785b90493837cfbf 3282 rsyslog_8.2302.0-1+deb12u1.dsc
 5d19da60406a0f803de2481536b3e1bece857204 29584 rsyslog_8.2302.0-1+deb12u1.debian.tar.xz
 4b5b75e391c68cebf715d04c1daac4925da3f1a6 7773 rsyslog_8.2302.0-1+deb12u1_source.buildinfo
Checksums-Sha256:
 ff4787f987ef79570284c679c7c7fe7d7e70ea9df440ff7bad0a5ee889442b92 3282 rsyslog_8.2302.0-1+deb12u1.dsc
 9bc431c546fe114e062620049257fa7867c2ef7f5219f288848fb5a8bf321f9e 29584 rsyslog_8.2302.0-1+deb12u1.debian.tar.xz
 52e040b96793c72bf8e4db84b13325fb958107bbcee3b49779b0a5f2f7d01160 7773 rsyslog_8.2302.0-1+deb12u1_source.buildinfo
Files:
 050026822ffe4643fa39fc71c3bdcd5b 3282 admin optional rsyslog_8.2302.0-1+deb12u1.dsc
 6cda93575ddb02e81bc4a69bc190bd70 29584 admin optional rsyslog_8.2302.0-1+deb12u1.debian.tar.xz
 296075cf8688f8572ce6048615767812 7773 admin optional rsyslog_8.2302.0-1+deb12u1_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEECbOsLssWnJBDRcxUauHfDWCPItwFAmd+w+gACgkQauHfDWCP
ItwoJg//dY8n91YdYCMZH1DuLVkOMxEtTN5GqdleQ523dgBq9P/KjKDncLtypuay
oaJfQdP2TbyJGMguCckIKndxnr3uwQx49YvUVi8UmC+KTJWVERrb30iC59gee4HD
TEVI66wk2xmVYSah9ckAEtBXhdQ7+CpOBdwdT6nAE2OrXcSTkc3/zZZLfxg3bekK
Bl0vf/iCp0Ly2HjGWN2/s8KZXAqDV/UsAGYkC9rzyLbiiPj1tj2fqdM8XkgE9q5G
IufIdPPjDFx0W3pM6QpeuQiWRwXiWJGxCtfLFxNOOZcXJ6aPdQxqhM1QeEISxeiI
Lup7XaCfzJ2Uupo23WO3M0TmyEbusD+AZGXOZftTM25mL7SmV/lesmZSUrEVgeMM
3ZvLTlfPJcGRHsQEqkvgzCJREQ7STt81Z5MbL+i8JRszm/ha1NLyHdGqtNpI3FD3
GeZX+fquHQLsJ4G6OyHoGWsdxEf1hghKL6xV/bfvGOWS0OjhZD9EnFxs7rmjYfM2
eSW/eEJOh/0j73LnGIkNEwxLwmCqK7OMQ4U3zI1obHpoFHRXg5bRhiHNjZJLszTR
0KRbePxUly9+wVUKlQaWuKdZAc9PIiO6RJpDxAYQf+F4JDpmhQMNMn6MoZoVF5o6
G0ujnU1FHw4HyPPXbsFMUw+1bado1L4dPo3H42kibFN0gtrBCOw=
=Tgw1
-----END PGP SIGNATURE-----