[Samba3] BAD_NETWORK_NAME that dissapears under gdb, strace

Michael B Allen mba2000 at ioplex.com
Sun Sep 11 22:45:26 GMT 2005


On Mon, 12 Sep 2005 08:29:43 +1000
Andrew Bartlett <abartlet at samba.org> wrote:

> I've been chasing down an issue for a friend, with Samba 3.0.14a-2 on
> Fedora Core 4.  The issue appears to be that this code (from service.c
> make_connection_snum()):
> 
> 	if (SMB_VFS_STAT(conn, conn->connectpath, &st) != 0 || !
> S_ISDIR(st.st_mode)) {
> 		DEBUG(0,("'%s' does not exist or is not a directory, when connecting
> to [%s]\n", conn->connectpath, lp_servicename(snum)));
> 
> fails on a Fedora Core 4 machine, with a 2.6.12-1.1447_FC4smp kernel.
> However, it only does so when running natively.  *If run under strace,
> valgrind or gdb, it works fine.*
> 
> Also, this only fails at all on a particular filesystem (a big raid5
> ext3 fs).  
> 
> Does anybody have experience with these kind of issues?  My current
> suggestion is to move to a stock kernel.org kernel, assuming it has to
> be a kernel bug, but I'm a bit in the dark.  What kind of things does
> ptrace() modify, to change this behaviour?

I don't speak from a lot of experience but I can tell you what I would try.

Get the Fedora .src.rpm that is installed (rpm -qa | grep samba), extract
it with rpmbuild -bp, add a mystat function that bypasses SMB_VFS_STAT
to call stat(2), and print the parameters before and after the call like:

int
mystat(const char *filename, struct stat *buf)
{
	int ret;

	DEBUG(0, ("mystat:%p:%p:%s:0x%08x\n", filename, buf, filename, buf->st_mode);
	ret = stat(filename, buf);
	DEBUG(0, ("mystat:%p:%p:%s:0x%08x\n", filename, buf, filename, buf->st_mode);

	return ret;
}

This way you'll see if it's really within the stat call or if it's
something local to samba.

Now do rpmbuild -bb to produce your 1 off package and have your friend
try it.

Mike


More information about the samba-technical mailing list