summaryrefslogtreecommitdiff
path: root/net/samba420/files/0101-FreeBSD-add-fdescfs-paths-workaround.patch
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2025-06-30 14:43:18 +0200
committerDimitry Andric <dim@FreeBSD.org>2025-08-21 21:01:17 +0200
commita60d74e32eeedfcec40f37ba6a4e409fe53dbeeb (patch)
treed80f7343fe784eabbd28a6f09cdbd3c95e7e1197 /net/samba420/files/0101-FreeBSD-add-fdescfs-paths-workaround.patch
parenttextproc/R-cran-spelling: Update to 2.3.2 (diff)
net/samba420: fix fdescfs handling which causes several issues
Issue from bug 284623: several PANIC errors in log.smbd, similar to: [2025/02/02 16:56:09.823293, 0] ../../lib/util/fault.c:193(smb_panic_log) PANIC (pid 8625): async open timeout in 4.20.7 [2025/02/02 16:56:09.827129, 0] ../../lib/util/fault.c:304(log_stack_trace) BACKTRACE: 20 stack frames: #0 0x3645750f6ec7 <log_stack_trace+0x37> at /usr/local/lib/samba4/private/libgenrand-private-samba.so #1 0x3645750f6f9e <smb_panic+0xe> at /usr/local/lib/samba4/private/libgenrand-private-samba.so #2 0x36456b707b24 <smbd_exit_server+0x1b4> at /usr/local/lib/samba4/private/libsmbd-base-private-samba.so #3 0x36456b707981 <smbd_exit_server+0x11> at /usr/local/lib/samba4/private/libsmbd-base-private-samba.so #4 0x364575394bcc <exit_server+0x1c> at /usr/local/lib/samba4/private/libsmbd-shim-private-samba.so #5 0x36456b6b2b10 <delete_all_streams> at /usr/local/lib/samba4/private/libsmbd-base-private-samba.so #6 0x364575935dff <tevent_common_invoke_timer_handler+0x18f> at /usr/local/lib/libtevent.so.0 #7 0x364575935fa4 <tevent_common_loop_timer_delay+0x94> at /usr/local/lib/libtevent.so.0 #8 0x3645759337c5 <tevent_context_same_loop+0xb15> at /usr/local/lib/libtevent.so.0 #9 0x36457592f36a <_tevent_loop_once+0xea> at /usr/local/lib/libtevent.so.0 #10 0x36457592f5f2 <tevent_common_loop_wait+0x32> at /usr/local/lib/libtevent.so.0 #11 0x36456b6cd34b <smbd_process+0x83b> at /usr/local/lib/samba4/private/libsmbd-base-private-samba.so #12 0x363d4788f9bd <main+0x42fd> at /usr/local/sbin/smbd #13 0x36457593067e <tevent_common_invoke_fd_handler+0x9e> at /usr/local/lib/libtevent.so.0 #14 0x364575933a44 <tevent_context_same_loop+0xd94> at /usr/local/lib/libtevent.so.0 #15 0x36457592f36a <_tevent_loop_once+0xea> at /usr/local/lib/libtevent.so.0 #16 0x36457592f5f2 <tevent_common_loop_wait+0x32> at /usr/local/lib/libtevent.so.0 #17 0x363d4788df3f <main+0x287f> at /usr/local/sbin/smbd #18 0x363d4788cbac <main+0x14ec> at /usr/local/sbin/smbd #19 0x36457742ac3a <__libc_start1+0x12a> at /lib/libc.so.7 Issue from bug 286821: accessing Samba shares from macOS clients results in error dialogs titled: "There was a problem connecting to the server", with content "The share does not exist on the server. Please check the share name and then try again". The problems are caused by fdescfs handling: * patch 0028-s3-lib-system-add-FreeBSD-proc_fd_pattern.patch was how Timur solved the fd problem for Samba 4.19 (mounting fdescfs nodup under /var/run/samba4/fd); * if only this had been accepted upstream, we would not have had this problem in 4.20... :( * in any case this code is now unused in 4.20, where Samba went even more Linux-only; * patch 0101-FreeBSD-add-fdescfs-paths-workaround.patch was a naive tentative to solve the same problem for 4.20, apparently without taking into account what had been done before; it's broken by design, brokenly implementated and it simply doesn't work. Apply a patch by Andrea Venturoli <ml@netfence.it>, which drops the 0101 patch, and modifies the older 0028 patch to revive what Timur had done. PR: 284623, 286821 Tested by: O. Hartmann <ohartmann@walstatt.org> and others Approved by: samba (0mp) MFH: 2025Q3
Diffstat (limited to 'net/samba420/files/0101-FreeBSD-add-fdescfs-paths-workaround.patch')
-rw-r--r--net/samba420/files/0101-FreeBSD-add-fdescfs-paths-workaround.patch71
1 files changed, 0 insertions, 71 deletions
diff --git a/net/samba420/files/0101-FreeBSD-add-fdescfs-paths-workaround.patch b/net/samba420/files/0101-FreeBSD-add-fdescfs-paths-workaround.patch
deleted file mode 100644
index 714ad6ae52ef..000000000000
--- a/net/samba420/files/0101-FreeBSD-add-fdescfs-paths-workaround.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-# 2024-08-05
-# NOTE: Upstream Samba commit 9f63fad392f3 removed the static array defining Linux and FreeBSD
-# fdescfs paths and hardcoded a Linux-specific /proc path, with the note that if any
-# others need to be added, they can be done so via #ifdef's. This patch attempts to
-# do that, but in a way that minimizes the necessary #ifdefs by defining a simplistic
-# #define macro to generate the appropriate path for fdescfs based on the running OS.
-#
-# See: https://git.samba.org/?p=samba.git;a=commitdiff;h=9f63fad392f3cff34d6a8e318e0427499170c417
-
-diff -Naurp a/lib/fuzzing/fuzz_regfio.c b/lib/fuzzing/fuzz_regfio.c
---- a/lib/fuzzing/fuzz_regfio.c 2024-02-02 04:33:50.952488000 -0500
-+++ b/lib/fuzzing/fuzz_regfio.c 2024-08-05 20:41:16.624793000 -0400
-@@ -31,7 +31,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
- {
- fp = tmpfile();
-
-- (void)snprintf(filename, sizeof(filename), "/proc/self/fd/%d", fileno(fp));
-+ (void)snprintf(filename, sizeof(filename), PROC_FD_PATH_MKSTR(%d), fileno(fp));
-
- return 0;
- }
-diff -Naurp a/lib/replace/closefrom.c b/lib/replace/closefrom.c
---- a/lib/replace/closefrom.c 2024-02-02 04:33:50.984488200 -0500
-+++ b/lib/replace/closefrom.c 2024-08-05 20:41:16.625141000 -0400
-@@ -53,7 +53,7 @@ static int closefrom_procfs(int lower)
- size_t i;
- int ret = ENOMEM;
-
-- dirp = opendir("/proc/self/fd");
-+ dirp = opendir(PROC_FD_PATH_MKSTR());
- if (dirp == NULL) {
- return errno;
- }
-diff -Naurp a/source3/include/proto.h b/source3/include/proto.h
---- a/source3/include/proto.h 2024-08-05 20:40:38.434560000 -0400
-+++ b/source3/include/proto.h 2024-08-05 20:41:26.063626000 -0400
-@@ -205,8 +205,21 @@ int sys_get_number_of_cores(void);
- int sys_get_number_of_cores(void);
- #endif
-
-+#ifdef __FreeBSD__
-+#define PROC_FD_PATH_STR "/compat/linux/dev/fd/"
-+#define PROC_FD_PATH_SZ 42
-+#else /* Linux */
-+#define PROC_FD_PATH_STR "/proc/self/fd/"
-+#define PROC_FD_PATH_SZ 35
-+#endif
-+
-+#define _S(_t) #_t
-+#define _V(...) _S(__VA_ARGS__)
-+#define _X(_t) _t
-+#define PROC_FD_PATH_MKSTR(_fd) _V(_X(PROC_FD_PATH_STR)_X(_fd))
-+
- struct sys_proc_fd_path_buf {
-- char buf[35]; /* "/proc/self/fd/" + strlen(2^64) + 0-terminator */
-+ char buf[PROC_FD_PATH_SZ]; /* strlen(PROC_FD_PATH_STR) + strlen(2^64) + 0-terminator */
- };
- bool sys_have_proc_fds(void);
- char *sys_proc_fd_path(int fd, struct sys_proc_fd_path_buf *buf);
-diff -Naurp a/source3/lib/system.c b/source3/lib/system.c
---- a/source3/lib/system.c 2024-08-05 20:40:38.434801000 -0400
-+++ b/source3/lib/system.c 2024-08-05 20:41:16.625938000 -0400
-@@ -1068,7 +1068,7 @@ char *sys_proc_fd_path(int fd, struct sys_proc_fd_path
- char *sys_proc_fd_path(int fd, struct sys_proc_fd_path_buf *buf)
- {
- int written =
-- snprintf(buf->buf, sizeof(buf->buf), "/proc/self/fd/%d", fd);
-+ snprintf(buf->buf, sizeof(buf->buf), PROC_FD_PATH_MKSTR(%d), fd);
-
- SMB_ASSERT(sys_have_proc_fds() && (written >= 0));
-