Compare commits

...

2 Commits
rawhide ... f35

Author SHA1 Message Date
Michal Srb ec34e3100a abrt-dbus: Fix SIGSEGV with glib2 >= 2.69.2
See rhbz#1997315.
2021-10-05 18:44:21 +02:00
Matěj Grabovský 12882eb718 Backport Python lazy loading patch (rhbz#2007664) 2021-09-27 12:43:52 +02:00
5 changed files with 103 additions and 81 deletions

View File

@ -0,0 +1,57 @@
From 4755f2171aa50a72d8ec03260c8cbc602263a6c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Fri, 24 Sep 2021 17:48:07 +0200
Subject: [PATCH] Use lazy imports in abrt_exception_handler3
The abrt_exception_handler3 module is always imported when Python starts,
but all the modules imported from it (except sys) are only used during crashes.
Especially the systemd.journal import is really expensive.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2007664
---
src/hooks/abrt_exception_handler3.py.in | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/hooks/abrt_exception_handler3.py.in b/src/hooks/abrt_exception_handler3.py.in
index 89e2474b..0bc548e0 100644
--- a/src/hooks/abrt_exception_handler3.py.in
+++ b/src/hooks/abrt_exception_handler3.py.in
@@ -20,13 +20,15 @@
Module for the ABRT exception handling hook
"""
+# Avoid importing anything but sys here, use lazy imports.
+# This file is imported on every Python startup,
+# all unused imports only increase the startup time and memory usage.
import sys
-import os
-from systemd import journal
def syslog(msg):
"""Log message to system logger (journal)"""
+ from systemd import journal
journal.send(msg)
@@ -68,6 +70,8 @@ def send(data):
def write_dump(tb_text, tb):
+ import os
+
if sys.argv[0][0] == "/":
executable = os.path.abspath(sys.argv[0])
else:
@@ -118,6 +122,7 @@ def handle_exception(etype, value, tb):
sys.excepthook = sys.__excepthook__ # pylint: disable-msg=E1101
import errno
+ import os
# Ignore Ctrl-C
# SystemExit rhbz#636913 -> this exception is not an error
--
2.31.1

View File

@ -1,40 +0,0 @@
From 1f2963b0611d4023957abe3c7391eab86256ba82 Mon Sep 17 00:00:00 2001
From: Michal Fabik <mfabik@redhat.com>
Date: Wed, 23 Sep 2020 16:55:25 +0200
Subject: [PATCH] hooklib: Don't g_autofree backtrace
The result of abrt_get_backtrace was being freed every time, even when
no error occured.
Resolves:
https://github.com/abrt/abrt/issues/1528
https://bugzilla.redhat.com/show_bug.cgi?id=1881745
Signed-off-by: Michal Fabik <mfabik@redhat.com>
---
src/lib/hooklib.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lib/hooklib.c b/src/lib/hooklib.c
index dceaeb16..56b77bc3 100644
--- a/src/lib/hooklib.c
+++ b/src/lib/hooklib.c
@@ -348,7 +348,7 @@ char *abrt_get_backtrace(struct dump_dir *dd, unsigned timeout_sec, const char *
unsigned bt_depth = 1024;
const char *thread_apply_all = "thread apply all -ascending";
const char *full = "full ";
- g_autofree char *bt = NULL;
+ char *bt = NULL;
while (1)
{
args[bt_cmd_index] = g_strdup_printf("%s backtrace %s%u", thread_apply_all, full, bt_depth);
@@ -367,6 +367,7 @@ char *abrt_get_backtrace(struct dump_dir *dd, unsigned timeout_sec, const char *
/* (NB: in fact, current impl. of exec_vp() never returns NULL) */
log_warning("Failed to generate backtrace, reducing depth to %u",
bt_depth);
+ free(bt);
/* Replace -ex disassemble (which disasms entire function $pc points to)
* to a version which analyzes limited, small patch of code around $pc.
--
2.26.2

View File

@ -0,0 +1,35 @@
From 564c1050e150a083a7d80cbfdd7ede7620e5124f Mon Sep 17 00:00:00 2001
From: Michal Srb <michal@redhat.com>
Date: Tue, 5 Oct 2021 18:43:27 +0200
Subject: [PATCH] abrt-dbus: do not try to free session data twice
We free session data in on_g_signal() function, which is also
invoked when client disappears. Therefore, we don't need to register the
same free function in g_bus_watch_name_on_connection().
glib2 2.69.2 changed (fixed?) how/when g_bus_watch_name_on_connection()
calls the provided free function and it uncovered this problem in abrt-dbus.
See rhbz#1997315 for more details.
Signed-off-by: Michal Srb <michal@redhat.com>
---
src/dbus/abrt_problems2_service.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/dbus/abrt_problems2_service.c b/src/dbus/abrt_problems2_service.c
index 8d543f44..004c7aeb 100644
--- a/src/dbus/abrt_problems2_service.c
+++ b/src/dbus/abrt_problems2_service.c
@@ -571,7 +571,7 @@ static AbrtP2Object *session_object_register(AbrtP2Service *service,
obj->owner_watcher_id = g_bus_watch_name_on_connection(connection, caller,
G_BUS_NAME_WATCHER_FLAGS_NONE,
NULL, abrt_p2_service_on_session_owner_vanished,
- obj, (GDestroyNotify)abrt_p2_object_destroy);
+ obj, NULL);
return obj;
}
--
2.31.1

View File

@ -1,40 +0,0 @@
From 5fa7b1f84fb02ca5dcf50d27f4bc14563c1918f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C4=9Bj=20Grabovsk=C3=BD?= <mgrabovs@redhat.com>
Date: Mon, 12 Oct 2020 19:14:03 +0200
Subject: [PATCH] hooklib: Proper freeing of backtrace
Improper bracing caused the bt variable to be freed every time in every
iteration no matter what. This would then lead to an invalid (freed)
pointer being returned by the function.
The mistake was made in 1f2963b0 and reported by Jeff Law.
---
src/lib/hooklib.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/lib/hooklib.c b/src/lib/hooklib.c
index 56b77bc3..fc2a6a00 100644
--- a/src/lib/hooklib.c
+++ b/src/lib/hooklib.c
@@ -361,13 +361,17 @@ char *abrt_get_backtrace(struct dump_dir *dd, unsigned timeout_sec, const char *
bt_depth /= 2;
if (bt)
+ {
log_warning("Backtrace is too big (%u bytes), reducing depth to %u",
(unsigned)strlen(bt), bt_depth);
+ }
else
+ {
/* (NB: in fact, current impl. of exec_vp() never returns NULL) */
log_warning("Failed to generate backtrace, reducing depth to %u",
bt_depth);
- free(bt);
+ g_clear_pointer(&bt, free);
+ }
/* Replace -ex disassemble (which disasms entire function $pc points to)
* to a version which analyzes limited, small patch of code around $pc.
--
2.26.2

View File

@ -49,7 +49,7 @@
Summary: Automatic bug detection and reporting tool
Name: abrt
Version: 2.14.6
Release: 7%{?dist}
Release: 9%{?dist}
License: GPLv2+
URL: https://abrt.readthedocs.org/
Source: https://github.com/abrt/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
@ -136,6 +136,9 @@ BuildRequires: python3-libreport
BuildRequires: python3-devel
%endif
Patch0: 0001-Use-lazy-imports-in-abrt_exception_handler3.patch
Patch2: 0002-abrt-dbus-do-not-try-to-free-session-data-twice.patch
%description
%{name} is a tool to help users to detect defects in applications and
to create a bug report with all information needed by maintainer to fix it.
@ -1001,6 +1004,13 @@ killall abrt-dbus >/dev/null 2>&1 || :
%config(noreplace) %{_sysconfdir}/profile.d/abrt-console-notification.sh
%changelog
* Tue Oct 05 2021 Michal Srb <michal@redhat.com> - 2.14.6-9
- abrt-dbus: Fix SIGSEGV with glib2 >= 2.69.2 (rhbz#1997315)
* Mon Sep 27 2021 Matěj Grabovský <mgrabovs@redhat.com> - 2.14.6-8
- Use lazy import in the Python exception handler to avoid slowdown in Python
startup (rhbz#2007664)
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.14.6-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild