Fix segfault in lvmdbusd on s390x

This commit is contained in:
Marian Csontos 2023-04-04 18:24:31 +02:00
parent 7a015859c9
commit 5670e60d59
3 changed files with 96 additions and 4 deletions

View File

@ -0,0 +1,42 @@
From da1255cdb68ab33a90136ebbec2fa0fda034f6a2 Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Thu, 30 Mar 2023 10:07:13 -0500
Subject: [PATCH 2/3] lvmdbusd: Correct locking for _common_log
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reduce the lock time and include the flush in the lock.
Reported by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
daemons/lvmdbusd/utils.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmdbusd/utils.py b/daemons/lvmdbusd/utils.py
index 6013b656f..fdd7578c1 100644
--- a/daemons/lvmdbusd/utils.py
+++ b/daemons/lvmdbusd/utils.py
@@ -323,16 +323,17 @@ def _format_log_entry(msg):
def _common_log(msg, *attributes):
- cfg.stdout_lock.acquire()
msg = _format_log_entry(msg)
+ cfg.stdout_lock.acquire()
+
if STDOUT_TTY and attributes:
print(color(msg, *attributes))
else:
print(msg)
- cfg.stdout_lock.release()
sys.stdout.flush()
+ cfg.stdout_lock.release()
# Serializes access to stdout to prevent interleaved output
--
2.39.2

View File

@ -0,0 +1,47 @@
From feb7c701aa86fda1f13f6c262770a8e90e8ddb09 Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Thu, 30 Mar 2023 10:10:23 -0500
Subject: [PATCH 3/3] lvmdbusd: Correct seg. fault on s390x ELN
syscall 186 is specific to x86 64bit. As this is different from arch
to arch and between same arch different arch size we will only grab
thread ID using built-in python support if it is supported.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2166931
---
daemons/lvmdbusd/utils.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmdbusd/utils.py b/daemons/lvmdbusd/utils.py
index fdd7578c1..27b869c13 100644
--- a/daemons/lvmdbusd/utils.py
+++ b/daemons/lvmdbusd/utils.py
@@ -11,7 +11,6 @@ import xml.etree.ElementTree as Et
import sys
import inspect
import collections
-import ctypes
import errno
import fcntl
import os
@@ -305,8 +304,16 @@ class DebugMessages(object):
self.queue.clear()
+def _get_tid():
+ try:
+ # Only 3.8 and later have this
+ return threading.get_native_id()
+ except:
+ return -1
+
+
def _format_log_entry(msg):
- tid = ctypes.CDLL('libc.so.6').syscall(186)
+ tid = _get_tid()
if not cfg.systemd and STDOUT_TTY:
msg = "%s: %d:%d - %s" % \
--
2.39.2

View File

@ -45,15 +45,16 @@ Name: lvm2
Epoch: %{rhel} Epoch: %{rhel}
%endif %endif
Version: 2.03.20 Version: 2.03.20
Release: 2%{?dist} Release: 3%{?dist}
License: GPLv2 License: GPLv2
URL: https://sourceware.org/lvm2/ URL: https://sourceware.org/lvm2/
Source0: https://sourceware.org/pub/lvm2/releases/LVM2.%{version}.tgz Source0: https://sourceware.org/pub/lvm2/releases/LVM2.%{version}.tgz
# https://bugzilla.redhat.com/show_bug.cgi?id=2180557 # https://bugzilla.redhat.com/show_bug.cgi?id=2180557
# https://github.com/lvmteam/lvm2/pull/114 # https://github.com/lvmteam/lvm2/pull/114
# Fix an invalid import which breaks lvm2-lvmdbusd.service and thus anaconda # Fix an invalid import which breaks lvm2-lvmdbusd.service and thus anaconda
Patch0: 0001-Fix-import-of-utils-from-lvmdbusd.cfg.patch Patch1: 0001-Fix-import-of-utils-from-lvmdbusd.cfg.patch
#Patch1: 0001-* Patch2: 0002-lvmdbusd-Correct-locking-for-_common_log.patch
Patch3: 0003-lvmdbusd-Correct-seg.-fault-on-s390x-ELN.patch
BuildRequires: make BuildRequires: make
BuildRequires: gcc BuildRequires: gcc
@ -107,7 +108,6 @@ or more physical volumes and creating one or more logical volumes
%prep %prep
%autosetup -p1 -n LVM2.%{version} %autosetup -p1 -n LVM2.%{version}
#%%patch1 -p1 -b .backup1
%build %build
%global _default_pid_dir /run %global _default_pid_dir /run
@ -660,6 +660,9 @@ An extensive functional testsuite for LVM2.
%endif %endif
%changelog %changelog
* Tue Apr 04 2023 Marian Csontos <mcsontos@redhat.com> - 2.03.20-3
- Fix segfault in lvmdbusd on s390x.
* Tue Mar 21 2023 Adam Williamson <awilliam@redhat.com> - 2.03.20-2 * Tue Mar 21 2023 Adam Williamson <awilliam@redhat.com> - 2.03.20-2
- Backport PR #114 to fix #2180557 - Backport PR #114 to fix #2180557