Hi, I'm writing VFS module and have to able to upload files (it doesn't work now; but it is irrelevant in this case). I found that I can crash samba so it doesn't accept uploading files even from any other share (tried without vfs and with vfs - skel_opaq). Log level set to 3 and this is result [my module also fails in the same place] smbclient:: smb: \> put t marha.file Error writing file: Call returned zero bytes (EOF) Call returned zero bytes (EOF) closing remote file \marha.file [2004/12/14 10:39:33, 3] smbd/process.c:process_smb(1092) Transaction 5 of length 44 [2004/12/14 10:39:33, 5] lib/util.c:show_msg(461) [2004/12/14 10:39:33, 5] lib/util.c:show_msg(471) size=40 smb_com=0x10 smb_rcls=0 smb_reh=0 smb_err=0 smb_flg=8 smb_flg2=51201 smb_tid=1 smb_pid=1549 smb_uid=100 smb_mid=6 smt_wct=0 smb_bcc=5 [2004/12/14 10:39:33, 3] smbd/process.c:switch_message(887) switch message SMBchkpth (pid 1550) conn 0x83a7a78 [2004/12/14 10:39:33, 4] smbd/uid.c:change_to_user(194) change_to_user: Skipping user change - already user [2004/12/14 10:39:33, 5] smbd/filename.c:unix_convert(108) unix_mode(ma11) returning 0744 [2004/12/14 10:41:42, 5] smbd/files.c:file_new(122) allocated file structure 6825, fnum = 10921 (1 used) [2004/12/14 10:41:42, 4] smbd/open.c:open_file_shared1(1244) calling open_file with flags=0x2 flags2=0x240 mode=0744 [2004/12/14 10:41:42, 0] skel_transparent.c:skel_open(101) OPEN: ma11 66 [2004/12/14 10:41:42, 2] smbd/open.c:open_file(245) xgrac opened file ma11 read=Yes write=Yes (numopen=1) [2004/12/14 10:41:42, 5] lib/util.c:show_msg(461) [2004/12/14 10:41:42, 5] lib/util.c:show_msg(471) size=65 smb_com=0x2d smb_rcls=0 smb_reh=0 smb_err=0 smb_flg=136 smb_flg2=51201 smb_tid=1 smb_pid=1582 smb_uid=100 smb_mid=7 smt_wct=15 smb_vwv[ 0]= 255 (0xFF) smb_vwv[ 1]= 0 (0x0) smb_vwv[ 2]=10921 (0x2AA9) smb_vwv[ 3]= 32 (0x20) smb_vwv[ 4]=50022 (0xC366) smb_vwv[ 5]=16830 (0x41BE) smb_vwv[ 6]= 0 (0x0) smb_vwv[ 7]= 0 (0x0) smb_vwv[ 8]= 2 (0x2) smb_vwv[ 9]= 0 (0x0) smb_vwv[10]= 0 (0x0) smb_vwv[11]= 2 smb_vwv[12]= 0 (0x0) smb_vwv[13]= 0 (0x0) smb_vwv[14]= 0 (0x0) smb_bcc=0 [2004/12/14 10:41:43, 3] smbd/process.c:process_smb(1092) Transaction 7 of length 96 [2004/12/14 10:41:43, 5] lib/util.c:show_msg(461) [2004/12/14 10:41:43, 5] lib/util.c:show_msg(471) size=92 smb_com=0x2f smb_rcls=0 smb_reh=0 smb_err=0 smb_flg=8 smb_flg2=51201 smb_tid=1 smb_pid=1582 smb_uid=100 smb_mid=8 smt_wct=12 smb_vwv[ 0]= 255 (0xFF) smb_vwv[ 1]= 0 (0x0) smb_vwv[ 2]=10921 (0x2AA9) smb_vwv[ 3]= 0 (0x0) smb_vwv[ 4]= 0 (0x0) smb_vwv[ 5]= 0 (0x0) smb_vwv[ 6]= 0 (0x0) smb_vwv[ 7]= 0 (0x0) smb_vwv[ 8]= 0 (0x0) smb_vwv[ 9]= 0 (0x0) smb_vwv[10]= 33 (0x21) smb_vwv[11]= 59 (0x3B) smb_bcc=33 [2004/12/14 10:41:43, 3] smbd/process.c:switch_message(887) switch message SMBwriteX (pid 1583) conn 0x83a7a48 (0x2) [2004/12/14 10:41:43, 4] smbd/uid.c:change_to_user(194) change_to_user: Skipping user change - already user [2004/12/14 10:41:43, 0] lib/fault.c:fault_report(36) =============================================================== [2004/12/14 10:41:43, 0] lib/fault.c:fault_report(37) INTERNAL ERROR: Signal 7 in pid 1583 (3.0.8-Debian) Please read the appendix Bugs of the Samba HOWTO collection [2004/12/14 10:41:43, 0] lib/fault.c:fault_report(39) =============================================================== [2004/12/14 10:41:43, 0] lib/util.c:smb_panic2(1393) smb_panic(): calling panic action [/usr/share/samba/panic-action 1583] [2004/12/14 10:41:43, 0] lib/util.c:smb_panic2(1401) smb_panic(): action returned status 0 [2004/12/14 10:41:43, 0] lib/util.c:smb_panic2(1403) PANIC: internal error [2004/12/14 10:41:43, 0] lib/util.c:smb_panic2(1411) BACKTRACE: 17 stack frames: #0 /usr/sbin/smbd(smb_panic2+0x111) [0x81dfd51] #1 /usr/sbin/smbd(smb_panic+0x1a) [0x81dfc3a] #2 /usr/sbin/smbd [0x81cc118] #3 [0xffffe420] #4 /usr/sbin/smbd [0x81f2845] #5 /usr/sbin/smbd [0x81f38bd] #6 /usr/sbin/smbd [0x81f39e1] #7 /usr/sbin/smbd(tdb_fetch+0x51) [0x81f3b81] #8 /usr/sbin/smbd(brl_locktest+0x72) [0x81a0502] #9 /usr/sbin/smbd(is_locked+0xdc) [0x819caac] #10 /usr/sbin/smbd(reply_write_and_X+0x1b8) [0x80a6678] #11 /usr/sbin/smbd [0x80d3056] #12 /usr/sbin/smbd [0x80d32e0] #13 /usr/sbin/smbd(process_smb+0x8c) [0x80d34ec] #14 /usr/sbin/smbd(smbd_process+0x168) [0x80d4228] #15 /usr/sbin/smbd(main+0x4ea) [0x8256b6a] #16 /lib/tls/libc.so.6(__libc_start_main+0x108) [0x401af7f8] [2004/12/14 10:42:33, 3] smbd/sec_ctx.c:set_sec_ctx(288) setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0 [2004/12/14 10:42:33, 5] auth/auth_util.c:debug_nt_user_token(486) NT user token: (NULL) [2004/12/14 10:42:33, 5] auth/auth_util.c:debug_unix_user_token(505) UNIX token of user 0 Primary group is 0 and contains 0 supplementary groups [2004/12/14 10:42:33, 5] smbd/uid.c:change_to_root_user(296) change_to_root_user: now uid=(0,0) gid=(0,0) [2004/12/14 10:42:40, 3] smbd/process.c:process_smb(1092) Transaction 6 of length 39 [2004/12/14 10:42:40, 5] lib/util.c:show_msg(461) [2004/12/14 10:42:40, 5] lib/util.c:show_msg(471) size=35 smb_com=0x71 smb_rcls=0 smb_reh=0 smb_err=0 smb_flg=24 smb_flg2=51207 smb_tid=1 smb_pid=65279 smb_uid=100 smb_mid=320 smt_wct=0 smb_bcc=0 [2004/12/14 10:42:40, 3] smbd/process.c:switch_message(887) switch message SMBtdis (pid 1584) conn 0x83a6298 [2004/12/14 10:42:40, 3] smbd/sec_ctx.c:set_sec_ctx(288) setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0 [2004/12/14 10:42:40, 5] auth/auth_util.c:debug_nt_user_token(486) NT user token: (NULL) [2004/12/14 10:42:40, 5] auth/auth_util.c:debug_unix_user_token(505) UNIX token of user 0 Primary group is 0 and contains 0 supplementary groups [2004/12/14 10:42:40, 5] smbd/uid.c:change_to_root_user(296) change_to_root_user: now uid=(0,0) gid=(0,0) [2004/12/14 10:42:40, 3] smbd/sec_ctx.c:set_sec_ctx(288) setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0 [2004/12/14 10:42:40, 5] auth/auth_util.c:debug_nt_user_token(486) NT user token: (NULL) [2004/12/14 10:42:40, 5] auth/auth_util.c:debug_unix_user_token(505) UNIX token of user 0 Primary group is 0 and contains 0 supplementary groups [2004/12/14 10:42:40, 5] smbd/uid.c:change_to_root_user(296) change_to_root_user: now uid=(0,0) gid=(0,0) [2004/12/14 10:42:40, 3] smbd/service.c:close_cnum(836) skadi (147.251.50.54) closed connection to service IPC$ [2004/12/14 10:42:40, 3] smbd/connection.c:yield_connection(69) Yielding connection to IPC$ [2004/12/14 10:42:40, 4] smbd/vfs.c:vfs_ChDir(654) vfs_ChDir to / [2004/12/14 10:42:40, 3] smbd/sec_ctx.c:set_sec_ctx(288) setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0 [2004/12/14 10:42:40, 5] auth/auth_util.c:debug_nt_user_token(486) NT user token: (NULL) [2004/12/14 10:42:40, 5] auth/auth_util.c:debug_unix_user_token(505) UNIX token of user 0 Primary group is 0 and contains 0 supplementary groups [2004/12/14 10:42:40, 5] smbd/uid.c:change_to_root_user(296) change_to_root_user: now uid=(0,0) gid=(0,0) [2004/12/14 10:42:40, 5] lib/util.c:show_msg(461) [2004/12/14 10:42:40, 5] lib/util.c:show_msg(471) size=35 smb_com=0x71 smb_rcls=0 smb_reh=0 smb_err=0 smb_flg=136 smb_flg2=51201 smb_tid=1 smb_pid=65279 smb_uid=100 smb_mid=320 smt_wct=0 smb_bcc=0 [2004/12/14 10:42:40, 3] smbd/process.c:process_smb(1092) Transaction 7 of length 43 [2004/12/14 10:42:40, 5] lib/util.c:show_msg(461) [2004/12/14 10:42:40, 5] lib/util.c:show_msg(471) size=39 smb_com=0x74 smb_rcls=0 smb_reh=0 smb_err=0 smb_flg=24 smb_flg2=51207 smb_tid=0 smb_pid=65279 smb_uid=100 smb_mid=384 smt_wct=2 smb_vwv[ 0]= 255 (0xFF) smb_vwv[ 1]= 0 (0x0) smb_bcc=0 [2004/12/14 10:42:40, 3] smbd/process.c:switch_message(887) switch message SMBulogoffX (pid 1584) conn 0x0 [2004/12/14 10:42:40, 3] smbd/sec_ctx.c:set_sec_ctx(288) setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0 [2004/12/14 10:42:40, 5] auth/auth_util.c:debug_nt_user_token(486) NT user token: (NULL) [2004/12/14 10:42:40, 5] auth/auth_util.c:debug_unix_user_token(505) UNIX token of user 0 Primary group is 0 and contains 0 supplementary groups [2004/12/14 10:42:40, 5] smbd/uid.c:change_to_root_user(296) change_to_root_user: now uid=(0,0) gid=(0,0) [2004/12/14 10:42:40, 5] auth/auth_util.c:free_server_info(1344) attempting to free (and zero) a server_info structure [2004/12/14 10:42:40, 3] smbd/reply.c:reply_ulogoffX(1249) ulogoffX vuid=100 [2004/12/14 10:42:40, 5] lib/util.c:show_msg(461) [2004/12/14 10:42:40, 5] lib/util.c:show_msg(471) size=39 smb_com=0x74 smb_rcls=0 smb_reh=0 smb_err=0 smb_flg=136 smb_flg2=51201 smb_tid=0 smb_pid=65279 smb_uid=100 smb_mid=384 smt_wct=2 smb_vwv[ 0]= 255 (0xFF) smb_vwv[ 1]= 0 (0x0) smb_bcc=0 [2004/12/14 10:42:40, 3] smbd/process.c:timeout_processing(1337) timeout_processing: End of file from client (client has disconnected). [2004/12/14 10:42:40, 5] lib/gencache.c:gencache_shutdown(88) Closing cache file [2004/12/14 10:42:40, 5] libsmb/namecache.c:namecache_shutdown(79) namecache_shutdown: netbios namecache closed successfully. [2004/12/14 10:42:40, 3] smbd/sec_ctx.c:set_sec_ctx(288) setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0 [2004/12/14 10:42:40, 5] auth/auth_util.c:debug_nt_user_token(486) NT user token: (NULL) [2004/12/14 10:42:40, 5] auth/auth_util.c:debug_unix_user_token(505) UNIX token of user 0 Primary group is 0 and contains 0 supplementary groups [2004/12/14 10:42:40, 5] smbd/uid.c:change_to_root_user(296) change_to_root_user: now uid=(0,0) gid=(0,0) [2004/12/14 10:42:40, 2] smbd/server.c:exit_server(571) Closing connections [2004/12/14 10:42:40, 3] smbd/connection.c:yield_connection(69) Yielding connection to [2004/12/14 10:42:40, 5] smbd/oplock.c:receive_local_message(107) receive_local_message: doing select with timeout of 1 ms [2004/12/14 10:42:40, 3] smbd/server.c:exit_server(614) Server exit (normal exit)
Does Samba crash without your VFS module loaded ? If not, then this is a bug in your module, not Samba. Samba isn't proof against internal code loaded into it. Jeremy.
Perhaps I didn't write it good. Problem is that after using my module (concretly trying to write on share). It fails, thats ok because bug is in my code but I found that VFS is not widely used [I'm writing RW filesystem stored in DB, so every function have to be OPAQUE]. When I had other problems in samba, it was enough to restart smbclient. But in this case I have to restart samba because all other shares can't write on fs. On the other shares I don't have any VFS module but they are influenced by my commands [I don't use variables/functions from samba directly; just rewriting API]. That's because I think this is problem. PS: Can u have me any pointer where it fails? I tried to find it in sources but wasn't able to find origin of problem.
One more comment, I'm not sure (and haven't look in sources) but it looks like that it crash because it didn't test if filehandler 'fd' have been opened. In my case it was(?) collision between my own fd_table and system table. But still don't know why then failed all other writing to the samba (in shares without interaction with my vfs)
if your vfs module is casuing the crash (no crash using the default vfs), then it really is you bug. I think this has already been pointed out on the samba-technical ml.