The Samba-Bugzilla – Attachment 17531 Details for
Bug 15186
File creation error with extended attributes with left-over file on Lustre with disabled user_xattr
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
EA-filtering VFS module PoC
samba-4.15.5-vfs_filter_lustre_private_xattr.patch (text/plain), 5.29 KB, created by
Michael Weiser
on 2022-09-26 07:48:23 UTC
(
hide
)
Description:
EA-filtering VFS module PoC
Filename:
MIME Type:
Creator:
Michael Weiser
Created:
2022-09-26 07:48:23 UTC
Size:
5.29 KB
patch
obsolete
>diff -ur samba-4.15.5.ori/source3/modules/wscript_build samba-4.15.5/source3/modules/wscript_build >--- samba-4.15.5.ori/source3/modules/wscript_build 2021-08-09 15:38:36.435381200 +0200 >+++ samba-4.15.5/source3/modules/wscript_build 2022-09-15 10:05:38.690716949 +0200 >@@ -641,3 +641,10 @@ > init_function='', > internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_widelinks'), > enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_widelinks')) >+ >+bld.SAMBA3_MODULE('vfs_filter_lustre_private_xattr', >+ subsystem='vfs', >+ source='vfs_filter_lustre_private_xattr.c', >+ init_function='', >+ internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_filter_lustre_private_xattr'), >+ enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_filter_lustre_private_xattr')) >diff -ur samba-4.15.5.ori/source3/wscript samba-4.15.5/source3/wscript >--- samba-4.15.5.ori/source3/wscript 2021-10-27 14:53:55.900512200 +0200 >+++ samba-4.15.5/source3/wscript 2022-09-15 10:12:05.717420975 +0200 >@@ -1886,7 +1886,8 @@ > 'vfs_preopen', 'vfs_catia', > 'vfs_media_harmony', 'vfs_unityed_media', 'vfs_fruit', 'vfs_shell_snap', > 'vfs_commit', 'vfs_worm', 'vfs_crossrename', 'vfs_linux_xfs_sgid', >- 'vfs_time_audit', 'vfs_offline', 'vfs_virusfilter', 'vfs_widelinks']) >+ 'vfs_time_audit', 'vfs_offline', 'vfs_virusfilter', 'vfs_widelinks', >+ 'vfs_filter_lustre_private_xattr']) > if host_os.rfind('linux') > -1: > default_shared_modules.extend(['vfs_snapper']) > >--- /dev/null 2022-08-08 11:10:15.373334812 +0200 >+++ samba-4.15.5/source3/modules/vfs_filter_lustre_private_xattr.c 2022-09-15 12:52:27.908346500 +0200 >@@ -0,0 +1,120 @@ >+/* >+ * VFS module filtering lustre-internal xattrs such as lustre.lov. >+ * >+ * Copyright (C) Tim Potter, 1999-2000 >+ * Copyright (C) Alexander Bokovoy, 2002 >+ * Copyright (C) Stefan (metze) Metzmacher, 2003 >+ * Copyright (C) Jeremy Allison 2009 >+ * >+ * This program is free software; you can redistribute it and/or modify >+ * it under the terms of the GNU General Public License as published by >+ * the Free Software Foundation; either version 3 of the License, or >+ * (at your option) any later version. >+ * >+ * This program is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+ * GNU General Public License for more details. >+ * >+ * You should have received a copy of the GNU General Public License >+ * along with this program; if not, see <http://www.gnu.org/licenses/>. >+ */ >+ >+#include "includes.h" >+ >+#undef DBGC_CLASS >+#define DBGC_CLASS DBGC_VFS >+ >+#define MODULE_NAME "filter_lustre_private_xattr_fgetxattr" >+ >+static ssize_t vfs_filter_lustre_private_xattr_fgetxattr( >+ vfs_handle_struct *handle, struct files_struct *fsp, >+ const char *name, void *value, size_t size) >+{ >+ if (strcmp(name, "lustre.lov") == 0) { >+ DEBUG(5, ("vfs_filter_lustre_private_xattr_fgetxattr: " >+ "ignoring ea lustre.lov\n")); >+ errno = ENOTSUP; >+ return -1; >+ } >+ >+ return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size); >+} >+ >+static ssize_t vfs_filter_lustre_private_xattr_flistxattr( >+ vfs_handle_struct *handle, struct files_struct *fsp, >+ char *list, size_t size) >+{ >+ ssize_t rsize = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size); >+ char *p = list, *op = list; >+ >+ if (rsize < 0) { >+ return rsize; >+ } >+ >+ while (p < list + rsize) { >+ /* walk to next nul terminator */ >+ while (*p != '\0' && p < list + rsize) { >+ p++; >+ } >+ >+ /* not nul-terminated? buffer overflow? - we didn't do it */ >+ if (p >= list + rsize) { >+ break; >+ } >+ >+ /* move past nul */ >+ p++; >+ >+ DEBUG(10, ("vfs_filter_lustre_private_xattr_flistxattr: " >+ "looking at ea %s\n", op)); >+ >+ /* can there be multiple occurences? */ >+ while (strcmp(op, "lustre.lov") == 0) { >+ DEBUG(5, ("vfs_filter_lustre_private_xattr_flistxattr: " >+ "found ea %s to ignore\n", op)); >+ >+ /* 012 345 678 >+ * aa\0bb\0cc\0 >+ * ^op ^p */ >+ ssize_t ignorelen = p - op; >+ if (p < list + rsize) { >+ /* move the rest forward and nul out the >+ * overhang */ >+ ssize_t rest = rsize - (p - list); >+ memmove(op, p, rest); >+ memset(op + rest, '\0', ignorelen); >+ >+ DEBUG(10, ("vfs_filter_lustre_private_xattr_flistxattr: " >+ "moved buffer forward %p:%ld:%p:%p:%ld:%ld\n", >+ list, rsize, op, p, ignorelen, rest)); >+ } else { >+ /* just null the end */ >+ memset(op, '\0', ignorelen); >+ >+ DEBUG(10, ("vfs_filter_lustre_private_xattr_flistxattr: " >+ "nulled buffer end %p:%ld:%p:%p:%ld\n", >+ list, rsize, op, p, ignorelen)); >+ } >+ >+ rsize -= ignorelen; >+ } >+ >+ op = p; >+ } >+ >+ return rsize; >+} >+ >+static struct vfs_fn_pointers vfs_filter_lustre_private_xattr_fns = { >+ .fgetxattr_fn = vfs_filter_lustre_private_xattr_fgetxattr, >+ .flistxattr_fn = vfs_filter_lustre_private_xattr_flistxattr, >+}; >+ >+static_decl_vfs; >+NTSTATUS vfs_filter_lustre_private_xattr_init(TALLOC_CTX *ctx) >+{ >+ return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, >+ "filter_lustre_private_xattr", >+ &vfs_filter_lustre_private_xattr_fns); >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 15186
: 17531 |
17532
|
17533
|
17606