Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 235138 - sys-libs/pam[audit] causes multi-second hangs when kernel lacks audit support
Summary: sys-libs/pam[audit] causes multi-second hangs when kernel lacks audit support
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-18 19:34 UTC by Donnie Berkholz (RETIRED)
Modified: 2012-12-18 21:59 UTC (History)
2 users (show)

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


Attachments
emerge_info.txt (emerge_info.txt,6.77 KB, text/plain)
2008-08-18 19:43 UTC, Donnie Berkholz (RETIRED)
Details
audittest.c (audittest.c,4.64 KB, text/plain)
2008-08-19 00:56 UTC, Robin Johnson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Donnie Berkholz (RETIRED) gentoo-dev 2008-08-18 19:34:32 UTC
I got multiple-second hangs upon every PAM authentication in this scenario:
- sys-libs/pam-1.0.1 with audit support
- sys-process/audit-1.7.4 installed
- kernel 2.6.27-rc3 *without* audit support

Disabling audit support in sys-libs/pam fixed this. The messages log doesn't show anything interesting.
Comment 1 Donnie Berkholz (RETIRED) gentoo-dev 2008-08-18 19:43:37 UTC
Created attachment 163233 [details]
emerge_info.txt
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-08-19 00:05:52 UTC
dberkholz: Is there anything in your syslog like:
audit_log_acct_message() failed: %m
OR
audit_open() failed: %m
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-08-19 00:56:16 UTC
Created attachment 163263 [details]
audittest.c

Testcase. Please compile and linking against libaudit. Run it as something that gives exact timestamps for each line of output.
My own test:
# ./audittest | tai64n| tai64nlocal
2008-08-18 17:55:57.872091500 DEBUG:/tmp/audittest.c:173:_pam_audit_end:ENTER
2008-08-18 17:55:57.872092500 DEBUG:/tmp/audittest.c:107:_pam_auditlog:ENTER
2008-08-18 17:55:57.872093500 DEBUG:/tmp/audittest.c:76:_pam_audit_open:ENTER
2008-08-18 17:55:57.872093500 DEBUG:/tmp/audittest.c:95:_pam_audit_open:LEAVE
2008-08-18 17:55:57.872094500 DEBUG:/tmp/audittest.c:41:_pam_audit_writelog:ENTER
2008-08-18 17:55:57.872094500 DEBUG:/tmp/audittest.c:66:_pam_audit_writelog:LEAVE
2008-08-18 17:55:57.872095500 DEBUG:/tmp/audittest.c:164:_pam_auditlog:LEAVE
2008-08-18 17:55:57.872096500 DEBUG:/tmp/audittest.c:175:_pam_audit_end:LEAVE
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-10-20 19:02:58 UTC
dberkholz: did you ever run the testcase?
# gcc testcase.c -o testcase -laudit
# ./audittest | tai64n| tai64nlocal
Comment 5 Michael Spiegle 2008-12-11 21:37:24 UTC
(In reply to comment #4)
> dberkholz: did you ever run the testcase?
> # gcc testcase.c -o testcase -laudit
> # ./audittest | tai64n| tai64nlocal
> 

I have a theory on why this is.  I'm actually tracking down a similar issue.  When I login to my box via SSH, it takes multiple seconds to login even though the box is hardly loaded.  Here's what I found:

1) SSH is hanging in an audit lib call which opens a netlink socket of protocol type AUDIT.
2) The netlink_create() code notices that the AUDIT protocol is !registered.
3) The kernel then (since we're generally using a modular kernel) does a request_module()
4) request_module() eventually uses call_usermodehelper() to run /sbin/modprobe in userspace to find the module that contains the AUDIT protocol
5) wait_for_completion() introduces the multi-second delay.

I haven't debugged it any farther than this, but I'm fairly certain it is a kernel issue.  Try compiling/running this small code snippet to see if it hangs in the same fashion.  Just running it with no parameters opens a netlink socket for auditing:


$ cat socktest.c 
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <linux/netlink.h>
#include <stdlib.h>
#include <unistd.h>

int sock_type = 0;
char const* options = "s:";

int main(int argc, char** argv) {

        int proto;
        int o;
        o = getopt(argc, argv, options);
        if ( o == 's' )
                proto = atoi(optarg);
        else
                proto = 9;

        int fd;
        fd = socket(PF_NETLINK, SOCK_RAW, proto);
        printf("Got socket: %d\n", fd);

        return 0;
}

Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-12-18 21:59:26 UTC
No response from submitter in 4 years.