From 57fc9d108454c53d9afd1aad6bee894e953e46f9 Mon Sep 17 00:00:00 2001 From: Rmys Date: Sun, 15 Jan 2023 13:34:22 +0300 Subject: [PATCH] fuse rebuild --- ...-namespace-conflict-in-fuse_kernel.h.patch | 28 ++++++++++ ...-size-match-kernel-max-transfer-size.patch | 42 ++++++++++++++ ...elist-SMB2-found-on-some-NAS-devices.patch | 20 +++++++ ...list-UFSD-backport-to-2.9-branch-452.patch | 31 +++++++++++ ...e2-0006-Correct-errno-comparison-571.patch | 18 ++++++ ...rver.c-conditionally-define-closefro.patch | 55 +++++++++++++++++++ system/base/fuse/pspec.xml | 14 ++++- 7 files changed, 207 insertions(+), 1 deletion(-) create mode 100644 system/base/fuse/files/fedora/fuse2-0002-add-fix-for-namespace-conflict-in-fuse_kernel.h.patch create mode 100644 system/base/fuse/files/fedora/fuse2-0003-make-buffer-size-match-kernel-max-transfer-size.patch create mode 100644 system/base/fuse/files/fedora/fuse2-0004-Whitelist-SMB2-found-on-some-NAS-devices.patch create mode 100644 system/base/fuse/files/fedora/fuse2-0005-Whitelist-UFSD-backport-to-2.9-branch-452.patch create mode 100644 system/base/fuse/files/fedora/fuse2-0006-Correct-errno-comparison-571.patch create mode 100644 system/base/fuse/files/fedora/fuse2-0007-util-ulockmgr_server.c-conditionally-define-closefro.patch diff --git a/system/base/fuse/files/fedora/fuse2-0002-add-fix-for-namespace-conflict-in-fuse_kernel.h.patch b/system/base/fuse/files/fedora/fuse2-0002-add-fix-for-namespace-conflict-in-fuse_kernel.h.patch new file mode 100644 index 00000000..a21ef83a --- /dev/null +++ b/system/base/fuse/files/fedora/fuse2-0002-add-fix-for-namespace-conflict-in-fuse_kernel.h.patch @@ -0,0 +1,28 @@ +From: Tom Callaway +Date: Wed, 26 Jun 2013 09:34:52 -0400 +Subject: [PATCH] add fix for namespace conflict in fuse_kernel.h + +https://bugzilla.redhat.com/show_bug.cgi?id=970768 + +diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h +index c632b58..9e02fe3 100644 +--- a/include/fuse_kernel.h ++++ b/include/fuse_kernel.h +@@ -88,12 +88,16 @@ + #ifndef _LINUX_FUSE_H + #define _LINUX_FUSE_H + +-#include ++#ifdef __linux__ ++#include ++#else ++#include + #define __u64 uint64_t + #define __s64 int64_t + #define __u32 uint32_t + #define __s32 int32_t + #define __u16 uint16_t ++#endif + + /* + * Version negotiation: diff --git a/system/base/fuse/files/fedora/fuse2-0003-make-buffer-size-match-kernel-max-transfer-size.patch b/system/base/fuse/files/fedora/fuse2-0003-make-buffer-size-match-kernel-max-transfer-size.patch new file mode 100644 index 00000000..40704080 --- /dev/null +++ b/system/base/fuse/files/fedora/fuse2-0003-make-buffer-size-match-kernel-max-transfer-size.patch @@ -0,0 +1,42 @@ +From: Carlos Maiolino +Date: Thu, 20 Apr 2017 14:53:01 +0200 +Subject: [PATCH] make buffer size match kernel max transfer size + +Currently libfuse has a hardcoded buffer limit to 128kib, while fuse +kernel module has a limit up to 32 pages. + +This patch changes buffer limit to match the current page size, instead +of assuming 4096 bytes pages, enabling architectures with bigger pages +to use larger buffers, improving performance. + +Also, add a new macro (HEADER_SIZE) to specify the space needed to +accommodate the header, making it easier to understand why those extra +4096 bytes are needed + +Signed-off-by: Carlos Maiolino + +diff --git a/lib/fuse_kern_chan.c b/lib/fuse_kern_chan.c +index 4a9beb8..640b91a 100644 +--- a/lib/fuse_kern_chan.c ++++ b/lib/fuse_kern_chan.c +@@ -83,7 +83,10 @@ static void fuse_kern_chan_destroy(struct fuse_chan *ch) + close(fd); + } + +-#define MIN_BUFSIZE 0x21000 ++#define KERNEL_BUF_PAGES 32 ++ ++/* room needed in buffer to accommodate header */ ++#define HEADER_SIZE 0x1000 + + struct fuse_chan *fuse_kern_chan_new(int fd) + { +@@ -92,7 +95,6 @@ struct fuse_chan *fuse_kern_chan_new(int fd) + .send = fuse_kern_chan_send, + .destroy = fuse_kern_chan_destroy, + }; +- size_t bufsize = getpagesize() + 0x1000; +- bufsize = bufsize < MIN_BUFSIZE ? MIN_BUFSIZE : bufsize; ++ size_t bufsize = KERNEL_BUF_PAGES * getpagesize() + HEADER_SIZE; + return fuse_chan_new(&op, fd, bufsize, NULL); + } diff --git a/system/base/fuse/files/fedora/fuse2-0004-Whitelist-SMB2-found-on-some-NAS-devices.patch b/system/base/fuse/files/fedora/fuse2-0004-Whitelist-SMB2-found-on-some-NAS-devices.patch new file mode 100644 index 00000000..b8aaebea --- /dev/null +++ b/system/base/fuse/files/fedora/fuse2-0004-Whitelist-SMB2-found-on-some-NAS-devices.patch @@ -0,0 +1,20 @@ +From: Peter Lemenkov +Date: Wed, 3 Apr 2019 12:23:56 +0300 +Subject: [PATCH] Whitelist SMB2 found on some NAS devices + +* https://bugzilla.redhat.com/1694552#c7 + +Signed-off-by: Peter Lemenkov + +diff --git a/util/fusermount.c b/util/fusermount.c +index 4b799d9..ef9d1ed 100644 +--- a/util/fusermount.c ++++ b/util/fusermount.c +@@ -1046,6 +1046,7 @@ static int check_perm(const char **mntp, struct stat *stbuf, int *mountpoint_fd) + 0x5346544E /* NTFS_SB_MAGIC */, + 0x794C7630 /* OVERLAYFS_SUPER_MAGIC */, + 0x52654973 /* REISERFS_SUPER_MAGIC */, ++ 0xFE534D42 /* SMB2_SUPER_MAGIC */, + 0x73717368 /* SQUASHFS_MAGIC */, + 0x01021994 /* TMPFS_MAGIC */, + 0x24051905 /* UBIFS_SUPER_MAGIC */, diff --git a/system/base/fuse/files/fedora/fuse2-0005-Whitelist-UFSD-backport-to-2.9-branch-452.patch b/system/base/fuse/files/fedora/fuse2-0005-Whitelist-UFSD-backport-to-2.9-branch-452.patch new file mode 100644 index 00000000..6e440b11 --- /dev/null +++ b/system/base/fuse/files/fedora/fuse2-0005-Whitelist-UFSD-backport-to-2.9-branch-452.patch @@ -0,0 +1,31 @@ +From: tenzap <46226844+tenzap@users.noreply.github.com> +Date: Sun, 15 Sep 2019 17:57:08 +0200 +Subject: [PATCH] Whitelist UFSD (backport to 2.9 branch) (#452) + + +diff --git a/ChangeLog b/ChangeLog +index 13a369f..5574f20 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,9 @@ ++Unreleased Changes ++================== ++ ++* Added UFSD to whitelist (so users can now mount FUSE filesystems ++ on mountpoints within UFSD filesystems). ++ + FUSE 2.9.9 (2019-01-04) + ======================= + +diff --git a/util/fusermount.c b/util/fusermount.c +index ef9d1ed..63a69dc 100644 +--- a/util/fusermount.c ++++ b/util/fusermount.c +@@ -1050,6 +1050,7 @@ static int check_perm(const char **mntp, struct stat *stbuf, int *mountpoint_fd) + 0x73717368 /* SQUASHFS_MAGIC */, + 0x01021994 /* TMPFS_MAGIC */, + 0x24051905 /* UBIFS_SUPER_MAGIC */, ++ 0x736675005346544e /* UFSD */, + 0x58465342 /* XFS_SB_MAGIC */, + 0x2FC12FC1 /* ZFS_SUPER_MAGIC */, + }; diff --git a/system/base/fuse/files/fedora/fuse2-0006-Correct-errno-comparison-571.patch b/system/base/fuse/files/fedora/fuse2-0006-Correct-errno-comparison-571.patch new file mode 100644 index 00000000..1357422a --- /dev/null +++ b/system/base/fuse/files/fedora/fuse2-0006-Correct-errno-comparison-571.patch @@ -0,0 +1,18 @@ +From: Andrew Gaul +Date: Mon, 14 Dec 2020 19:16:05 +0900 +Subject: [PATCH] Correct errno comparison (#571) + + +diff --git a/lib/fuse.c b/lib/fuse.c +index ca1709c..896aa24 100644 +--- a/lib/fuse.c ++++ b/lib/fuse.c +@@ -4348,7 +4348,7 @@ static int fuse_session_loop_remember(struct fuse *f) + + res = poll(&fds, 1, timeout * 1000); + if (res == -1) { +- if (errno == -EINTR) ++ if (errno == EINTR) + continue; + else + break; diff --git a/system/base/fuse/files/fedora/fuse2-0007-util-ulockmgr_server.c-conditionally-define-closefro.patch b/system/base/fuse/files/fedora/fuse2-0007-util-ulockmgr_server.c-conditionally-define-closefro.patch new file mode 100644 index 00000000..4cc2f8f6 --- /dev/null +++ b/system/base/fuse/files/fedora/fuse2-0007-util-ulockmgr_server.c-conditionally-define-closefro.patch @@ -0,0 +1,55 @@ +From: Sam James +Date: Sat, 24 Jul 2021 22:02:45 +0100 +Subject: [PATCH] util/ulockmgr_server.c: conditionally define closefrom (fix + glibc-2.34+) + +closefrom(3) has joined us in glibc-land from *BSD and Solaris. Since +it's available in glibc 2.34+, we want to detect it and only define our +fallback if the libc doesn't provide it. + +Bug: https://bugs.gentoo.org/803923 +Signed-off-by: Sam James + +diff --git a/configure.ac b/configure.ac +index 9946a0e..a2d481a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -55,6 +55,7 @@ fi + + AC_CHECK_FUNCS([fork setxattr fdatasync splice vmsplice utimensat]) + AC_CHECK_FUNCS([posix_fallocate]) ++AC_CHECK_FUNCS([closefrom]) + AC_CHECK_MEMBERS([struct stat.st_atim]) + AC_CHECK_MEMBERS([struct stat.st_atimespec]) + +diff --git a/util/ulockmgr_server.c b/util/ulockmgr_server.c +index 273c7d9..a04dac5 100644 +--- a/util/ulockmgr_server.c ++++ b/util/ulockmgr_server.c +@@ -22,6 +22,10 @@ + #include + #include + ++#ifdef HAVE_CONFIG_H ++ #include "config.h" ++#endif ++ + struct message { + unsigned intr : 1; + unsigned nofd : 1; +@@ -124,6 +128,7 @@ static int receive_message(int sock, void *buf, size_t buflen, int *fdp, + return res; + } + ++#if !defined(HAVE_CLOSEFROM) + static int closefrom(int minfd) + { + DIR *dir = opendir("/proc/self/fd"); +@@ -141,6 +146,7 @@ static int closefrom(int minfd) + } + return 0; + } ++#endif + + static void send_reply(int cfd, struct message *msg) + { diff --git a/system/base/fuse/pspec.xml b/system/base/fuse/pspec.xml index 8c8f4514..c8919de4 100644 --- a/system/base/fuse/pspec.xml +++ b/system/base/fuse/pspec.xml @@ -17,7 +17,12 @@ gettext-devel - + fedora/fuse2-0002-add-fix-for-namespace-conflict-in-fuse_kernel.h.patch + fedora/fuse2-0003-make-buffer-size-match-kernel-max-transfer-size.patch + fedora/fuse2-0004-Whitelist-SMB2-found-on-some-NAS-devices.patch + fedora/fuse2-0005-Whitelist-UFSD-backport-to-2.9-branch-452.patch + fedora/fuse2-0006-Correct-errno-comparison-571.patch + fedora/fuse2-0007-util-ulockmgr_server.c-conditionally-define-closefro.patch @@ -50,6 +55,13 @@ + + 2023-01-13 + 2.9.9 + Rebuild. + Mustafa Cinasal + muscnsl@gmail.com + 2021-07-17 2.9.9