[FIXED] 1.10.4 segfaults with GNUTLS support

Find a Bug in the app, site or forums? Please report it immediately so we can squash it as soon as possible.

[FIXED] 1.10.4 segfaults with GNUTLS support

Postby Mamoru TASAKA » Wed Jan 22, 2014 4:50 am

Michael Tunnell wrote:Moderator Message:
This bug has been fixed and will be released in 1.10.5 but since this would not affect a lot people it won't be pushed out until the next version is ready.


With compiling uget 1.10.4 with --enable-gnutls, adding
export LDFLAGS="$(libgcrypt-config --libs) " to avoid linkage error (as I wrote in viewtopic.php?f=6&t=615 ), just launching uget-gtk immediately segfaults:

$ gdb uget-gtk
GNU gdb (GDB) Fedora 7.6.50.20130731-16.fc20
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
..
Reading symbols from /usr/bin/uget-gtk...Reading symbols from /usr/lib/debug/usr/bin/uget-gtk.debug...done.
done.
(gdb) r
Starting program: /usr/bin/uget-gtk
Traceback (most recent call last):
File "/usr/share/gdb/auto-load/usr/lib/libgobject-2.0.so.0.3800.2-gdb.py", line 9, in <module>
from gobject import register
File "/usr/share/glib-2.0/gdb/gobject.py", line 3, in <module>
import gdb.backtrace
ImportError: No module named backtrace
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Missing separate debuginfo for /lib/libgraphite2.so.3
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/36/97551644f40941c8d12ed0b9efd53c224cc7a2.debug

Program received signal SIGSEGV, Segmentation fault.
0x47750038 in ?? ()
(gdb) bt
#0 0x47750038 in ?? ()
#1 0x421be2a8 in _gcry_ath_init () at ath.c:73
#2 0x421b732f in global_init () at global.c:105
#3 0x421b7625 in _gcry_vcontrol (cmd=cmd@entry=GCRYCTL_SET_THREAD_CBS, arg_ptr=<optimized out>, arg_ptr@entry=0xbfffea14 "0\003\b\b+\327\a\b") at global.c:452
#4 0x421b3d24 in gcry_control (cmd=cmd@entry=GCRYCTL_SET_THREAD_CBS) at visibility.c:78
#5 0x080513db in init_gnutls_locks () at UgApp-gtk-main.c:124
#6 main (argc=1, argv=0xbfffeac4) at UgApp-gtk-main.c:203


Using libgcrypt 1.5.3.

Reading libgcrypt-1.5.3/src/ath.c:
65 int
66 ath_init (void)
67 {
68 int err = 0;
69
70 if (ops_set)
71 {
72 if (ops.init)
73 err = (*ops.init) ();
74 if (err)
75 return err;
76 err = (*ops.mutex_init) (&check_init_lock);
77 }
78 return err;
79 }

perhaps ops.init is not initialized.
Mamoru TASAKA
 
Posts: 10
Joined: Mon Jan 20, 2014 8:36 am
Linux Distro: Fedora

Re: 1.10.4 segfaults with GNUTLS support

Postby chhuang » Mon Jan 27, 2014 2:31 am

You are right. Program doesn't initialize gnutls locks.
I have commit for this bug again.
chhuang
Site Admin
 
Posts: 193
Joined: Tue Sep 04, 2012 6:35 am
uGet Version: 2.1.4
Operating System: Linux
System Architecture: 64bit
Linux Distro: Fedora
Windows Version: 7

Re: 1.10.4 segfaults with GNUTLS support

Postby Mamoru TASAKA » Mon Jan 27, 2014 8:46 am

Still no good with git head (d968cad61759ffb67412cf94c9ebde9f3b55290b)
Code: Select all
(gdb) r
Starting program: /home/tasaka1/rpmbuild/TEMP/uget/GIT/uget/uget-gtk/uget-gtk
gobject.pyc: gdb was not built with custom backtrace support, disabling.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x47750038 in ?? ()
(gdb) thread apply all bt full

Thread 1 (Thread 0xb7fbd8c0 (LWP 7996)):
#0  0x47750038 in ?? ()
No symbol table info available.
#1  0x452c0318 in _gcry_ath_init () at ath.c:73
        err = 0
#2  0x452b939f in global_init () at global.c:105
        err = 0
#3  0x452b9695 in _gcry_vcontrol (cmd=cmd@entry=GCRYCTL_SET_THREAD_CBS, arg_ptr=<optimized out>,
    arg_ptr@entry=0xbfffec04 "\020\003\b\b\v\327\a\b") at global.c:452
        init_finished = 0
        err = <optimized out>
