Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault of dbd -c #850

Open
UUVE opened this issue Apr 16, 2024 · 20 comments
Open

Segfault of dbd -c #850

UUVE opened this issue Apr 16, 2024 · 20 comments

Comments

@UUVE
Copy link

UUVE commented Apr 16, 2024

Description
As stated in the title i'm continuing experiencing this behaviour of dbd -c on a afp share. The share was created a long time ago in netatalk v2.x on Debin and successively migrated to netatalk 3.x. On shares created with netatalk 3.x I do not experience this problem.

To Reproduce
At this moment I don't know a clear situation that trigger the bug

Expected behavior
As the man of dbd states I would expect that the command convert from AppleDouble = v2 to AppleDouble =ea .

Environment

  • Server OS: [e.g. Debian Linux 12.5]
  • Client OS [not applicable]
  • Netatalk Version [e.g. 3.1.18]

Logs
2024-04-16T17:42:23.323892+02:00 server1 kernel: [419603.410420] dbd[1987870]: segfault at 6e8 ip 00007f2c2405674f sp 00007ffc681b3190 error 4 in libatalk.so.0.0.0[7f2c24051000+39000] likely on CPU 3 (core 3, socket 0) 2024-04-16T17:42:23.323923+02:00 server1 kernel: [419603.410519] Code: 00 4c 8d 0d 63 45 03 00 50 4c 8d 05 b8 44 03 00 eb ad 48 8b 44 24 08 4c 89 ea 4c 89 f6 bf 02 00 00 00 48 8b 40 08 48 8b 40 18 <48> 8b 88 e8 06 00 00 44 8b 80 e0 06 00 00 e8 4e a9 ff ff 85 c0 74

@rdmark
Copy link
Member

rdmark commented Apr 17, 2024

For starters, can you please fill out the Environment section, so that we know the version and OS you’re running this with.

I can see two ways forward:

  1. Try to reproduce with a canned environment (create a fresh volume with 2.x and then upgrade to 3.x)
  2. Compile dbd with debug symbols and then catch the segfault in the debugger so that we can see the full stack trace

The FAQ has instructions for the latter: https://github.com/Netatalk/netatalk/wiki/Developer-FAQ

@UUVE
Copy link
Author

UUVE commented Apr 30, 2024

Hi, sorry for the late reply but I haven't had time to deal with the issue lately.
I can't follow suggestion 1 for various reasons, the most important of which is the fear of further damaging the shared volume by losing many resource forks still stored in the .AppleDouble folders now mixed with the Apple Double "._<*>" files.
However, following suggestion 2 I got the full backtrace of the "dbd -c " crash which I report below.
I would also need some clarification regarding the criteria on how "._<*>" files are created with respect to the creation of extended attributes and the size limit that extended attributes have in Linux (it should be 64kb while macos, I believe, has no size practical maximum size, and across multiple folders or files it stores extended attributes that exceed 64 kb). This is also in relation to how these things are currently handled by samba with the vfs vfruit module, in order to obtain two configurations (netatalk and samba) that are as compatible as possible, considering that I also access the shared volumes by Windows via samba (mainly on virtual machines).
For now though I would focus on solving this problem.
As further information, consider that the file system of shared volumes is zfs.

gdb backtrace

