Bug 533 - sudo 1.7.8 crashes with segfault
sudo 1.7.8 crashes with segfault
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.7.8
PC Solaris 2.x
: low high
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-25 13:16 MST by Philip Rowlands
Modified: 2012-02-21 06:07 MST (History)
0 users

See Also:


Attachments
Fix for Solaris crash when NOPASSWD is used (2.37 KB, patch)
2012-01-26 16:34 MST, Todd C. Miller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Rowlands 2012-01-25 13:16:31 MST
I was trying to build the latest maintenance release (1.7.8p1) for Solaris 10. However, the resulting binary crashes with SIGSEGV for any non-trivial use.

I downloaded all the 1.7 series to isolate which version started breaking; everything up to 1.7.7 works, everything after 1.7.8 fails.

As it's crashing inside libpam, this ChangeLog entry looks relevant:
2011-09-27  Todd C. Miller  <Todd.Miller@courtesan.com>
  * auth/API, auth/bsdauth.c, auth/fwtk.c, auth/kerb4.c, auth/kerb5.c,
    auth/pam.c, auth/passwd.c, auth/secureware.c, auth/securid.c,
    auth/securid5.c, auth/sudo_auth.c, auth/sudo_auth.h, check.c,
    sudo.c, sudo.h:
    Modify the authentication API such that the init and cleanup
    functions are always called, regardless of whether or not we are
    going to verify a password. This is needed for proper PAM session
    support.
    [c8ea54add6cd] <1.7>

It's difficult to debug further as sudo refuses to run unless setuid, and most debugging tools refuse to run on setuid binaries. I can create a core dump (see below).

Steps to reproduce:

// enable setuid core dumps
# coreadm -e global-setid -e proc-setid

// LDFLAGS needed to avoid libintl link failure
$ LDFLAGS="-L/usr/local/lib -R/usr/local/lib" ./configure
$ gmake
# chown root ./sudo && chmod 4755 ./sudo
$ ./sudo ls; echo status is $?
status is 139

# pstack /path/to/sudo-hostname-26401
core '/path/to/sudo-hostname-26401' of 26401:  ./sudo ls
 fef72ec0 load_modules (0, 1, fef868e0) + 1b
 fef7250d run_stack (0, 1, 1, 10, 2, fef86798) + 4d
 fef7283b pam_setcred (0, 1, 808c5a0, 0, 5, 5) + 2b
 08055b29 pam_begin_session (808c57c, 5, 8047a58, 805ecfc) + 2d
 0805ed0a set_perms (5, 8089748, 8047a88, 805a77d) + 13a
 0805f0d2 exec_setup (0, 808bbf8, ffffffff, 0) + fa
 0805b0ab sudo_execve (8099570, 8047d90, 809f040, 0, 8047b48, 1) + 743
 0805f14a run_command (8099570, 8047d90, 809f040, 0, 1) + 3a
 08060b6c main     (2, 8047d8c, 8047d98) + 14e4
 08055310 _start   (2, 8047e48, 8047e4f, 0, 8047e52, 8047e5d) + 80
Comment 1 Todd C. Miller 2012-01-26 16:34:26 MST
Created attachment 328 [details]
Fix for Solaris crash when NOPASSWD is used

This was fixed in sudo 1.8.3p1 but the fix didn't make it into sudo 1.7.8p1.
Comment 2 Todd C. Miller 2012-02-21 06:07:16 MST
Fixed in sudo 1.7.8p2