]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-journal: store and compare per-module static origin id
authorLuca Boccassi <bluca@debian.org>
Tue, 25 Apr 2023 00:08:46 +0000 (01:08 +0100)
committerLuca Boccassi <bluca@debian.org>
Tue, 25 Apr 2023 11:24:25 +0000 (12:24 +0100)
commite046719b749ebba5d44d92c7e0a9fb207d545ff7
tree0d39531a5d3302aaa6fd358fdbb6eaed116d06ab
parentbf876e3f3e7c38635547cd87de7621eb8e3e946c
sd-journal: store and compare per-module static origin id

sd-journal objects use hashmaps, which use module-global state, so it is not safe
to pass a sd-journal object created by a module instance to another module instance
(e.g.: when two libraries static linking sd-journal are pulled in a single process).
Initialize a random per-module origin id and store it in the object, and compare
it when entering a public API, and error out if they don't match, together with
the PID.
man/sd_journal_get_data.xml
src/libsystemd/sd-journal/journal-internal.h
src/libsystemd/sd-journal/sd-journal.c
src/libsystemd/sd-journal/test-journal-init.c