Bug 954 - smbd segfault when creating a file/dir only when running under valgrind
Summary: smbd segfault when creating a file/dir only when running under valgrind
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: File Services (show other bugs)
Version: 3.0.1
Hardware: Other other
: P1 critical
Target Milestone: none
Assignee: Gerald (Jerry) Carter (dead mail address)
QA Contact:
Depends on:
Reported: 2004-01-08 22:10 UTC by Marc Kaplan
Modified: 2004-01-09 09:42 UTC (History)
2 users (show)

See Also:

The full log.smbd (333.46 KB, text/plain)
2004-01-08 22:18 UTC, Marc Kaplan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Kaplan 2004-01-08 22:10:14 UTC
Is this a bug in valgrind or samba?

From log.smbd:
New file New Folder (2)
unix_mode(New Folder (2)) returning 0777
allocated file structure 4234, fnum = 8330 (2 used)
unix_mode(New Folder (2)) returning 0777
--11222-- FATAL: unhandled syscall: 229
--11222-- Do not panic.  You may be able to fix this easily.
--11222-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
==11222== Valgrind detected that your program requires
==11222== the following unimplemented functionality:
==11222==    no wrapper for the above system call
==11222== This may be because the functionality is hard to implement,
==11222== or because no reasonable program would behave this way,
==11222== or because nobody has yet needed it.  In any case, let me know
==11222== (jseward@acm.org) and/or try to work around the problem, if you can.
==11222== Valgrind has to exit now.  Sorry.  Bye!

sched status:

Thread 1: status = Runnable, associated_mx = 0x0, associated_cv = 0x0
==11222==    at 0x420E45ED: syscall (in /lib/i686/libc-2.2.5.so)
==11222==    by 0x40464C44: acl_get_file (acl_get_file.c:58)
==11222==    by 0x80BF024: directory_has_default_acl (smbd/posix_acls.c:3374)
==11222==    by 0x80B7BD4: vfswrap_mkdir (smbd/vfs-wrap.c:118)
==11222==    by 0x80B6171: vfs_MkDir (smbd/vfs.c:357)
==11222==    by 0x80B2CE3: open_directory (smbd/open.c:1308)
==11222==    by 0x8095B2D: reply_ntcreate_and_X (smbd/nttrans.c:777)
==11222==    by 0x80BFE38: switch_message (smbd/process.c:767)
==11222==    by 0x80BFEDD: construct_reply (smbd/process.c:797)
==11222==    by 0x80C01E6: process_smb (smbd/process.c:897)
==11222==    by 0x80C0C53: smbd_process (smbd/process.c:1328)
==11222==    by 0x81FB651: main (smbd/server.c:887)
==11222==    by 0x42017498: __libc_start_main (in /lib/i686/libc-2.2.5.so)
==11222==    by 0x8079590: (within /usr/local/samba/sbin/smbd)
Comment 1 Marc Kaplan 2004-01-08 22:18:08 UTC
Created attachment 356 [details]
The full log.smbd

This is the full log.smbd. Remember this panic only happens when running smbd
under valigrind
Comment 2 Marc Kaplan 2004-01-08 22:33:58 UTC
Maybe valgrind is just missing this IOCTL as the debug info says? I'm a novice 
valgrind user, so I'm not sure. It does cause a major problem for Samba though..
Comment 3 Gerald (Jerry) Carter (dead mail address) 2004-01-09 07:09:21 UTC
It is a missing function in valgrind.  I've had to fix this 
before.  I'll send you a patch.
Comment 4 Gerald (Jerry) Carter (dead mail address) 2004-01-09 07:12:15 UTC
you need a new version of valgrind.  This syscall is supported
in version 2.0.0.

Comment 5 Marc Kaplan 2004-01-09 09:00:27 UTC
It seems that I am using 2.0.0...

[root@ThunderBird source]# valgrind --version

Comment 6 Gerald (Jerry) Carter (dead mail address) 2004-01-09 09:42:28 UTC
The maybe you are missing some headers?  or maybe you need 
to recompile valgind on a system that does have the 
ACL/EA patch.

from coregrind/vg_syscalls.c:

#     if defined(__NR_getxattr)
      case __NR_getxattr: /* syscall 229 */
         /* ssize_t getxattr (const char *path, const char* name,
                              void* value, size_t size); */
      case __NR_lgetxattr: /* syscall 230 */
         /* ssize_t lgetxattr (const char *path, const char *name,
                               void *value, size_t size); */
         MAYBE_PRINTF("getxattr ( %p, %p, %p, %d )\n",
                        arg1,arg2,arg3, arg4);
         SYSCALL_TRACK( pre_mem_read_asciiz, tid, "getxattr(path)", arg1 );
         SYSCALL_TRACK( pre_mem_read_asciiz, tid, "getxattr(name)", arg2 );
         SYSCALL_TRACK( pre_mem_write, tid, "getxattr(value)", arg3, arg4 );
         if (!VG_(is_kerror)(res) && res > 0
                                  && arg3 != (Addr)NULL) {
            VG_TRACK( post_mem_write, arg3, res );
#     endif