FS#23458 - segfault when running sudo (segfault in libpthread)

Attached to Project: Arch Linux
Opened by Cody Maloney (maloney) - Saturday, 26 March 2011, 19:45 GMT
Last edited by Allan McRae (Allan) - Monday, 18 April 2011, 03:24 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Allan McRae (Allan)
Architecture x86_64
Severity Critical
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:


Additional info:
#uname -a:
Linux login 2.6.37-ARCH #1 SMP PREEMPT Fri Mar 25 15:10:00 CET 2011 x86_64 Intel(R) Xeon(R) CPU E3120 @ 3.16GHz GenuineIntel GNU/Linux

sudo: 1.8.0-4
glibc: 2.13-4
kernel26: 2.6.37-5

from everything.log:
Mar 26 20:47:17 login kernel: sudo[1693]: segfault at 968 ip 00007fe1f63c38d0 sp 00007fffd3298c30 error 4 in libpthread-2.13.so[7fe1f63be000+17000]

Steps to reproduce:
Do a system upgrade
Try running any command under sudo. ('sudo -s', 'sudo top', 'sudo pacman -Syu')

Let me know if any other info would be useful to attach and I'll provide it.
This task depends upon

Closed by  Allan McRae (Allan)
Monday, 18 April 2011, 03:24 GMT
Reason for closing:  None
Additional comments about closing:  Resolved by submitter
Comment by Cody Maloney (maloney) - Saturday, 26 March 2011, 20:28 GMT
It appears there were also some NSS and PAM configuration changes in the period between sudo last working and now which may be helping lead to the segfault.
Comment by Cody Maloney (maloney) - Sunday, 27 March 2011, 01:23 GMT
Several other machines with the same configuration but older sudo/glibc work, so the config isn't the issue.

sudo: 1.7.4.p6-1
glibc: 2.13-1
kernel26: 2.6.37-5
Comment by Allan McRae (Allan) - Sunday, 27 March 2011, 05:54 GMT
Can you run it under gdb to get the backtrace.
Comment by Cody Maloney (maloney) - Sunday, 27 March 2011, 06:48 GMT
Here is what I get out of GDB:
# gdb --args sudo -s
GNU gdb (GDB) 7.2
Copyright (C) 2010 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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/sudo...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/bin/sudo -s
[Thread debugging using libthread_db enabled]
Cannot find new threads: generic error
(gdb) bt
Target is executing.
(gdb) q
A debugging session is active.

Inferior 1 [process 2073] will be killed.

Quit anyway? (y or n) y


Based on basic googling of the error I tried:

LD_PRELOAD=/lib/libpthread.so.0 gdb --args sudo -s
GNU gdb (GDB) 7.2
Copyright (C) 2010 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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/sudo...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/bin/sudo -s
[Thread debugging using libthread_db enabled]
[root@login sysadmin]#

But that doesn't really add anything more useful...
Comment by Cody Maloney (maloney) - Friday, 08 April 2011, 02:53 GMT
I've been printf debugging trying to pinpoint the segfault. The sudo code segfaults on a call to pam_start. The pam code segfaults when calling dlopen("/lib/security/pam_unix.so", RTLD_NOW);

I'm still trying to figure out why that call to dlopen is failing (And why it only happens on the path of a non-root user calling sudo with a program to execute. sudo -l works...).

Writing a simple script and running it as the user sudo is being executed under dlopen works just fine, and for all the other programs on my system the pam_unix module seems to be working just fine.

I'm going to keep searching for the explanation, although I have am struggling to come up with a reason why dlopen is segfaulting in this particular case...
Comment by Cody Maloney (maloney) - Friday, 08 April 2011, 02:59 GMT
Linking sudo against pthread fixes the segfault, although why it segfaults without -lpthread is still a mystery to me...
Comment by Allan McRae (Allan) - Monday, 11 April 2011, 04:08 GMT
Can you test sudo-1.8.1-1 in [testing]?
Comment by Cody Maloney (maloney) - Monday, 18 April 2011, 03:05 GMT
Please Close (Resolved locally by removing bad package).

On the broken machine I had a custom nss-mysql package installed. With older versions of sudo, it worked fine, but after an upgrade it was segfaulting. We (The sysadmin team I'm on), changed to using ldap instead of mysql with the package in the archlinux repositories and, after removing the mysql line from the nss config, sudo stopped segfaulting. The segfaulting had started occuring in several other coreutils programs as well. Suffice to say, I have no machine to test this on anymore, and it doesn't look like the issue occured for anyone else, so please close.

Sorry for the slow response.

Loading...