Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cd14d3fcc0e03136d0cea…
Commit: cd14d3fcc0e03136d0cea1ab1a9edff3b8b9dbeb
Parent: c8f2125b85afe043af1b2e887a80f882b8d8d7c7
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 7 14:45:06 2023 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Mar 7 15:29:54 2023 +0100
toollib: fix segfault if using -S|--select with log/report_command_log=1 setting
When we are using -S|--select for non-reporting tools while using command log
reporting (log/report_command_log=1 setting), we need to create an internal
processing handle to handle the selection itself. In this case, the internal
processing handle to execute the selection (to process the -S|--select) has
a parent handle (that is processing the actual non-reporting command).
When this parent handle exists, we can't destroy the command log report
in destroy_processing_handle as there's still the parent processing to
finish. The parent processing may still generate logs which need to be
reported in the command log report. If the command log report was
destroyed prematurely together with destroying the internal processing
handle for -S|--select, then any subsequent log request from processing
the actual command (and hence an attermpt to access the command log report)
ended up with a segfault.
See also: https://bugzilla.redhat.com/show_bug.cgi?id=2175220
---
WHATS_NEW | 1 +
tools/toollib.c | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 8523b5eb7..7c979d69c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
version 2.03.20 -
====================================
+ Fix segfault if using -S|--select with log/report_command_log=1 setting.
Configure now fails when requested lvmlockd dependencies are missing.
Add some configure Gentoo enhancements for static builds.
diff --git a/tools/toollib.c b/tools/toollib.c
index 194088ea6..43e628abf 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -2050,7 +2050,20 @@ void destroy_processing_handle(struct cmd_context *cmd, struct processing_handle
log_restore_report_state(cmd->cmd_report.saved_log_report_state);
- if (!cmd->is_interactive) {
+ /*
+ * Do not destroy current cmd->report_group and cmd->log_rh
+ * (the log report) yet if we're running interactively
+ * (== running in lvm shell) or if there's a parent handle
+ * (== we're executing nested processing, like it is when
+ * doing selection for parent's process_each_* processing).
+ *
+ * In both cases, there's still possible further processing
+ * to do outside the processing covered by the handle we are
+ * destroying here and for which we may still need to access
+ * the log report to cover the rest of the processing.
+ *
+ */
+ if (!cmd->is_interactive && !handle->parent) {
if (!dm_report_group_destroy(cmd->cmd_report.report_group))
stack;
cmd->cmd_report.report_group = NULL;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=df6120e9f715c58327451…
Commit: df6120e9f715c58327451f650c003d09842f33c7
Parent: 8e27dfd40576f4e2828b169bfe18d8cae9968244
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon Mar 6 10:25:22 2023 -0600
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Mon Mar 6 10:25:22 2023 -0600
lvmdbusd: Move cfg.lvmdebug data init
Move this to the cfg file itself, so that initialization runs when it
gets processed.
---
daemons/lvmdbusd/cfg.py | 8 +++++---
daemons/lvmdbusd/main.py | 5 -----
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/daemons/lvmdbusd/cfg.py b/daemons/lvmdbusd/cfg.py
index 3ee852855..9da4b1267 100644
--- a/daemons/lvmdbusd/cfg.py
+++ b/daemons/lvmdbusd/cfg.py
@@ -11,6 +11,7 @@ import os
import multiprocessing
import queue
import itertools
+from utils import LvmDebugData
from lvmdbusd import path
@@ -18,6 +19,10 @@ LVM_CMD = os.getenv('LVM_BINARY', path.LVM_BINARY)
LOCK_FILE = os.getenv("LVM_DBUSD_LOCKFILE", "/var/lock/lvm/lvmdbusd")
+# Save off the debug data needed for lvm team to debug issues
+# only used for 'fullreport' at this time.
+lvmdebug = LvmDebugData(os.getenv('LVM_DBUSD_COLLECT_LVM_DEBUG', False))
+
# This is the global object manager
om = None
@@ -114,7 +119,4 @@ def exit_daemon():
loop.quit()
-# Debug data for lvm
-lvmdebug = None
-
systemd = False
diff --git a/daemons/lvmdbusd/main.py b/daemons/lvmdbusd/main.py
index e8bd3ce0e..e07710a5e 100644
--- a/daemons/lvmdbusd/main.py
+++ b/daemons/lvmdbusd/main.py
@@ -148,17 +148,12 @@ def running_under_systemd():
def main():
start = time.time()
use_session = os.getenv('LVM_DBUSD_USE_SESSION', False)
- collect_lvm_debug = os.getenv('LVM_DBUSD_COLLECT_LVM_DEBUG', False)
# Ensure that we get consistent output for parsing stdout/stderr and that we
# are using the lvmdbusd profile.
os.environ["LC_ALL"] = "C"
os.environ["LVM_COMMAND_PROFILE"] = "lvmdbusd"
- # Save off the debug data needed for lvm team to debug issues
- # only used for 'fullreport' at this time.
- cfg.lvmdebug = utils.LvmDebugData(collect_lvm_debug)
-
# Indicator if we are running under systemd
cfg.systemd = running_under_systemd()