Bug#852082: gwc in testing crashes at startup

2017-01-23 Thread James Cowgill
Control: tags -1 patch

Hi,

On 23/01/17 15:29, James Cowgill wrote:
> On 23/01/17 12:39, Jaromír Mikeš wrote:
>> 2017-01-22 1:11 GMT+01:00 James Cowgill :
>> On 21/01/17 14:18, Christian Grigis wrote:
>> [...]
>> > The gdb backtrace gives:
>> >
>> > (gdb) run
>> > Starting program: /home/glove/tmp/gwc-testing/gwc-0.21.19~dfsg0/gwc
>> > [Thread debugging using libthread_db enabled]
>> > Using host libthread_db library 
>> "/lib/x86_64-linux-gnu/libthread_db.so.1".
>> > Current stack limit: 8388608 bytes
>> >
>> > Program received signal SIGSEGV, Segmentation fault.
>> > 0x76e047f9 in g_type_is_a () from 
>> /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
>> > (gdb) bt
>> > #0  0x76e047f9 in g_type_is_a () from 
>> /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
>> > #1  0x77519084 in gtk_type_new () from 
>> /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
>> > #2  0x5557223c in led_bar_new (segments=20, orientation=0) at 
>> gtkledbar.c:82
>>
>> The problem is here. led_bar_get_type returns an unsigned int, but
>> gtk_type_new expects a "GtkType" which is an integer with the same size
>> as a pointer. This code is going to need porting to work on 64-bit
>> arches.
>>
>> James I guess as it wouldn't be trivial to fix it by patch and we need
>> to this issue must be fixed upstream.
>> Am I right?
> 
> It's definitely an upstream issue, but I fear that by just pushing it
> upstream the package will be kicked out of stretch. It's hard to say how
> much work it would be until someone tries to fix it - it could be just
> this one function that's broken, or it could be many. You can probably
> catch a lot of these by enabling -Wconversion.

Looks like there weren't many instances of this particular bug (loads of
warnings to sieve through though). This patch should fix it.

James
Description: Fix pointer truncation issues in 2 _get_type functions
 On 64-bit architectures the pointers returned by these functions were being
 truncated to 32-bits causing segfaults.
Author: James Cowgill 
Bug-Debian: https://bugs.debian.org/852082
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/gtkgamma.c
+++ b/gtkgamma.c
@@ -202,10 +202,10 @@ static char *xpm[][27] =
 }
   };
 
-guint
+GtkType
 gtk_gamma_curve_get_type (void)
 {
-  static guint gamma_curve_type = 0;
+  static GtkType gamma_curve_type = 0;
 
   if (!gamma_curve_type)
 {
--- a/gtkgamma.h
+++ b/gtkgamma.h
@@ -68,7 +68,7 @@ struct _GtkGammaCurveClass
 };
 
 
-guint  gtk_gamma_curve_get_type (void);
+GtkTypegtk_gamma_curve_get_type (void);
 GtkWidget* gtk_gamma_curve_new  (void);
 
 
--- a/gtkledbar.c
+++ b/gtkledbar.c
@@ -28,10 +28,10 @@
 static void led_bar_class_init(LedBarClass *klass);
 static void led_bar_init  (LedBar  *led_bar);
 
-guint
+GtkType
 led_bar_get_type ()
 {
-  static guint led_bar_type = 0;
+  static GtkType led_bar_type = 0;
 
   if (!led_bar_type)
 {
--- a/gtkledbar.h
+++ b/gtkledbar.h
@@ -57,7 +57,7 @@ struct _LedBarClass
   GtkVBoxClass   parent_class;
 };
 
-guint led_bar_get_type(void);
+GtkType   led_bar_get_type(void);
 GtkWidget*led_bar_new (gint   segments,
 	   gint   orientation);
 gint  led_bar_get_num_segments(GtkWidget  *bar);


signature.asc
Description: OpenPGP digital signature


Bug#852082: gwc in testing crashes at startup

2017-01-23 Thread James Cowgill
Hi,

On 23/01/17 12:39, Jaromír Mikeš wrote:
> 2017-01-22 1:11 GMT+01:00 James Cowgill :
> On 21/01/17 14:18, Christian Grigis wrote:
> [...]
> > The gdb backtrace gives:
> >
> > (gdb) run
> > Starting program: /home/glove/tmp/gwc-testing/gwc-0.21.19~dfsg0/gwc
> > [Thread debugging using libthread_db enabled]
> > Using host libthread_db library 
> "/lib/x86_64-linux-gnu/libthread_db.so.1".
> > Current stack limit: 8388608 bytes
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x76e047f9 in g_type_is_a () from 
> /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
> > (gdb) bt
> > #0  0x76e047f9 in g_type_is_a () from 
> /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
> > #1  0x77519084 in gtk_type_new () from 
> /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
> > #2  0x5557223c in led_bar_new (segments=20, orientation=0) at 
> gtkledbar.c:82
> 
> The problem is here. led_bar_get_type returns an unsigned int, but
> gtk_type_new expects a "GtkType" which is an integer with the same size
> as a pointer. This code is going to need porting to work on 64-bit
> arches.
> 
> James I guess as it wouldn't be trivial to fix it by patch and we need
> to this issue must be fixed upstream.
> Am I right?

It's definitely an upstream issue, but I fear that by just pushing it
upstream the package will be kicked out of stretch. It's hard to say how
much work it would be until someone tries to fix it - it could be just
this one function that's broken, or it could be many. You can probably
catch a lot of these by enabling -Wconversion.

Thanks,
James



signature.asc
Description: OpenPGP digital signature


Bug#852082: gwc in testing crashes at startup

2017-01-23 Thread Jaromír Mikeš
2017-01-22 1:11 GMT+01:00 James Cowgill :

> Control: severity -1 grave
>

Hi,

sorry for slightly delayed answer :(


> On 21/01/17 14:18, Christian Grigis wrote:
> > Package: gwc
> > Version: 0.21.19~dfsg0-6
> > Severity: important
> >
> > Running 'gnome_wave_cleaner' from the testing package version
> > (0.21.19~dfsg0-6) crashes immediately at startup:
> >
> > $ gnome_wave_cleaner
> > Current stack limit: 8388608 bytes
> > Segmentation fault
>
> This bug is clearly RC. Jaromír, you did test this before uploading it
> right?
>

Actually I didn't as upload was only "debian packaging improvement" not new
upstream release
I was not expecting problems of this kind ... sorry


> [...]
> > The gdb backtrace gives:
> >
> > (gdb) run
> > Starting program: /home/glove/tmp/gwc-testing/gwc-0.21.19~dfsg0/gwc
> > [Thread debugging using libthread_db enabled]
> > Using host libthread_db library "/lib/x86_64-linux-gnu/
> libthread_db.so.1".
> > Current stack limit: 8388608 bytes
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x76e047f9 in g_type_is_a () from /usr/lib/x86_64-linux-gnu/
> libgobject-2.0.so.0
> > (gdb) bt
> > #0  0x76e047f9 in g_type_is_a () from /usr/lib/x86_64-linux-gnu/
> libgobject-2.0.so.0
> > #1  0x77519084 in gtk_type_new () from /usr/lib/x86_64-linux-gnu/
> libgtk-x11-2.0.so.0
> > #2  0x5557223c in led_bar_new (segments=20, orientation=0) at
> gtkledbar.c:82
>
> The problem is here. led_bar_get_type returns an unsigned int, but
> gtk_type_new expects a "GtkType" which is an integer with the same size
> as a pointer. This code is going to need porting to work on 64-bit arches.
>

James I guess as it wouldn't be trivial to fix it by patch and we need to
this issue must be fixed upstream.
Am I right?

best regards

mira


Bug#852082: gwc in testing crashes at startup

2017-01-21 Thread James Cowgill
Control: severity -1 grave

Hi,

[Jaromír: please send mail to the bug, not the list]

On 21/01/17 14:18, Christian Grigis wrote:
> Package: gwc
> Version: 0.21.19~dfsg0-6
> Severity: important
> 
> Running 'gnome_wave_cleaner' from the testing package version
> (0.21.19~dfsg0-6) crashes immediately at startup:
> 
> $ gnome_wave_cleaner 
> Current stack limit: 8388608 bytes
> Segmentation fault

This bug is clearly RC. Jaromír, you did test this before uploading it
right?

[...]
> The gdb backtrace gives:
> 
> (gdb) run
> Starting program: /home/glove/tmp/gwc-testing/gwc-0.21.19~dfsg0/gwc 
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> Current stack limit: 8388608 bytes
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x76e047f9 in g_type_is_a () from 
> /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
> (gdb) bt
> #0  0x76e047f9 in g_type_is_a () from 
> /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
> #1  0x77519084 in gtk_type_new () from 
> /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
> #2  0x5557223c in led_bar_new (segments=20, orientation=0) at 
> gtkledbar.c:82

The problem is here. led_bar_get_type returns an unsigned int, but
gtk_type_new expects a "GtkType" which is an integer with the same size
as a pointer. This code is going to need porting to work on 64-bit arches.

> I experimented with optimization levels but even -O0 gives the crash.
> 
> However, it looks like it is related to the compiler, because forcing to
> compile with gcc-5 instead of gcc-6 produces a binary that starts up
> normally.

This is probably related to PIE being enabled. I suspect that without
PIE (and therefore ASLR), by chance all the pointers were < 4GB so the
bug never occurred.

James



signature.asc
Description: OpenPGP digital signature


Bug#852082: gwc in testing crashes at startup

2017-01-21 Thread Christian Grigis
Package: gwc
Version: 0.21.19~dfsg0-6
Severity: important

Running 'gnome_wave_cleaner' from the testing package version
(0.21.19~dfsg0-6) crashes immediately at startup:

$ gnome_wave_cleaner 
Current stack limit: 8388608 bytes
Segmentation fault

This is reproducible when building from sources:

~/tmp/gwc-testing/gwc-0.21.19~dfsg0$ ./gwc
Current stack limit: 8388608 bytes
Segmentation fault

It does not appear to depend on package contents differences between
stable and testing, as using the 0.21.19~dfsg0-4 package version results
in the same crash.

The gdb backtrace gives:

(gdb) run
Starting program: /home/glove/tmp/gwc-testing/gwc-0.21.19~dfsg0/gwc 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Current stack limit: 8388608 bytes

Program received signal SIGSEGV, Segmentation fault.
0x76e047f9 in g_type_is_a () from 
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
(gdb) bt
#0  0x76e047f9 in g_type_is_a () from 
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#1  0x77519084 in gtk_type_new () from 
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#2  0x5557223c in led_bar_new (segments=20, orientation=0) at 
gtkledbar.c:82
#3  0x55561cc9 in main (argc=1, argv=0x7fffe308) at gwc.c:3109

I experimented with optimization levels but even -O0 gives the crash.

However, it looks like it is related to the compiler, because forcing to
compile with gcc-5 instead of gcc-6 produces a binary that starts up
normally.

Please let me know if I can provide more information.

Thank you and best regards,

-Christian


-- System Information:
Debian Release: 9.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.7.0-mooch.1-amd64 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages gwc depends on:
ii  libc6 2.24-9
ii  libfftw3-double3  3.3.5-3
ii  libglib2.0-0  2.50.2-2
ii  libgnome-2-0  2.32.1-5
ii  libgnomeui-0  2.24.5-3.1
ii  libgtk2.0-0   2.24.31-1
ii  libpulse0 10.0-1
ii  libsndfile1   1.0.27-1
ii  libvorbisfile31.3.5-4

gwc recommends no packages.

Versions of packages gwc suggests:
ii  chromium [www-browser]   55.0.2883.75-5
ii  elinks [www-browser] 0.12~pre6-12
ii  elvis-console [www-browser]  2.2.0-12
ii  firefox-esr [www-browser]45.6.0esr-1
ii  lynx [www-browser]   2.8.9dev11-1
ii  w3m [www-browser]0.5.3-34
ii  yelp 3.22.0-1

-- no debconf information