[email protected]:~/software/netatalk/netatalk-3.1.18-2_build# gdb --batch -ex 'bt full'  /usr/bin/dbd dbd.coredump
[New LWP 4150738]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `dbd -c /shares/Office/Users'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f5a6d3f274f in ad_conv_v22ea_rf (path=path@entry=0x55807ef724db "server.office-Applications", sp=sp@entry=0x55807d9a17e0 <st>, vol=vol@entry=0x55807ef52d20) at ./libatalk/adouble/ad_conv.c:160
160	./libatalk/adouble/ad_conv.c: File o directory non esistente.
#0  0x00007f5a6d3f274f in ad_conv_v22ea_rf (path=path@entry=0x55807ef724db "server.office-Applications", sp=sp@entry=0x55807d9a17e0 <st>, vol=vol@entry=0x55807ef52d20) at ./libatalk/adouble/ad_conv.c:160
        ret = 0
        adv2 = {ad_magic = 333319, ad_version = 131072, ad_filler = '\000' <repeats 15 times>, ad_eid = {{ade_off = 0, ade_len = 0}, {ade_off = 0, ade_len = 0}, {ade_off = 741, ade_len = 530}, {ade_off = 182, ade_len = 0}, {ade_off = 437, ade_len = 16}, {ade_off = 0, ade_len = 0}, {ade_off = 0, ade_len = 0}, {ade_off = 0, ade_len = 0}, {ade_off = 637, ade_len = 16}, {ade_off = 653, ade_len = 32}, {ade_off = 0, ade_len = 0}, {ade_off = 705, ade_len = 0}, {ade_off = 0, ade_len = 0}, {ade_off = 693, ade_len = 0}, {ade_off = 689, ade_len = 0}, {ade_off = 685, ade_len = 4}, {ade_off = 713, ade_len = 8}, {ade_off = 721, ade_len = 8}, {ade_off = 729, ade_len = 8}, {ade_off = 737, ade_len = 4}}, ad_data_fork = {adf_fd = -1, adf_syml = 0x0, adf_flags = 0, adf_lock = 0x0, adf_refcount = 0, adf_lockcount = 0, adf_lockmax = 0}, ad_resource_fork = {adf_fd = 12, adf_syml = 0x0, adf_flags = 131074, adf_lock = 0x0, adf_refcount = 1, adf_lockcount = 0, adf_lockmax = 0}, ad_rfp = 0x7fff520ed4d8, ad_mdp = 0x7fff520ed4d8, ad_vers = 131072, ad_adflags = 262, ad_inited = 2907262548, ad_options = 4, ad_refcount = 1, ad_data_refcount = 0, ad_meta_refcount = 1, ad_reso_refcount = 1, ad_rlen = 530, ad_name = 0x0, ad_ops = 0x7f5a6d44b360 <ad_adouble>, ad_open_forks = 0, valid_data_len = 741, ad_data = "\000\005\026\a\000\002", '\000' <repeats 19 times>, "\r\000\000\000\002\000\000\002\345\000\000\002\022\000\000\000\003\000\000\000\266\000\000\000\000\000\000\000\004\000\000\001\265\000\000\000\020\000\000\000\b\000\000\002}\000\000\000\020\000\000\000\t\000\000\002\215\000\000\000 \000\000\000\v\000\000\002\301\000\000\000\000\000\000\000\r\000\000\002\265\000\000\000\000\000\000\000\016\000\000\002\261\000\000\000\000\000\000\000\017\000\000\002\255\000\000\000\004\200DEV\000\000\002\311\000\000\000\b\200INO\000\000\002\321\000\000\000\b\200SYN\000\000\002\331\000\000\000\b\200SV~\000\000\002\341\000\000\000\004", '\000' <repeats 255 times>...}
        adea = {ad_magic = 0, ad_version = 0, ad_filler = '\000' <repeats 15 times>, ad_eid = {{ade_off = 0, ade_len = 0}, {ade_off = 0, ade_len = 0}, {ade_off = 82, ade_len = 0}, {ade_off = 0, ade_len = 0} <repeats 17 times>}, ad_data_fork = {adf_fd = 13, adf_syml = 0x0, adf_flags = 131138, adf_lock = 0x0, adf_refcount = 1, adf_lockcount = 0, adf_lockmax = 0}, ad_resource_fork = {adf_fd = 14, adf_syml = 0x0, adf_flags = 131074, adf_lock = 0x0, adf_refcount = 1, adf_lockcount = 0, adf_lockmax = 0}, ad_rfp = 0x7fff520edae8, ad_mdp = 0x7fff520edab8, ad_vers = 131074, ad_adflags = 1411, ad_inited = 2907262548, ad_options = 4, ad_refcount = 1, ad_data_refcount = 1, ad_meta_refcount = 0, ad_reso_refcount = 1, ad_rlen = 0, ad_name = 0x0, ad_ops = 0x7f5a6d44b320 <ad_adouble_ea>, ad_open_forks = 0, valid_data_len = 0, ad_data = '\000' <repeats 1023 times>}
        cleanup = <optimized out>
#1  0x00007f5a6d3f2aae in ad_conv_v22ea (vol=0x55807ef52d20, sp=0x55807d9a17e0 <st>, path=0x55807ef724db "server.office-Applications") at ./libatalk/adouble/ad_conv.c:187
        ret = 0
        adpath = <optimized out>
        adflags = <optimized out>
        cleanup = <optimized out>
        ret = <optimized out>
        adpath = <optimized out>
        adflags = <optimized out>
        delete = <optimized out>
        cleanup = <optimized out>
#2  ad_convert (path=0x55807ef724db "server.office-Applications", sp=sp@entry=0x55807d9a17e0 <st>, vol=0x55807ef52d20, newpath=newpath@entry=0x7fff520ee698) at ./libatalk/adouble/ad_conv.c:287
        ret = 0
        p = <optimized out>
#3  0x000055807d993778 in check_adfile (fname=fname@entry=0x55807ef724db "server.office-Applications", newname=newname@entry=0x7fff520ee698, st=0x55807d9a17e0 <st>) at ./etc/cnid_dbd/cmd_dbd_scanvol.c:171
        ret = <optimized out>
        adflags = 4
        ad = {ad_magic = 0, ad_version = 0, ad_filler = '\000' <repeats 15 times>, ad_eid = {{ade_off = 0, ade_len = 0} <repeats 20 times>}, ad_data_fork = {adf_fd = -1, adf_syml = 0x0, adf_flags = 131074, adf_lock = 0x0, adf_refcount = 0, adf_lockcount = 0, adf_lockmax = 0}, ad_resource_fork = {adf_fd = -1, adf_syml = 0x0, adf_flags = 0, adf_lock = 0x0, adf_refcount = 0, adf_lockcount = 0, adf_lockmax = 0}, ad_rfp = 0x7fff520ee188, ad_mdp = 0x7fff520ee158, ad_vers = 131074, ad_adflags = 260, ad_inited = 2907262548, ad_options = 4, ad_refcount = 1, ad_data_refcount = 0, ad_meta_refcount = 0, ad_reso_refcount = 0, ad_rlen = 0, ad_name = 0x0, ad_ops = 0x7f5a6d44b320 <ad_adouble_ea>, ad_open_forks = 0, valid_data_len = 0, ad_data = '\000' <repeats 1023 times>}
        adname = <optimized out>
#4  0x000055807d993bd0 in dbd_readdir (volroot=volroot@entry=0, did=did@entry=3878757888) at ./etc/cnid_dbd/cmd_dbd_scanvol.c:759
        statcount = 7104
        t = 1714447096
        name = 0x0
        cwd = <optimized out>
        ret = 0
        adfile_ok = -1
        addir_ok = 0
        cnid = <optimized out>
        name = <optimized out>
        dp = <optimized out>
        ep = 0x55807ef724c8
        st = {st_dev = 48, st_ino = 70536, st_nlink = 1, st_mode = 33188, st_uid = 604, st_gid = 604, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 512, st_blocks = 2, st_atim = {tv_sec = 1378854340, tv_nsec = 0}, st_mtim = {tv_sec = 1111489389, tv_nsec = 0}, st_ctim = {tv_sec = 1714446383, tv_nsec = 560054349}, __glibc_reserved = {0, 0, 0}}
#5  0x000055807d993cf0 in dbd_readdir (volroot=volroot@entry=0, did=did@entry=3526436352) at ./etc/cnid_dbd/cmd_dbd_scanvol.c:793
        statcount = 7104
        t = 1714447096
        name = 0x55807ef6a58b "Recent Servers"
        cwd = 10
        ret = 0
        adfile_ok = <optimized out>
        addir_ok = 0
        cnid = 3878757888
        name = <optimized out>
        dp = <optimized out>
        ep = <optimized out>
        st = {st_dev = 48, st_ino = 70536, st_nlink = 1, st_mode = 33188, st_uid = 604, st_gid = 604, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 512, st_blocks = 2, st_atim = {tv_sec = 1378854340, tv_nsec = 0}, st_mtim = {tv_sec = 1111489389, tv_nsec = 0}, st_ctim = {tv_sec = 1714446383, tv_nsec = 560054349}, __glibc_reserved = {0, 0, 0}}
#6  0x000055807d993cf0 in dbd_readdir (volroot=volroot@entry=0, did=did@entry=3476104704) at ./etc/cnid_dbd/cmd_dbd_scanvol.c:793
        statcount = 7104
        t = 1714447096
        name = 0x55807ef62463 "Library"
        cwd = 8
        ret = 0
        adfile_ok = <optimized out>
        addir_ok = 0
        cnid = 3526436352
        name = <optimized out>
        dp = <optimized out>
        ep = <optimized out>
        st = {st_dev = 48, st_ino = 70536, st_nlink = 1, st_mode = 33188, st_uid = 604, st_gid = 604, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 512, st_blocks = 2, st_atim = {tv_sec = 1378854340, tv_nsec = 0}, st_mtim = {tv_sec = 1111489389, tv_nsec = 0}, st_ctim = {tv_sec = 1714446383, tv_nsec = 560054349}, __glibc_reserved = {0, 0, 0}}
#7  0x000055807d993cf0 in dbd_readdir (volroot=volroot@entry=1, did=did@entry=33554432) at ./etc/cnid_dbd/cmd_dbd_scanvol.c:793
        statcount = 7104
        t = 1714447096
        name = 0x55807ef5a46b "elpaol"
        cwd = 6
        ret = 0
        adfile_ok = <optimized out>
        addir_ok = 0
        cnid = 3476104704
        name = <optimized out>
        dp = <optimized out>
        ep = <optimized out>
        st = {st_dev = 48, st_ino = 70536, st_nlink = 1, st_mode = 33188, st_uid = 604, st_gid = 604, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 512, st_blocks = 2, st_atim = {tv_sec = 1378854340, tv_nsec = 0}, st_mtim = {tv_sec = 1111489389, tv_nsec = 0}, st_ctim = {tv_sec = 1714446383, tv_nsec = 560054349}, __glibc_reserved = {0, 0, 0}}
#8  0x000055807d9945a7 in cmd_dbd_scanvol (vol_in=vol_in@entry=0x55807ef52d20, flags=<optimized out>) at ./etc/cnid_dbd/cmd_dbd_scanvol.c:870
        ret = 0
        st = {st_dev = 48, st_ino = 34, st_nlink = 18, st_mode = 16877, st_uid = 499, st_gid = 50, __pad0 = 0, st_rdev = 0, st_size = 20, st_blksize = 1536, st_blocks = 18, st_atim = {tv_sec = 1714446381, tv_nsec = 540054464}, st_mtim = {tv_sec = 1416830337, tv_nsec = 350648526}, st_ctim = {tv_sec = 1699987450, tv_nsec = 639976011}, __glibc_reserved = {0, 0, 0}}
#9  0x000055807d992a01 in main (argc=<optimized out>, argv=<optimized out>) at ./etc/cnid_dbd/cmd_dbd.c:292
        ret = 0
        dbd_cmd = <optimized out>
        cdir = 3
        obj = {cmdlineconfigfile = 0x0, cmdlineflags = 0, signature = 0x0, dsi = 0x0, options = {connections = 200, tickleval = 30, timeout = 4, flags = 67972, dircachesize = 8192, sleep = 1200, disconnected = 2880, fce_fmodwait = 60, tcp_sndbuf = 524288, tcp_rcvbuf = 524288, passwdbits = 0 '\000', passwdminlen = 0 '\000', server_quantum = 1048576, dsireadbuf = 12, hostname = 0x55807ef39380 "Server_AFP", listen = 0x0, interfaces = 0x0, port = 0x55807ef39120 "548", Cnid_srv = 0x55807ef39200 "localhost", Cnid_port = 0x55807ef39760 "4700", configfile = 0x55807ef385c0 "/etc/netatalk/afp.conf", uampath = 0x55807ef4ee30 "/usr/lib/x86_64-linux-gnu/netatalk/", fqdn = 0x0, sigconffile = 0x55807ef4e190 "/var/lib/netatalk/afp_signature.conf", uuidconf = 0x55807ef4e1c0 "/var/lib/netatalk/afp_voluuid.conf", guest = 0x55807ef38ca0 "nobody", loginmesg = 0x0, keyfile = 0x0, passwdfile = 0x55807ef38be0 "/etc/netatalk/afppasswd", extmapfile = 0x55807ef4fde0 "/etc/netatalk/extmap.conf", uamlist = 0x55807ef4fbf0 "uams_guest.so uams_dhx.so uams_dhx2.so uams_gss.so", signatureopt = 0x55807ef396a0 "", signature = '\000' <repeats 15 times>, k5service = 0x55807ef395e0 "afpserver", k5realm = 0x55807ef39520 "<_removed_>", k5keytab = hidden "KRB5_KTNAME=/etc/netatalk/afpserver.keytab", k5principal_buflen = 0, k5principal = 0x0, unixcodepage = 0x55807ef39cc0 "UTF8", maccodepage = 0x55807ef39a80 "MAC_ROMAN", volcodepage = 0x55807ef39b40 "UTF8", maccharset = CH_MAC, unixcharset = CH_UNIX, umask = 0, save_mask = 0, admingid = 0, force_user = false, force_uid = 0, force_group = false, force_gid = 0, volnamelen = 80, ntdomain = 0x0, ntseparator = 0x0, addomain = 0x0, logconfig = 0x55807ef38d60 "default:note", logfile = 0x0, mimicmodel = 0x55807ef39440 "Macmini", zeroconfname = 0x0, adminauthuser = 0x0, ignored_attr = 0x0, splice_size = 65536, cnid_mysql_host = 0x0, cnid_mysql_user = 0x0, cnid_mysql_pw = 0x0, cnid_mysql_db = 0x0, volfile = {mtime = 1714299784, loaded = 0}, includefile = {mtime = 0, loaded = 0}, sparql_limit = 0}, iniconfig = 0x55807ef4e3d0, username = '\000' <repeats 255 times>, oldtmp = '\000' <repeats 4096 times>, newtmp = '\000' <repeats 4096 times>, uam_cookie = 0x0, sinfo = {sessionkey = 0x0, sessionkey_len = 0, cryptedkey = 0x0, cryptedkey_len = 0, sessiontoken = 0x0, sessiontoken_len = 0, clientid = 0x0, clientid_len = 0}, uid = 0, euid = 0, ipc_fd = 0, groups = 0x0, ngroups = 0, afp_version = 11, cnx_cnt = 0, cnx_max = 0, logout = 0x0, exit = 0x0, reply = 0x0, attention = 0x0, fce_version = 0, fce_ign_names = 0x0, fce_ign_directories = 0x0, fce_notify_script = 0x0, sl_ctx = 0x0}
        vol = 0x55807ef52d20
        volpath = 0x7fff520f16aa "/shares/Office/Users"
        username = <optimized out>
        c = <optimized out>
        cleanup = <optimized out>

@UUVE UUVE closed this as completed Apr 30, 2024
@UUVE UUVE reopened this Apr 30, 2024
@UUVE
Copy link
Author

UUVE commented Apr 30, 2024

... Sorry, I have closed the issue by mistake

@UUVE
Copy link
Author

UUVE commented Apr 30, 2024

As additional information: the file that triggers the segfault is in "/shares/Office/Users/<username_hidden>/Library/Recent Servers"
the "._server.office-Application" created is only 82 bytes in size while the corresponding file to be converted in the relevant .AppleDouble directory is about 1.3Kb in size.

[email protected]:~/software/netatalk/netatalk-3.1.18-2_build# ls -alnhR /shares/Office/Users/<username_hidden>/Library/Recent\ Servers/
'/shares/Office/Users/\<username_hidden\>/Library/Recent Servers/':
totale 535K
drwxr-xr-x  3 604 604    7 30 apr 05.06 .
drwx------ 29 604 604   31 23 nov  2014 ..
drwxr-xr-x  2 604 604    4 28 apr 13.06 .AppleDouble
-rw-------  1   0   0 2,0M 30 apr 05.06 core
-rw-r--r--  1 604 604    0  7 dic  2005 server-Applications
-rw-rw-rw-  1   0   0   82 16 apr 17.22 ._server.office-Applications
-rw-r--r--  1 604 604    0 22 mar  2005 server.office-Applications

'/shares/Office/Users/\<username_hidden\>/Library/Recent Servers/.AppleDouble':
totale 20K
drwxr-xr-x 2 604 604    4 28 apr 13.06 .
drwxr-xr-x 3 604 604    7 30 apr 05.06 ..
-rw-r--r-- 1 604 604 1,3K 23 nov  2014 server-Applications
-rw-r--r-- 1 604 604 1,3K 23 nov  2014 server.office-Applications
[email protected]:~/software/netatalk/netatalk-3.1.18-2_build#

@rdmark
Copy link
Member

rdmark commented Jun 5, 2024

@UUVE Would you be able to retry this with the recently released v3.2.0?

This release contains two specific patches that address EA metadata handling in libatalk, namely: #513 and #575

It should lead to a more graceful outcome when encountering "invalid" types of metadata, and I'm curious how it will look in your case.

@UUVE
Copy link
Author

UUVE commented Jun 6, 2024

@rdmark
I hope to find time to recompile the latest version in a debian package this weekend and do some testing. In any case I will report back as soon as possible.

@rdmark
Copy link
Member

rdmark commented Jun 14, 2024

@UUVE In case it helps, we now distribute a build-from-source guide as an appendix to the Netatalk manual. See the Debian section here: https://netatalk.io/3.2/htmldocs/compile#build-debian

@rdmark
Copy link
Member

rdmark commented Jul 16, 2024

@UUVE Do you have any update on your testing?

@rdmark rdmark assigned rdmark and unassigned rdmark Jul 16, 2024
@UUVE
Copy link
Author

UUVE commented Aug 25, 2024

I finally found the time to recompile a package for Debian Bookworm of the latest Netatalk 3.2.7. Unfortunately the segmentation fault of "dbd -c " is unchanged. Here is the verbose output of "dbd -vc " and gdb's analysis of the coredump with backtrace. It seems that the segmentation fault occurs when trying to convert the .AppleDouble file of an alias in a network user's home directory: "/shares/Office/Users/elpaol/Library/Recent Servers/server.office-Applications".
As a side note I can't compile Netatalk with quota support, despite explicitly passing --enable-quota to configure.

last lines of dbd -vc ... output
Aug 25 12:30:39.892966 dbd[681964] {cnid_dbd.c:583} (debug:CNID): cnid_dbd_add: got CNID: 3198281 Entering directory: /shares/Office/Users/elpaol/Library/Recent Servers Errore di segmentazione (core dump creato)

gdb's analysis of the coredump with backtrace
`[email protected]:~/software/netatalk/netatalk-3.2.7_build# coredumpctl debug
PID: 681964 (dbd)
UID: 0 (root)
GID: 0 (root)
Signal: 11 (SEGV)
Timestamp: Sun 2024-08-25 12:30:39 CEST (6min ago)
Command Line: dbd -cv /shares/Office/Users/
Executable: /usr/bin/dbd
Control Group: /user.slice/user-0.slice/session-736.scope
Unit: session-736.scope
Slice: user-0.slice
Session: 736
Owner UID: 0 (root)
Boot ID: d47fbc2f9a0849c98ac6ee65f298175d
Machine ID: d7035d553415f75de14ee998495ca34d
Hostname: server1
Storage: /var/lib/systemd/coredump/core.dbd.0.d47fbc2f9a0849c98ac6ee65f298175d.681964.1724581839000000.zst (present)
Size on Disk: 286.5K
Message: Process 681964 (dbd) of user 0 dumped core.

            Stack trace of thread 681964:
            #0  0x00007f4cd923efb7 ad_conv_v22ea_rf (libatalk.so.18 + 0x14fb7)
            #1  0x00007f4cd923f2cd ad_conv_v22ea (libatalk.so.18 + 0x152cd)
            #2  0x00007f4cd923f78f ad_convert (libatalk.so.18 + 0x1578f)
            #3  0x0000558d054f93af check_adfile (dbd + 0x33af)
            #4  0x0000558d054faf0f dbd_readdir (dbd + 0x4f0f)
            #5  0x0000558d054fb0d1 dbd_readdir (dbd + 0x50d1)
            #6  0x0000558d054fb0d1 dbd_readdir (dbd + 0x50d1)
            #7  0x0000558d054fb0d1 dbd_readdir (dbd + 0x50d1)
            #8  0x0000558d054fb3df cmd_dbd_scanvol (dbd + 0x53df)
            #9  0x0000558d054f8fbf main (dbd + 0x2fbf)
            #10 0x00007f4cd8eae24a __libc_start_call_main (libc.so.6 + 0x2724a)
            #11 0x00007f4cd8eae305 __libc_start_main_impl (libc.so.6 + 0x27305)
            #12 0x0000558d054f8581 _start (dbd + 0x2581)
            ELF object binary architecture: AMD x86-64

GNU gdb (Debian 13.1-3) 13.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/dbd...
Reading symbols from /usr/lib/debug/.build-id/3e/62cfd3e268e1a8982464e5b04f17df81e54976.debug...
[New LWP 681964]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by dbd -cv /shares/Office/Users/'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007f4cd923efb7 in ad_conv_v22ea_rf (path=0x558d06b20183 "server.office-Applications", sp=0x558d0550b700 <st>, --Type <RET> for more, q to quit, c to continue without paging--c vol=0x558d06af7c80) at ad_conv.c:160 160 EC_ZERO_LOG( copy_fork(ADEID_RFORK, &adea, &adv2, (gdb) bt full #0 0x00007f4cd923efb7 in ad_conv_v22ea_rf (path=0x558d06b20183 "server.office-Applications", sp=0x558d0550b700 <st>, vol=0x558d06af7c80) at ad_conv.c:160 ret = 0 adv2 = {ad_magic = 333319, ad_version = 131072, ad_filler = '\000' <repeats 15 times>, ad_eid = {{ade_off = 0, ade_len = 0}, {ade_off = 0, ade_len = 0}, {ade_off = 741, ade_len = 530}, {ade_off = 182, ade_len = 0}, { ade_off = 437, ade_len = 16}, {ade_off = 0, ade_len = 0}, {ade_off = 0, ade_len = 0}, {ade_off = 0, ade_len = 0}, {ade_off = 637, ade_len = 16}, {ade_off = 653, ade_len = 32}, {ade_off = 0, ade_len = 0}, { ade_off = 705, ade_len = 0}, {ade_off = 0, ade_len = 0}, {ade_off = 693, ade_len = 0}, {ade_off = 689, ade_len = 0}, {ade_off = 685, ade_len = 4}, {ade_off = 713, ade_len = 8}, {ade_off = 721, ade_len = 8}, { ade_off = 729, ade_len = 8}, {ade_off = 737, ade_len = 4}}, ad_data_fork = {adf_fd = -1, adf_syml = 0x0, adf_flags = 0, adf_lock = 0x0, adf_refcount = 0, adf_lockcount = 0, adf_lockmax = 0}, ad_resource_fork = { adf_fd = 12, adf_syml = 0x0, adf_flags = 131074, adf_lock = 0x0, adf_refcount = 1, adf_lockcount = 0, adf_lockmax = 0}, ad_rfp = 0x7ffc82978a28, ad_mdp = 0x7ffc82978a28, ad_vers = 131072, ad_adflags = 262, ad_inited = 2907262548, ad_options = 4, ad_refcount = 1, ad_data_refcount = 0, ad_meta_refcount = 1, ad_reso_refcount = 1, ad_rlen = 530, ad_name = 0x0, ad_ops = 0x7f4cd92a5400 <ad_adouble>, ad_open_forks = 0, valid_data_len = 741, ad_data = "\000\005\026\a\000\002", '\000' <repeats 19 times>, "\r\000\000\000\002\000\000\002\345\000\000\002\022\000\000\000\003\000\000\000\266\000\000\000\000\000\000\000\004\000\000\001\265\000\000\000\020\000\000\000\b\000\000\002}\000\000\000\020\000\000\000\t\000\000\002\215\000\000\000 \000\000\000\v\000\000\002\301\000\000\000\000\000\000\000\r\000\000\002\265\000\000\000\000\000\000\000\016\000\000\002\261\000\000\000\000\000\000\000\017\000\000\002\255\000\000\000\004\200DEV\000\000\002\311\000\000\000\b\200INO\000\000\002\321\000\000\000\b\200SYN\000\000\002\331\000\000\000\b\200SV~\000\000\002\341\000\000\000\004", '\000' <repeats 255 times>...} adea = {ad_magic = 0, ad_version = 0, ad_filler = '\000' <repeats 15 times>, ad_eid = {{ade_off = 0, --Type <RET> for more, q to quit, c to continue without paging--c ade_len = 0}, {ade_off = 0, ade_len = 0}, {ade_off = 82, ade_len = 0}, {ade_off = 0, ade_len = 0} <repeats 17 times>}, ad_data_fork = {adf_fd = 13, adf_syml = 0x0, adf_flags = 131138, adf_lock = 0x0, adf_refcount = 1, adf_lockcount = 0, adf_lockmax = 0}, ad_resource_fork = {adf_fd = 14, adf_syml = 0x0, adf_flags = 131074, adf_lock = 0x0, adf_refcount = 1, adf_lockcount = 0, adf_lockmax = 0}, ad_rfp = 0x7ffc82978418, ad_mdp = 0x7ffc829783e8, ad_vers = 131074, ad_adflags = 1411, ad_inited = 2907262548, ad_options = 4, ad_refcount = 1, ad_data_refcount = 1, ad_meta_refcount = 0, ad_reso_refcount = 1, ad_rlen = 0, ad_name = 0x0, ad_ops = 0x7f4cd92a5440 <ad_adouble_ea>, ad_open_forks = 0, valid_data_len = 0, ad_data = '\000' <repeats 1023 times>} #1 0x00007f4cd923f2cd in ad_conv_v22ea (path=0x558d06b20183 "server.office-Applications", sp=0x558d0550b700 <st>, vol=0x558d06af7c80) at ad_conv.c:187 ret = 0 adpath = 0x3 <error: Cannot access memory at address 0x3> adflags = 0 #2 0x00007f4cd923f78f in ad_convert (path=0x558d06b20183 "server.office-Applications", sp=0x558d0550b700 <st>, vol=0x558d06af7c80, newpath=0x7ffc829795c8) at ad_conv.c:287 ret = 0 p = 0x558d0550b700 <st> "." #3 0x0000558d054f93af in check_adfile (fname=0x558d06b20183 "server.office-Applications", st=0x558d0550b700 <st>, newname=0x7ffc829795c8) at cmd_dbd_scanvol.c:171 ret = 32588 adflags = 4 ad = {ad_magic = 112296523, ad_version = 21901, ad_filler = "\000\000\000\000\0000\3154\000\267P\005\215U\000", ad_eid = {{ade_off = 94064190942016, ade_len = 94064167910168}, {ade_off = 5317959515196346400, ade_len = 140722499458560}, { ade_off = 94064167856046, ade_len = 0}, {ade_off = 94064167925504, ade_len = 3804750036756070401}, { ade_off = 94064191046219, ade_len = 0}, {ade_off = 0, ade_len = 0} <repeats 15 times>}, ad_data_fork = { adf_fd = 0, adf_syml = 0x0, adf_flags = 0, adf_lock = 0x0, adf_refcount = 0, adf_lockcount = 0, adf_lockmax = 0}, ad_resource_fork = {adf_fd = 0, adf_syml = 0x0, adf_flags = 0, adf_lock = 0x0, adf_refcount = 0, adf_lockcount = 0, adf_lockmax = 0}, ad_rfp = 0xffffffff, ad_mdp = 0x0, ad_vers = 131072, ad_adflags = 0, ad_inited = 0, ad_options = 0, ad_refcount = 0, ad_data_refcount = 0, ad_meta_refcount = 0, ad_reso_refcount = 0, ad_rlen = 4294967295, ad_name = 0x0, ad_ops = 0x0, ad_open_forks = 0, valid_data_len = 0, ad_data = "\000\000\000\000\000\000\000\000X\221\227\202\374\177\000\000(\221\227\202\374\177\000\000\002\000\002\000\f\001\000\000TNI\255\004\000\000\000\001", '\000' <repeats 31 times>, "@T*\331L\177", '\000' <repeats 362 times>...} adname = 0x558d06b20183 "server.office-Applications" #4 0x0000558d054faf0f in dbd_readdir (volroot=0, did=1238183936) at cmd_dbd_scanvol.c:762 statcount = 7103 t = 1724581838 name = 0x0 cwd = 0 ret = 0 adfile_ok = -1 addir_ok = 0 cnid = 0 name = 0x0 dp = 0x558d06b20110 ep = 0x558d06b20170 st = {st_dev = 46, st_ino = 70536, st_nlink = 1, st_mode = 33188, st_uid = 604, st_gid = 604, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 512, st_blocks = 2, st_atim = {tv_sec = 1378854340, tv_nsec = 0}, st_mtim = {tv_sec = 1111489389, tv_nsec = 0}, st_ctim = {tv_sec = 1724581829, tv_nsec = 217045459}, __glibc_reserved = {0, 0, 0}} #5 0x0000558d054fb0d1 in dbd_readdir (volroot=0, did=885862400) at cmd_dbd_scanvol.c:796 statcount = 7103 t = 1724581838 name = 0x558d06b1824b "Recent Servers" cwd = 10 ret = 0 adfile_ok = 0 addir_ok = 0 cnid = 1238183936 name = 0x0 dp = 0x558d06b180d0 ep = 0x558d06b18238 st = {st_dev = 46, st_ino = 70536, st_nlink = 1, st_mode = 33188, st_uid = 604, st_gid = 604, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 512, st_blocks = 2, st_atim = {tv_sec = 1378854340, tv_nsec = 0}, st_mtim = {tv_sec = 1111489389, tv_nsec = 0}, st_ctim = {tv_sec = 1724581829, tv_nsec = 217045459}, __glibc_reserved = {0, 0, 0}} #6 0x0000558d054fb0d1 in dbd_readdir (volroot=0, did=835530752) at cmd_dbd_scanvol.c:796 statcount = 7103 t = 1724581838 name = 0x558d06b07fa3 "Library" cwd = 8 ret = 0 adfile_ok = 0 addir_ok = 0 cnid = 885862400 name = 0x0 dp = 0x558d06b07f10 ep = 0x558d06b07f90 st = {st_dev = 46, st_ino = 70536, st_nlink = 1, st_mode = 33188, st_uid = 604, st_gid = 604, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 512, st_blocks = 2, st_atim = {tv_sec = 1378854340, tv_nsec = 0}, st_mtim = {tv_sec = 1111489389, tv_nsec = 0}, st_ctim = {tv_sec = 1724581829, tv_nsec = 217045459}, __glibc_reserved = {0, 0, 0}} #7 0x0000558d054fb0d1 in dbd_readdir (volroot=1, did=33554432) at cmd_dbd_scanvol.c:796 statcount = 7103 t = 1724581838 name = 0x558d06afffab "elpaol" cwd = 6 ret = 0 adfile_ok = 0 addir_ok = 0 cnid = 835530752 name = 0x0 dp = 0x558d06affed0 ep = 0x558d06afff98 st = {st_dev = 46, st_ino = 70536, st_nlink = 1, st_mode = 33188, st_uid = 604, st_gid = 604, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 512, st_blocks = 2, st_atim = {tv_sec = 1378854340, tv_nsec = 0}, st_mtim = {tv_sec = 1111489389, tv_nsec = 0}, st_ctim = {tv_sec = 1724581829, tv_nsec = 217045459}, __glibc_reserved = {0, 0, 0}} #8 0x0000558d054fb3df in cmd_dbd_scanvol (vol_in=0x558d06af7c80, flags=24) at cmd_dbd_scanvol.c:874 ret = 0 st = {st_dev = 46, st_ino = 34, st_nlink = 18, st_mode = 16877, st_uid = 499, st_gid = 50, __pad0 = 0, st_rdev = 0, st_size = 20, st_blksize = 1536, st_blocks = 18, st_atim = {tv_sec = 1724539111, tv_nsec = 161535604}, st_mtim = {tv_sec = 1416830337, tv_nsec = 350648526}, st_ctim = { tv_sec = 1699987450, tv_nsec = 639976011}, __glibc_reserved = {0, 0, 0}} #9 0x0000558d054f8fbf in main (argc=3, argv=0x7ffc8297bd18) at cmd_dbd.c:293 ret = 0 dbd_cmd = 1 cdir = 3 obj = {cmdlineconfigfile = 0x0, cmdlineflags = 0, signature = 0x0, dsi = 0x0, options = {connections = 200, tickleval = 30, timeout = 4, flags = 67972, dircachesize = 8192, sleep = 1200, disconnected = 2880, fce_fmodwait = 60, fce_sendwait = 0, tcp_sndbuf = 524288, tcp_rcvbuf = 524288, passwdbits = 0 '\000', passwdminlen = 0 '\000', server_quantum = 1048576, dsireadbuf = 12, hostname = 0x558d06ade380 "Server_AFP", listen = 0x0, interfaces = 0x0, port = 0x558d06ade120 "548", Cnid_srv = 0x558d06ade200 "localhost", Cnid_port = 0x558d06ade760 "4700", configfile = 0x558d06add5c0 "/etc/netatalk/afp.conf", uampath = 0x558d06af3e30 "/usr/lib/x86_64-linux-gnu/netatalk/", fqdn = 0x0, sigconffile = 0x558d06af3190 "/var/lib/netatalk/afp_signature.conf", uuidconf = 0x558d06af31c0 "/var/lib/netatalk/afp_voluuid.conf", guest = 0x558d06addca0 "nobody", loginmesg = 0x0, keyfile = 0x0, passwdfile = 0x558d06addbe0 "/etc/netatalk/afppasswd", extmapfile = 0x558d06af4de0 "/etc/netatalk/extmap.conf", uamlist = 0x558d06af4bf0 "uams_guest.so uams_dhx.so uams_dhx2.so uams_gss.so", signatureopt = 0x558d06ade6a0 "", signature = '\000' <repeats 15 times>, k5service = 0x558d06ade5e0 "afpserver", k5realm = 0x558d06ade520 "HOME.FOGLIUZZI.IT", k5keytab = hidden "KRB5_KTNAME=/etc/netatalk/afpserver.keytab", k5principal_buflen = 0, k5principal = 0x0, unixcodepage = 0x558d06adecc0 "UTF8", maccodepage = 0x558d06adea80 "MAC_ROMAN", volcodepage = 0x558d06adeb40 "UTF8", maccharset = CH_MAC, unixcharset = CH_UNIX, umask = 0, save_mask = 0, admingid = 0, force_user = false, force_uid = 0, force_group = false, force_gid = 0, volnamelen = 80, ntdomain = 0x0, ntseparator = 0x0, addomain = 0x0, logconfig = 0x558d06addd60 "default:note", logfile = 0x0, log_us_timestamp = true, mimicmodel = 0x558d06ade440 "Macmini", zeroconfname = 0x0, adminauthuser = 0x0, ignored_attr = 0x0, splice_size = 65536, cnid_mysql_host = 0x0, cnid_mysql_user = 0x0, cnid_mysql_pw = 0x0, cnid_mysql_db = 0x0, volfile = {mtime = 1714474291, loaded = 0}, includefile = {mtime = 0, loaded = 0}, sparql_limit = 0}, iniconfig = 0x558d06af33d0, username = '\000' <repeats 255 times>, oldtmp = '\000' <repeats 4096 times>, newtmp = '\000' <repeats 4096 times>, uam_cookie = 0x0, sinfo = {sessionkey = 0x0, sessionkey_len = 0, cryptedkey = 0x0, cryptedkey_len = 0, sessiontoken = 0x0, sessiontoken_len = 0, clientid = 0x0, clientid_len = 0}, uid = 0, euid = 0, ipc_fd = 0, groups = 0x0, ngroups = 0, afp_version = 11, cnx_cnt = 0, cnx_max = 0, logout = 0x0, exit = 0x0, reply = 0x0, attention = 0x0, fce_version = 0, fce_ign_names = 0x0, fce_ign_directories = 0x0, fce_notify_script = 0x0, sl_ctx = 0x0} vol = 0x558d06af7c80 volpath = 0x7ffc8297c6b1 "/shares/Office/Users/" username = 0x0 c = -1 (gdb) q