#4  0x452b5d94 in gcry_control (cmd=cmd@entry=GCRYCTL_SET_THREAD_CBS) at visibility.c:78
        err = 1198850104
        arg_ptr = 0xbfffec04 "\020\003\b\b\v\327\a\b"
#5  0x080513cb in init_gnutls_locks () at UgApp-gtk-main.c:124
No locals.
#6  main (argc=1, argv=0xbfffecb4) at UgApp-gtk-main.c:203
        string = <optimized out>
        ipc_status = <optimized out>
Mamoru TASAKA
 
Posts: 10
Joined: Mon Jan 20, 2014 8:36 am
Linux Distro: Fedora

Re: 1.10.4 segfaults with GNUTLS support

Postby Mamoru TASAKA » Mon Jan 27, 2014 8:47 am

libgcrypt is 1.5.3
Mamoru TASAKA
 
Posts: 10
Joined: Mon Jan 20, 2014 8:36 am
Linux Distro: Fedora

Re: 1.10.4 segfaults with GNUTLS support

Postby Mamoru TASAKA » Mon Jan 27, 2014 9:28 am

http://gnu.ist.utl.pt/software/gnutls/m ... tions.html
says that gcry_control() with GCRYCTL_SET_THREAD_CBS now must specify explicitly which thread model to use. I don't know which one is appropriate for uget, however for now I just selected posix threads model (again, I don't know this is correct).

Code: Select all
From d295c8a738ab4c90fa21dc6a7da1a2b44363b0c3 Mon Sep 17 00:00:00 2001
From: Mamoru TASAKA <mtasaka@fedoraproject.org>
Date: Mon, 27 Jan 2014 23:21:34 +0900
Subject: [PATCH] init_gnutls_locks: initialize gcrypt with posix threads for
 now

gcry_control with GCRYCTL_SET_THREAD_CBS now have to specify
explicitly which thread implementation to use. For now, use
posix threads.
---
 uget-gtk/UgApp-gtk-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/uget-gtk/UgApp-gtk-main.c b/uget-gtk/UgApp-gtk-main.c
index 18f5ccd..f242c34 100644
--- a/uget-gtk/UgApp-gtk-main.c
+++ b/uget-gtk/UgApp-gtk-main.c
@@ -121,7 +121,7 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
 
 void init_gnutls_locks (void)
 {
-   gcry_control (GCRYCTL_SET_THREAD_CBS);
+   gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
 }
 #endif // USE_GNUTLS
 
--
1.8.5.3


By the way, this forum says the extension ".patch" is not allowed... even ".txt" is not allowed... How to attach a patch?
Mamoru TASAKA
 
Posts: 10
Joined: Mon Jan 20, 2014 8:36 am
Linux Distro: Fedora

Re: 1.10.4 segfaults with GNUTLS support

Postby Mamoru TASAKA » Mon Jan 27, 2014 11:16 pm

http://www.gnupg.org/documentation/manu ... ading.html

says when using GCRY_THREAD_OPTION_PTHREAD_IMPL gcry_threads_pthread should be used, so my patch seems not wrong. And this explicit initialization seems to be needed from libgcrypt 1.1.92 (as written on:
http://gnu.ist.utl.pt/software/gnutls/m ... tions.html
),
so adding libgcrypt version check may be preferable (although I think such pld libgcrypt is no longer used)
Mamoru TASAKA
 
Posts: 10
Joined: Mon Jan 20, 2014 8:36 am
Linux Distro: Fedora

Re: 1.10.4 segfaults with GNUTLS support

Postby chhuang » Tue Jan 28, 2014 5:29 am

Thanks for your patch. I will commit it later.
chhuang
Site Admin
 
Posts: 193
Joined: Tue Sep 04, 2012 6:35 am
uGet Version: 2.1.4
Operating System: Linux
System Architecture: 64bit
Linux Distro: Fedora
Windows Version: 7

Re: 1.10.4 segfaults with GNUTLS support

Postby Mamoru TASAKA » Tue Jan 28, 2014 9:17 am

Okay, now with git head at least uget-gtk does not segfault, thank you.
Mamoru TASAKA
 
Posts: 10
Joined: Mon Jan 20, 2014 8:36 am
Linux Distro: Fedora

Re: [FIXED] 1.10.4 segfaults with GNUTLS support

Postby Shilpa111 » Tue Feb 13, 2018 4:49 am

Hi there...really nice information in this post thank you
ISO in Iraq

ISO in Bahrain
Shilpa111
 
Posts: 6
Joined: Mon Feb 05, 2018 6:21 am
uGet Version: 2.0
Operating System: windows 7
System Architecture: 32 bit


Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 2 guests

cron