Deprecated GTK3 API, GDB auto-load files

Resolves: #1105940
This commit is contained in:
Jakub Filak 2014-06-10 14:02:35 +02:00
parent 041a3f6838
commit 3c88c48e11
3 changed files with 182 additions and 1 deletions

View File

@ -0,0 +1,121 @@
From 77a270a948216a8bb5bcc960042aeb467794b593 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Mon, 9 Jun 2014 17:13:09 +0200
Subject: [ABRT PATCH 4/5] gdb: disable loading of auto-loaded files
https://sourceware.org/gdb/onlinedocs/gdb/Auto_002dloading.html
There are two main reasons for doing so:
1. we cannot trust anybody
- the auto-loaded file may change the output format
- security?
2. bugs in such a files (#817)
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/lib/hooklib.c | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/src/lib/hooklib.c b/src/lib/hooklib.c
index 4a50727..21ad9e0 100644
--- a/src/lib/hooklib.c
+++ b/src/lib/hooklib.c
@@ -252,10 +252,12 @@ char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char
/* Let user know what's going on */
log(_("Generating backtrace"));
- char *args[21];
+ char *args[23];
args[0] = (char*)"gdb";
args[1] = (char*)"-batch";
args[2] = (char*)"-ex";
+ args[3] = (char*)"set auto-load off";
+ args[4] = (char*)"-ex";
struct strbuf *set_debug_file_directory = strbuf_new();
if(debuginfo_dirs == NULL)
{
@@ -278,7 +280,7 @@ char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char
p = colon_or_nul;
}
}
- args[3] = strbuf_free_nobuf(set_debug_file_directory);
+ args[5] = strbuf_free_nobuf(set_debug_file_directory);
/* "file BINARY_FILE" is needed, without it gdb cannot properly
* unwind the stack. Currently the unwind information is located
@@ -300,27 +302,27 @@ char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char
* TODO: check mtimes on COREFILE and BINARY_FILE and not supply
* BINARY_FILE if it is newer (to at least avoid gdb complaining).
*/
- args[4] = (char*)"-ex";
- args[5] = xasprintf("file %s", executable);
- free(executable);
-
args[6] = (char*)"-ex";
- args[7] = xasprintf("core-file %s/"FILENAME_COREDUMP, dump_dir_name);
+ args[7] = xasprintf("file %s", executable);
+ free(executable);
args[8] = (char*)"-ex";
- /*args[9] = ... see below */
+ args[9] = xasprintf("core-file %s/"FILENAME_COREDUMP, dump_dir_name);
+
args[10] = (char*)"-ex";
- args[11] = (char*)"info sharedlib";
- /* glibc's abort() stores its message in __abort_msg variable */
+ /*args[11] = ... see below */
args[12] = (char*)"-ex";
- args[13] = (char*)"print (char*)__abort_msg";
+ args[13] = (char*)"info sharedlib";
+ /* glibc's abort() stores its message in __abort_msg variable */
args[14] = (char*)"-ex";
- args[15] = (char*)"print (char*)__glib_assert_msg";
+ args[15] = (char*)"print (char*)__abort_msg";
args[16] = (char*)"-ex";
- args[17] = (char*)"info all-registers";
+ args[17] = (char*)"print (char*)__glib_assert_msg";
args[18] = (char*)"-ex";
- args[19] = (char*)"disassemble";
- args[20] = NULL;
+ args[19] = (char*)"info all-registers";
+ args[20] = (char*)"-ex";
+ args[21] = (char*)"disassemble";
+ args[22] = NULL;
/* Get the backtrace, but try to cap its size */
/* Limit bt depth. With no limit, gdb sometimes OOMs the machine */
@@ -330,9 +332,9 @@ char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char
char *bt = NULL;
while (1)
{
- args[9] = xasprintf("%s backtrace %u%s", thread_apply_all, bt_depth, full);
+ args[11] = xasprintf("%s backtrace %u%s", thread_apply_all, bt_depth, full);
bt = exec_vp(args, /*redirect_stderr:*/ 1, timeout_sec, NULL);
- free(args[9]);
+ free(args[11]);
if ((bt && strnlen(bt, 256*1024) < 256*1024) || bt_depth <= 32)
{
break;
@@ -357,7 +359,7 @@ char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char
* End of assembler dump.
* (IOW: "empty" dump)
*/
- args[19] = (char*)"disassemble $pc-20, $pc+64";
+ args[21] = (char*)"disassemble $pc-20, $pc+64";
if (bt_depth <= 64 && thread_apply_all[0] != '\0')
{
@@ -373,9 +375,9 @@ char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char
}
}
- free(args[3]);
free(args[5]);
free(args[7]);
+ free(args[9]);
return bt;
}
--
1.8.3.1