@UUVE
Copy link
Author

UUVE commented Aug 25, 2024

Another side note. Netatalk compiled with configure and then make does not use the wolfssl library included in the distribution nor the wolfssl library installed in Debian thus precluding the use of Mac OS 9 as a client. Is the GNU build system with configure aligned with the meson build system?

@rdmark
Copy link
Member

rdmark commented Aug 25, 2024

That's a bummer, so we are back to the drawing board then. The stack trace may provide some hints, however.

Regarding your two other questions:

To build with quota on Debian, you need the libtirpc-dev package and if you use the Autotools build system append the --with-libtirpc flag.

Wolfssl is only supported in the Meson build system. In fact, one of the main reasons we introduced the Meson build system was to make wolfssl integration feasible. Meson is very easy to get started with, so I encourage you to give it a go! We have guides to help you along.

@UUVE
Copy link
Author

UUVE commented Aug 25, 2024

@rdmark .Thanks a lot for the support and suggestions. Now I have to find a way to create a debian package using meson instead of autotools. In order to keep track of everything that is installed on the Debian server I prefer to install only debian packages, creating them myself when they are not available in the distribution used. If it can be helpful I can attach in this thread the file guilty of the segmentation fault in dbd. As soon as I can access the server with mac OS 9 (virtual machine) I will try, if it were ever possible, to open the file with Resedit., even if I fear this will trigger an error in afpd

@rdmark
Copy link
Member

rdmark commented Aug 26, 2024

You can see how I did the Debian packaging of netatalk with Meson here.

https://salsa.debian.org/netatalk-team/netatalk/-/blob/debian/latest/debian/rules?ref_type=heads

It's as simple as passing the --buildsystem=meson+ninja parameter to the debian helper program, and then adjust the various configuration flags.
If it helps, you can also find pre-built debs for Debian Bookworm distributed with stable releases:

https://github.com/Netatalk/netatalk/releases/tag/netatalk-3-2-7

@UUVE
Copy link
Author

UUVE commented Aug 26, 2024

I also noticed shortly before you mentioned that a debian package is also being released along with the sources. The best news, however, was that you seem to be the current maintainer for debian unstable. This will greatly improve and simplify the release of netatalk in the next debian release, especially considering the attention that is given to this distribution. I really think it is great thing that the maintainer of netatalk is also the maintainer of the Debian package. I noticed that the version on debian unstable is stuck at 3.1.18 while on https://salsa.debian.org/netatalk-team/netatalk it is updated to the latest release 3.2.7. Is there a particular reason for this (Debian policy or something else)?

@UUVE
Copy link
Author

UUVE commented Aug 26, 2024

Back to the problem. After recompiling and installing the debian package of version 3.2.7 following your suggestions (if only to get familiar with the meson build), I found these facts.

  1. Once you access the file guilty of the segmentation fault in dbd -c via afp, this file no longer gives a segmentation fault error in dbd -c (which continues until the next file that generates a segmentation fault) and it seems that the server completes the conversion from AppleDouble to ._. While before afpd (and the Finder on the client machine) entered an error loop and I had to force the exit of both.
  2. the converted file appears corrupted however trying to open it later with Resedit in MacOs 9 on a virtual machine.

This is the screenshot of Resedit:
image
The strange thing is that in the Mac OS 9 Finder I see the corresponding .AppleDouble folders (before the conversion on the server) and the corresponding ._ files after the conversion on the server by afpd

@rdmark
Copy link
Member

rdmark commented Aug 28, 2024

I’m still a Debian maintainer-in-training. My sponsor hasn’t signed off on the newer packages yet, but I think 3.2.7 should be good to ship now. Will hopefully get approval shortly!

@rdmark
Copy link
Member

rdmark commented Aug 28, 2024

Regarding the issue at hand, it sounds like the behavior has changed in 3.2.7, correct? You still get a segfault, but it comes a little later than before? What happens if you rerun dbd on the same volume afterwards?

@UUVE
Copy link
Author

UUVE commented Aug 28, 2024

Yes the behavior has changed.
The strange thing in Mac OS 9 is that if I open the folder where the file that causes the dbc segmentation fault is located I can first see the .AppleDouble folder in the Finder and immediately after clicking on the offending file the .AppleDouble folder disappears and the corresponding ._<...> file appears, probably generated on the fly by afpd on the server. In any case the file does not appear in the Finder as a single file either before or after the afpd conversion and is not usable. For example, if the file is an alias as often happens, it is no longer possible to identify the original.

@UUVE
Copy link
Author

UUVE commented Aug 28, 2024

I attach an AppleDouble file (in the .AppleDouble folder on the server) that causes the dbd -c segmentation fault.
Pref. Monitor.gz

@rdmark
Copy link
Member

rdmark commented Aug 30, 2024

Is the stack trace identical or has it changed too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants