Copying from samba share of `/var/lib/vz/dump` leads to segfault

promoxer

Member
Apr 21, 2023
234
23
23
Code:
The Samba 'panic action' script, /usr/share/samba/panic-action, was called for PID 713106 (/usr/sbin/smbd).


This means there was a problem with the program, such as a segfault.
However, gdb was not found on your system, so the error could not be debugged.  Please install the gdb package so that debugging information is available the next time such a problem occurs.

Code:
[2023/12/31 02:48:32.871859,  0] ../../source3/smbd/fd_handle.c:39(fd_handle_destructor)
  PANIC: assert failed at ../../source3/smbd/fd_handle.c(39): (fh->fd == -1) || (fh->fd == AT_FDCWD)
[2023/12/31 02:48:32.872186,  0] ../../lib/util/fault.c:173(smb_panic_log)
  ===============================================================
[2023/12/31 02:48:32.872240,  0] ../../lib/util/fault.c:174(smb_panic_log)
  INTERNAL ERROR: assert failed: (fh->fd == -1) || (fh->fd == AT_FDCWD) in pid 713106 (4.17.12-Debian)
[2023/12/31 02:48:32.872255,  0] ../../lib/util/fault.c:178(smb_panic_log)
  If you are running a recent Samba version, and if you think this problem is not yet fixed in the latest versions, please consider reporting this bug, see https://wiki.samba.org/index.php/Bug_Reporting
[2023/12/31 02:48:32.872281,  0] ../../lib/util/fault.c:183(smb_panic_log)
  ===============================================================
[2023/12/31 02:48:32.872293,  0] ../../lib/util/fault.c:184(smb_panic_log)
  PANIC (pid 713106): assert failed: (fh->fd == -1) || (fh->fd == AT_FDCWD) in 4.17.12-Debian
[2023/12/31 02:48:32.872598,  0] ../../lib/util/fault.c:292(log_stack_trace)
  BACKTRACE: 27 stack frames:
   #0 /usr/lib/x86_64-linux-gnu/samba/libgenrand-samba4.so.0(log_stack_trace+0x2e) [0x7f5111e7b55e]
   #1 /usr/lib/x86_64-linux-gnu/samba/libgenrand-samba4.so.0(smb_panic+0x9) [0x7f5111e7b7b9]
   #2 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(+0x4f23b) [0x7f511225e23b]
   #3 /lib/x86_64-linux-gnu/libtalloc.so.2(+0x47af) [0x7f5111e347af]
   #4 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(file_free+0xd6) [0x7f5112263f36]
   #5 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(+0xbd031) [0x7f51122cc031]
   #6 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(smbd_smb2_request_process_close+0x211) [0x7f51122cc7b1]
   #7 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(smbd_smb2_request_dispatch+0x1b02) [0x7f51122bffb2]
   #8 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(+0xb2111) [0x7f51122c1111]
   #9 /lib/x86_64-linux-gnu/libtevent.so.0(tevent_common_invoke_fd_handler+0x91) [0x7f5111e218c1]
   #10 /lib/x86_64-linux-gnu/libtevent.so.0(+0xee07) [0x7f5111e27e07]
   #11 /lib/x86_64-linux-gnu/libtevent.so.0(+0xcef7) [0x7f5111e25ef7]
   #12 /lib/x86_64-linux-gnu/libtevent.so.0(_tevent_loop_once+0x91) [0x7f5111e20ba1]
   #13 /lib/x86_64-linux-gnu/libtevent.so.0(tevent_common_loop_wait+0x1b) [0x7f5111e20e7b]
   #14 /lib/x86_64-linux-gnu/libtevent.so.0(+0xce97) [0x7f5111e25e97]
   #15 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(smbd_process+0x82f) [0x7f51122ae21f]
   #16 /usr/sbin/smbd(+0x9e00) [0x55861f8cee00]
   #17 /lib/x86_64-linux-gnu/libtevent.so.0(tevent_common_invoke_fd_handler+0x91) [0x7f5111e218c1]
   #18 /lib/x86_64-linux-gnu/libtevent.so.0(+0xee07) [0x7f5111e27e07]
   #19 /lib/x86_64-linux-gnu/libtevent.so.0(+0xcef7) [0x7f5111e25ef7]
   #20 /lib/x86_64-linux-gnu/libtevent.so.0(_tevent_loop_once+0x91) [0x7f5111e20ba1]
   #21 /lib/x86_64-linux-gnu/libtevent.so.0(tevent_common_loop_wait+0x1b) [0x7f5111e20e7b]
   #22 /lib/x86_64-linux-gnu/libtevent.so.0(+0xce97) [0x7f5111e25e97]
   #23 /usr/sbin/smbd(main+0x1489) [0x55861f8cc269]
   #24 /lib/x86_64-linux-gnu/libc.so.6(+0x271ca) [0x7f5111c5f1ca]
   #25 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7f5111c5f285]
   #26 /usr/sbin/smbd(_start+0x21) [0x55861f8ccb41]
[2023/12/31 02:48:32.872821,  0] ../../source3/lib/util.c:702(smb_panic_s3)
  smb_panic(): calling panic action [/usr/share/samba/panic-action 713106]
[2023/12/31 02:48:32.889459,  0] ../../source3/lib/util.c:709(smb_panic_s3)
  smb_panic(): action returned status 0
[2023/12/31 02:48:32.889718,  0] ../../source3/lib/dumpcore.c:315(dump_core)
  dumping core in /var/log/samba/cores/smbd


1. I'm using ZFS and I share out /var/lib/vz/ and some others, e.g. /vpool/... over samba
2. My daily backup running externally, will copy from these shares to an external location
3. However, samba always fails with a segfault a few minutes into the copying from the dump folder
4. Strangely, the other shares don't cause segfault when copying
5. The backup files in dump are typically 10-30GB
6. I faced this issue on both samba 4.17.12 and 4.19.3
7. Any idea why?
 
Last edited:
Hi!
I came into the same problem on two systems:
Code:
Supermicro Server / Enterprise SSD / proxmox 8 (latest version as of writing)
ASSUS Server / Enterprise SSD / proxmox 9 (latest version as of writing)

Samba Share Creation / ZFS nativ

Code:
zfs create bpool/samba
zfs set sharesmb=on bpool/samba
chown smbbackup:smbbackup -R /bpool/samba

on Windows 11:

Code:
net use B:  \\192.168.1.111\bpool_samba\backup  /user:smbbackup

After writing 50GB backup data with drivesnapshot, the kernel panic came on both systems. Everytime.

Code:
The Samba 'panic action' script, /usr/share/samba/panic-action, was called for PID 4550 ().

My solution:

Turn off ZFS nativ smb sharing and use /etc/samba/smb.conf

Code:
zfs set sharesmb=off bpool/samba

Code:
[bpool_samba]
    comment = backup
    path = /bpool/samba
    read only = no
    browsable = yes
    create mask = 0700
    directory mask = 0700
    valid users = smbbackup
    guest ok = no

best regards