View File

@ -0,0 +1,53 @@
From 4f468492682212eeff91a4d7e35e868820d05c9b Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 10 Jun 2014 10:39:19 +0200
Subject: [ABRT PATCH 5/5] replace deprecated GTK3 functions
Closes rhbz#1105940
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/configuration-gui/abrt-config-widget.c | 7 +++++++
src/configuration-gui/system-config-abrt.c | 4 ++++
2 files changed, 11 insertions(+)
diff --git a/src/configuration-gui/abrt-config-widget.c b/src/configuration-gui/abrt-config-widget.c
index 45eac95..664180d 100644
--- a/src/configuration-gui/abrt-config-widget.c
+++ b/src/configuration-gui/abrt-config-widget.c
@@ -280,7 +280,14 @@ abrt_config_widget_init(AbrtConfigWidget *self)
connect_switch_with_option(self, ABRT_OPT_SILENT_SHORTENED_REPORTING, "switch_silent_shortened_reporting");
connect_switch_with_option(self, ABRT_OPT_NOTIFY_INCOMPLETE_PROBLEMS, "switch_notify_incomplete_problems");
+#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 13) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 13 && GTK_MICRO_VERSION == 1))
+ /* https://developer.gnome.org/gtk3/3.13/GtkWidget.html#gtk-widget-reparent */
+ /* gtk_widget_reparent has been deprecated since version 3.13.2 and should not be used in newly-written code. */
gtk_widget_reparent(WID("grid"), GTK_WIDGET(self));
+#else
+ gtk_container_remove(GTK_CONTAINER(WID("window1")), WID("grid"));
+ gtk_container_add(GTK_CONTAINER(self), WID("grid"));
+#endif
/* Set the initial state of the properties */
gtk_widget_show_all(GTK_WIDGET(self));
diff --git a/src/configuration-gui/system-config-abrt.c b/src/configuration-gui/system-config-abrt.c
index bd9f13f..b3bf1b0 100644
--- a/src/configuration-gui/system-config-abrt.c
+++ b/src/configuration-gui/system-config-abrt.c
@@ -53,9 +53,13 @@ GtkWidget *system_config_abrt_widget_new_with_close_button(system_config_abrt_wi
gtk_widget_set_visible(GTK_WIDGET(config), TRUE);
gtk_box_pack_start(box, GTK_WIDGET(config), /*expand*/TRUE, /*fill*/TRUE, /*padding*/0);
+#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 13) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 13 && GTK_MICRO_VERSION == 1))
+ /* https://developer.gnome.org/gtk3/3.13/GtkAlignment.html#gtk-alignment-new */
+ /* GtkAlignment has been deprecated. Use GtkWidget alignment and margin properties */
gtk_box_pack_start(GTK_BOX(box),
gtk_alignment_new(/*xalign*/.5, /*yalign*/.5, /*xscale*/.5, /*yscale*/.5),
/*expand*/TRUE, /*fill*/TRUE, /*padding*/0);
+#endif
GtkWidget *buttons = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, /*spacing*/0);
gtk_box_pack_start(GTK_BOX(box), buttons, /*expand*/TRUE, /*fill*/FALSE, /*padding*/0);
--
1.8.3.1

View File

@ -40,7 +40,7 @@
Summary: Automatic bug detection and reporting tool
Name: abrt
Version: 2.2.1
Release: 5%{?dist}
Release: 6%{?dist}
License: GPLv2+
Group: Applications/System
URL: https://fedorahosted.org/abrt/
@ -50,6 +50,8 @@ Patch0: disable-OpenGPGCheck-in-Fedora-Rawhide.patch
Patch2: 0002-dbus-Fix-desktop-centric-polkit-policy-file.patch
Patch3: 0003-dbus-Fix-invalid-dbus-policy-file.patch
Patch4: 0004-gdb-disable-loading-of-auto-loaded-files.patch
Patch5: 0005-replace-deprecated-GTK3-functions.patch
# '%%autosetup -S git' -> git
BuildRequires: git
@ -925,6 +927,11 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%config(noreplace) %{_sysconfdir}/profile.d/abrt-console-notification.sh
%changelog
* Tue Jun 10 2014 Jakub Filak <jfilak@redhat.com> - 2.2.1-6
- configui: do not use deprecated gtk3 API
- gdb: disable auto-loaded files
- Resolves: #1105940
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild