After commit 5fa43440ebd3 ("vfs: Implement larger streams in multiple xattrs"), I get continuous signal 8 (SIGFPE) crashes in smbd child processes, on FreeBSD 15.1-STABLE. This is with Samba 4.25.0, but master behaves the same. The problem lies in this new piece of code in streams_xattr_get_ea_value_fsp(): 427 if (attr_size > (SIZE_MAX / config->max_extents)) { 428 return EOVERFLOW; 429 } 430 max_stream_size = attr_size * config->max_extents; In streams_xattr_connect(), config->max_extents is set to max_xattrs - 1: 1487 max_xattrs = lp_parm_int(SNUM(handle->conn), 1488 "streams_xattr", 1489 "max xattrs per stream", 1490 1); 1491 if ((max_xattrs < 1) || (max_xattrs > 16)) { 1492 DBG_WARNING("\"max xattrs per stream\"=%d invalid: " 1493 "Between 1 and 16 possible\n", 1494 max_xattrs); 1495 errno = EINVAL; 1496 return -1; 1497 } 1498 config->max_extents = max_xattrs - 1; Since the default for max_xattrs is 1 (this is also stated in the documentation), the default for config->max_extents will be zero, and you will get a division by zero error in streams_xattr_get_ea_value_fsp: Program terminated with signal SIGFPE, Arithmetic exception. Integer divide by zero. #0 0x0000007eaa962e4f in streams_xattr_get_ea_value_fsp (mem_ctx=0x36dfc04e3880, config=0x36dfbfc74580, fsp=0x36dfbfc85e60, ea_name=0x36dfc04e4430 "com.apple.quarantine:$DATA", _val=0x8203a9ea0) at ../../source3/modules/vfs_streams_xattr.c:434 434 if (attr_size > (SIZE_MAX / config->max_extents)) { (gdb) p *config $2 = {prefix = 0x36dfbfce5160 "user.DosStream.", prefix_len = 15, ext_prefix = 0x36dfbfd02fe0 "user.DosStreamExt.", max_extents = 0, store_stream_type = true} There needs to be some special-casing for this default, or max_extents should maybe never be set to zero?
At the moment I'm using this as a workaround, and it seems to fix the problem: --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -424,7 +424,8 @@ static int streams_xattr_get_ea_value_fsp( return EACCES; } - if (attr_size > (SIZE_MAX / config->max_extents)) { + if (config->max_extents && + attr_size > (SIZE_MAX / config->max_extents)) { return EOVERFLOW; } max_stream_size = attr_size * config->max_extents;
https://gitlab.com/samba-team/samba/-/merge_requests/4755
This bug was referenced in samba master: 21f8b3398bb8ec50109452ea7c8c1b15f98197cd
(In reply to Samba QA Contact from comment #3) What's needed to get this backported to 4.24 and 4.25?