Bug 8546 - sessionid.tdb locking causes logon freeze when obey pam restrictions is enabled
sessionid.tdb locking causes logon freeze when obey pam restrictions is enabled
Status: NEW
Product: Samba 3.6
Classification: Unclassified
Component: Client Tools
3.6.1
x64 Linux
: P5 major
: ---
Assigned To: Volker Lendecke
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-26 17:27 UTC by Christian Tosta
Modified: 2012-09-18 03:18 UTC (History)
0 users

See Also:


Attachments
Trace of smbstatus (833 bytes, application/octet-stream)
2011-10-26 17:27 UTC, Christian Tosta
no flags Details
Samba PAM configuration (286 bytes, application/octet-stream)
2011-10-26 17:29 UTC, Christian Tosta
no flags Details
strace -ffT for 4 concurrent smbstatus calls (14.68 KB, application/zip)
2011-10-27 11:11 UTC, Christian Tosta
no flags Details
strace -ttT for concurrent processes (14.85 KB, application/zip)
2011-10-27 12:57 UTC, Christian Tosta
no flags Details
Proposed patch (1.30 KB, patch)
2011-10-27 18:59 UTC, Christian Tosta
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Tosta 2011-10-26 17:27:59 UTC
Created attachment 7036 [details]
Trace of smbstatus

When multiple smbstatus (called from a PAM module) runs simultaneously, the processes freezes with a lock in sessionid.tdb. The problem not occurs in 3.5.x from Sernet.de.

I have created a pam module that calls smbstatus and parses the output to do some checks and acts on a remote iptables/iproute firewall. Module runs fine until upgrade to 3.6.1. The strace for the process and PAM configuration are attached.
Comment 1 Christian Tosta 2011-10-26 17:29:23 UTC
Created attachment 7037 [details]
Samba PAM configuration
Comment 3 Volker Lendecke 2011-10-27 07:52:53 UTC
We need strace -ttT of at least to competing and deadlocking smbstatus calls
Comment 4 Volker Lendecke 2011-10-27 07:53:31 UTC
(In reply to comment #3)
> We need strace -ttT of at least to competing and deadlocking smbstatus calls

read this as "at least two" instead of "at least to" please
Comment 5 Christian Tosta 2011-10-27 11:11:07 UTC
Created attachment 7038 [details]
strace -ffT for 4 concurrent smbstatus calls
Comment 6 Christian Tosta 2011-10-27 12:57:33 UTC
Created attachment 7039 [details]
strace -ttT for concurrent processes

Ignore previous attachment. It does a strace -ffT, not strace -ttT as required.
Comment 7 Christian Tosta 2011-10-27 12:58:13 UTC
Can smbd processes concurrent with this too?

Is that a reason to db_open sessionid.tdb with O_RDWR? Can we open file with O_RDONLY if calling process is smbstatus?


From lib/sessionid_tdb.c:


static struct db_context *session_db_ctx(void)
{
	static struct db_context *session_db_ctx_ptr;

	if (session_db_ctx_ptr != NULL) {
		return session_db_ctx_ptr;
	}

	session_db_ctx_ptr = db_open(NULL, lock_path("sessionid.tdb"), 0,
				     TDB_CLEAR_IF_FIRST|TDB_DEFAULT|TDB_INCOMPATIBLE_HASH,
				     O_RDWR | O_CREAT, 0644);
	return session_db_ctx_ptr;
}
Comment 8 Volker Lendecke 2011-10-27 18:38:08 UTC
There's nothing really suspicious in the straces except that the smbstatus calls wait for a lock. During that wait, can you look at 'cat /proc/locks' and see which process holds that lock, and what that does? This would assume you're running Linux...
Comment 9 Christian Tosta 2011-10-27 18:59:52 UTC
Created attachment 7040 [details]
Proposed patch

No. I do not looked to 'cat /proc/locks'. But I recompiled samba with patch attached and the symptoms was gone.

I'm looking now for side effects of the patch, if any exists.
Comment 10 Christian Tosta 2012-09-18 03:12:51 UTC
The Patch is running since was applied at almost a year. This bug can be considered fixed?
Comment 11 Christian Tosta 2012-09-18 03:12:52 UTC
The Patch is running since was applied at almost a year. This bug can be considered fixed?
Comment 12 Christian Tosta 2012-09-18 03:18:01 UTC
The Patch is running since was applied at almost a year. This bug can be considered fixed?