On Mon, 2013-09-30 at 18:03 +0200, [email protected]
wrote:
> On Mon, Sep 30, 2013 at 17:09:29 +0200, [email protected] 
> wrote:
> > Hi,
> > 
> > meanwhile, I could nail it down to the compiler/linker flags used for
> > the package build (export DEB_BUILD_MAINT_OPTIONS = hardening=+all).
> > 
> > I'll report back what flag exactly causes the
> > segfault.
> 
> The segfault happens when I build with -fPIE and link with -fPIE -pie.
> As this mainly deals with address space layout, my guess is that this
> just unhides another bug.

Bingo! You've found a 64 bit bug in sync-ui. As the other bug, this goes
back to the original development of the UI.

At one point, it passes a string pointer through a 32bit unsigned int,
which only works as long as the memory actually lies in the lower
address range. PIE mode seems to change that such that the conversion
drops significant bits, while running under valgrind changes it back to
"working" again.

I was able to reproduce it with these compile flags. Attached the fix.

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.

>From 4e46736d9085f7b08db5caf78c9f54c9b7988f9d Mon Sep 17 00:00:00 2001
From: Patrick Ohly <[email protected]>
Date: Mon, 30 Sep 2013 22:03:42 +0200
Subject: [PATCH] GTK/GTK3 UI: fix crash on 64 bit

While running a sync with a binary compiled with -fPIE -pie, a crash
in strlen() occured because a 64 bit string pointer coming from D-Bus
was incorrectly passed through a 32 bit unsigned variable.

These special compile flags merely caused the problem to occur
reliably, it may also have crashed under other circumstances.

Kudos to Tino Keitel for reporting the problem and identifying the
relation to the compile flags.
---
 src/dbus/glib/syncevo-marshal.list |    1 +
 src/dbus/glib/syncevo-session.c    |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/dbus/glib/syncevo-marshal.list b/src/dbus/glib/syncevo-marshal.list
index 24d4e1b..955af79 100644
--- a/src/dbus/glib/syncevo-marshal.list
+++ b/src/dbus/glib/syncevo-marshal.list
@@ -5,3 +5,4 @@ VOID:STRING,STRING,STRING
 VOID:STRING,STRING,STRING,STRING,STRING,BOXED
 VOID:INT,BOXED
 VOID:UINT,UINT,BOXED
+VOID:STRING,UINT,BOXED
diff --git a/src/dbus/glib/syncevo-session.c b/src/dbus/glib/syncevo-session.c
index c845786..80123da 100644
--- a/src/dbus/glib/syncevo-session.c
+++ b/src/dbus/glib/syncevo-session.c
@@ -249,7 +249,7 @@ syncevo_session_init (SyncevoSession *session)
                                        G_TYPE_BOXED,
                                        G_TYPE_INVALID);
     /* StatusChanged */
-    dbus_g_object_register_marshaller (syncevo_marshal_VOID__UINT_UINT_BOXED,
+    dbus_g_object_register_marshaller (syncevo_marshal_VOID__STRING_UINT_BOXED,
                                        G_TYPE_NONE,
                                        G_TYPE_STRING,
                                        G_TYPE_UINT,
-- 
1.7.10.4

_______________________________________________
SyncEvolution mailing list
[email protected]
https://lists.syncevolution.org/mailman/listinfo/syncevolution

Reply via email to