lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250618121429.188696-1-alexjlzheng@tencent.com>
Date: Wed, 18 Jun 2025 20:14:29 +0800
From: alexjlzheng@...il.com
To: viro@...iv.linux.org.uk,
	brauner@...nel.org,
	jack@...e.cz
Cc: linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Jinliang Zheng <alexjlzheng@...cent.com>
Subject: [PATCH] fs: fix the missing export of vfs_statx() and vfs_fstatat()

From: Jinliang Zheng <alexjlzheng@...cent.com>

After commit 09f1bde4017e ("fs: move vfs_fstatat out of line"), the two
symbols vfs_statx() and vfs_fstatat() are no longer visible to the kernel
module.

The above patches does not explain why the export of these two symbols is
stopped, and exporting these two kernel symbols does not affect the
functionality of the above patch.

In fact, getting the length of a file in a kernel module is a useful
operation. For example, some kernel modules used for security hardening may
need to know the length of a file in order to read it into memory for
verification.

There is no reason to prohibit kernel module developers from doing this.
So this patch fixes that by reexporting vfs_statx() and vfs_fstatat().

Fixes: 09f1bde4017e ("fs: move vfs_fstatat out of line")
Signed-off-by: Jinliang Zheng <alexjlzheng@...cent.com>
---
 fs/stat.c          | 4 +++-
 include/linux/fs.h | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/stat.c b/fs/stat.c
index f95c1dc3eaa4..e844a1a076d7 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -338,7 +338,7 @@ static int vfs_statx_fd(int fd, int flags, struct kstat *stat,
  *
  * 0 will be returned on success, and a -ve error code if unsuccessful.
  */
-static int vfs_statx(int dfd, struct filename *filename, int flags,
+int vfs_statx(int dfd, struct filename *filename, int flags,
 	      struct kstat *stat, u32 request_mask)
 {
 	struct path path;
@@ -361,6 +361,7 @@ static int vfs_statx(int dfd, struct filename *filename, int flags,
 	}
 	return error;
 }
+EXPORT_SYMBOL(vfs_statx);
 
 int vfs_fstatat(int dfd, const char __user *filename,
 			      struct kstat *stat, int flags)
@@ -377,6 +378,7 @@ int vfs_fstatat(int dfd, const char __user *filename,
 
 	return ret;
 }
+EXPORT_SYMBOL(vfs_fstatat);
 
 #ifdef __ARCH_WANT_OLD_STAT
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b085f161ed22..c9497da6b459 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3550,6 +3550,8 @@ extern const struct inode_operations simple_symlink_inode_operations;
 
 extern int iterate_dir(struct file *, struct dir_context *);
 
+int vfs_statx(int dfd, struct filename *filename, int flags,
+		struct kstat *stat, u32 request_mask);
 int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,
 		int flags);
 int vfs_fstat(int fd, struct kstat *stat);
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