git: c33a58c5210b - main - net/samba425: avoid SIGFPE in streams_xattr_get_ea_value_fsp

From: Xavier Beaudouin <kiwi_at_FreeBSD.org>
Date: Mon, 19 Oct 2026 04:46:11 UTC
The branch main has been updated by kiwi:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c33a58c5210b18843f70f9272dad6f7abf09fb38

commit c33a58c5210b18843f70f9272dad6f7abf09fb38
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-10-19 04:44:28 +0000
Commit:     Xavier Beaudouin <kiwi@FreeBSD.org>
CommitDate: 2026-10-19 04:45:47 +0000

    net/samba425: avoid SIGFPE in streams_xattr_get_ea_value_fsp
    
    As reported in https://bugzilla.samba.org/show_bug.cgi?id=16278,
    upstream commit 5fa43440ebd3 ("vfs: Implement larger streams in multiple
    xattrs"), results in many signal 8 (SIGFPE) crashes in smbd child
    processes on FreeBSD, if the streams_xattr vfs module is loaded.
    
    This is because streams_xattr_get_ea_value_fsp() can divide by zero, if
    the "max xattrs per stream" is left at its default value.
    
    Apply the upstream fix to avoid the crashes.
    
    PR:             299446
    Obtained from:  https://gitlab.com/samba-team/samba/-/commit/21f8b339
    MFH:            2026Q4
    Approved by:    samba (kiwi)
---
 net/samba425/Makefile                                        |  2 +-
 .../files/patch-source3_modules_vfs__streams__xattr.c        | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/net/samba425/Makefile b/net/samba425/Makefile
index b2bbe825d471..ab78e4f6d82e 100644
--- a/net/samba425/Makefile
+++ b/net/samba425/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	samba425
 DISTVERSION=	4.25.0
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES?=	net
 MASTER_SITES=	SAMBA/samba/stable \
 		SAMBA/samba/rc
diff --git a/net/samba425/files/patch-source3_modules_vfs__streams__xattr.c b/net/samba425/files/patch-source3_modules_vfs__streams__xattr.c
index 0d630ca22c8c..362185bda71e 100644
--- a/net/samba425/files/patch-source3_modules_vfs__streams__xattr.c
+++ b/net/samba425/files/patch-source3_modules_vfs__streams__xattr.c
@@ -1,4 +1,4 @@
---- source3/modules/vfs_streams_xattr.c.orig	2026-07-23 20:25:05 UTC
+--- source3/modules/vfs_streams_xattr.c.orig	2026-08-10 19:16:53 UTC
 +++ source3/modules/vfs_streams_xattr.c
 @@ -22,6 +22,13 @@
   */
@@ -14,3 +14,13 @@
  #include "smbd/smbd.h"
  #include "system/filesys.h"
  #include "lib/util/tevent_unix.h"
+@@ -424,7 +431,8 @@ static int streams_xattr_get_ea_value_fsp(
+ 		return EACCES;
+ 	}
+ 
+-	if (attr_size > (SIZE_MAX / config->max_extents)) {
++	if (config->max_extents > 0 &&
++	    attr_size > (SIZE_MAX / config->max_extents)) {
+ 		return EOVERFLOW;
+ 	}
+ 	max_stream_size = attr_size * config->max_extents;