Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 155526 - app-admin/apg-2.3.0b-r2: Segfaults when called with 'apg -y'
Summary: app-admin/apg-2.3.0b-r2: Segfaults when called with 'apg -y'
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Konstantin Arkhipov (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-17 15:07 UTC by Dustin Polke
Modified: 2007-03-09 11:00 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
strace output (apg.dump,31.25 KB, text/plain)
2006-11-17 15:09 UTC, Dustin Polke
Details
And 'emerge --info' (emerge.info,4.23 KB, text/plain)
2006-11-17 15:11 UTC, Dustin Polke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dustin Polke 2006-11-17 15:07:48 UTC
If I call apg with the -y option (print crypted passwords), apg terminates with a segfault.

I attach a output of 'strace apg -y'.

BR,
Dustin
Comment 1 Dustin Polke 2006-11-17 15:09:20 UTC
Created attachment 102236 [details]
strace output
Comment 2 Dustin Polke 2006-11-17 15:11:01 UTC
Created attachment 102237 [details]
And 'emerge --info'
Comment 3 Konstantin Arkhipov (RETIRED) gentoo-dev 2006-12-17 09:58:20 UTC
i'm unable to reproduce this crash.

could you please re-emerge apg with FEATURES="nostrip" and CFLAGS="-O0 -g" and post gdb's backtrace here?

gdb --args apg -y
bt
Comment 4 Dustin Polke 2007-01-07 21:30:02 UTC
Hi Konstantin,

Happy new year. After the holidays I've got time now to look into this. I reemerged apg like you asked me. However, I am not familiar with gdb at all. Invoking it like you asked me I just see the prompt like

dustin@solaris ~ $ gdb --args apg -y
GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) 

Could you give me a hint how to produce some useful output?

Thanks.
Dustin
Comment 5 Dustin Polke 2007-01-23 10:33:46 UTC
Okay. found some time to look how gdb works. Is the following output sufficient  or do you need more? Then please tell me what to do.

dustin@solaris ~ $ gdb --args apg -y
GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run
Starting program: /usr/bin/apg -y
Failed to read a valid object file image from memory.

Program received signal SIGSEGV, Segmentation fault.
0xb7e5f825 in memcpy () from /lib/libc.so.6
Comment 6 Konstantin Arkhipov (RETIRED) gentoo-dev 2007-02-07 14:39:12 UTC
type in shell: gdb --args apg -y
type in gdb: bt
Comment 7 Dustin Polke 2007-02-08 22:02:53 UTC
I think this does not help much...

solaris / # gdb --args apg -y
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) bt
No stack.
(gdb) 
Comment 8 Konstantin Arkhipov (RETIRED) gentoo-dev 2007-02-22 10:39:25 UTC
ups.

type in shell: gdb --args apg -y
type in gdb: run
type in gdb: bt

also you can try to add '#include <crack.h>' in restrict.c:~35 and rebuild apg.
Comment 9 Dustin Polke 2007-03-05 16:49:52 UTC
Ah, that's better! Here's the output:

GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run
Starting program: /usr/bin/apg -y
Failed to read a valid object file image from memory.

Program received signal SIGSEGV, Segmentation fault.
0xb7dbc3d5 in memcpy () from /lib/libc.so.6
(gdb) bt
#0  0xb7dbc3d5 in memcpy () from /lib/libc.so.6
#1  0x0805023d in main ()

I added crack.h to restrict.c as well like you suggested but to no avail:

GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run
Starting program: /usr/bin/apg -y
Failed to read a valid object file image from memory.

Program received signal SIGSEGV, Segmentation fault.
0xb7e603d5 in memcpy () from /lib/libc.so.6
(gdb) bt
#0  0xb7e603d5 in memcpy () from /lib/libc.so.6
#1  0x0805023d in main ()
Comment 10 Konstantin Arkhipov (RETIRED) gentoo-dev 2007-03-06 15:39:43 UTC
since i'm still unable to reproduce it, can you please try the following patch:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=337116;msg=24

?
Comment 11 Dustin Polke 2007-03-07 19:06:35 UTC
Bingo!
That patch did the trick. Thanks a lot fo your help!

Including <crack.h> is needed as well, otherwise compilation gives warnings about implicit function declaration.

I leave the bug still open until a revised ebuild has been commited to portage.

Dustin
Comment 12 Konstantin Arkhipov (RETIRED) gentoo-dev 2007-03-08 16:36:39 UTC
-r3 committed.
thank you for reporting and testing, Dustin.
Comment 13 Dustin Polke 2007-03-08 21:43:47 UTC
Could you add a patch to restrict.c as suggested in comment #8?
This will fix the QA warning due to an implicit function declaration.

Thanks.
Comment 14 Konstantin Arkhipov (RETIRED) gentoo-dev 2007-03-09 11:00:59 UTC
committed -r4,
thanks.