From: "Darrick J. Wong" <djwong@kernel.org>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: [PATCH 06/12] fuse2fs: fix memory corruption when parsing mount options
Date: Mon, 15 Sep 2025 15:39:17 -0700 [thread overview]
Message-ID: <175797569727.245695.9292992844444922508.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <175797569564.245695.4628729304068635201.stgit@frogsfrogsfrogs>
From: Darrick J. Wong <djwong@kernel.org>
struct fuse_opt has this interesting behavior -- if you set the offset
field to a non-negative value, then it will treat that value as a byte
offset into the data parameter that is passed to fuse_opt_parse.
Unfortnately, process_opt computes a pointer from ((char *)data +
offset), casts that to an int pointer(!), and dereferences the int
pointer to set the value. Therefore, we cannot have uint8_t fields in
struct fuse2fs because that will lead to subtle memory corruption.
Cc: <linux-ext4@vger.kernel.org> # v1.47.3
Fixes: c7f2688540d95e ("fuse2fs: compact all the boolean flags in struct fuse2fs")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
misc/fuse2fs.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 08470a99dc7b4d..4ebc949b53d1fe 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -217,17 +217,19 @@ struct fuse2fs {
pthread_mutex_t bfl;
char *device;
char *shortdev;
- uint8_t ro;
- uint8_t debug;
- uint8_t no_default_opts;
- uint8_t panic_on_error;
- uint8_t minixdf;
- uint8_t fakeroot;
- uint8_t alloc_all_blocks;
- uint8_t norecovery;
- uint8_t kernel;
- uint8_t directio;
- uint8_t acl;
+
+ /* options set by fuse_opt_parse must be of type int */
+ int ro;
+ int debug;
+ int no_default_opts;
+ int panic_on_error;
+ int minixdf;
+ int fakeroot;
+ int alloc_all_blocks;
+ int norecovery;
+ int kernel;
+ int directio;
+ int acl;
int logfd;
int blocklog;
next prev parent reply other threads:[~2025-09-15 22:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 22:37 [PATCHSET 1/2] fuse2fs: round 5 bug fixes Darrick J. Wong
2025-09-15 22:37 ` [PATCH 01/12] libext2fs: use F_GETFL, not F_GETFD, in unixfd_open Darrick J. Wong
2025-09-15 22:38 ` [PATCH 02/12] libext2fs: don't look for O_EXCL in the F_GETFL output Darrick J. Wong
2025-09-15 22:38 ` [PATCH 03/12] fuse2fs: update manpage Darrick J. Wong
2025-09-15 22:38 ` [PATCH 04/12] fuse2fs: quiet down EXT2_ET_RO_FILSYS errors Darrick J. Wong
2025-09-15 22:39 ` [PATCH 05/12] fuse2fs: free global_fs after a failed ext2fs_close call Darrick J. Wong
2025-10-06 21:23 ` Darrick J. Wong
2025-09-15 22:39 ` Darrick J. Wong [this message]
2025-10-10 15:30 ` [PATCH 06/12] fuse2fs: fix memory corruption when parsing mount options Dave Dykstra
2025-09-15 22:39 ` [PATCH 07/12] fuse2fs: fix fssetxattr flags updates Darrick J. Wong
2025-09-15 22:39 ` [PATCH 08/12] fuse2fs: fix default acls propagating to non-dir children Darrick J. Wong
2025-09-15 22:40 ` [PATCH 09/12] fuse2fs: don't update atime when reading executable file content Darrick J. Wong
2025-09-15 22:40 ` [PATCH 10/12] fuse2fs: fix in_file_group missing the primary process gid Darrick J. Wong
2025-09-15 22:40 ` [PATCH 11/12] fuse2fs: work around EBUSY discard returns from dm-thinp Darrick J. Wong
2025-09-15 22:40 ` [PATCH 12/12] fuse2fs: check free space when creating a symlink Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=175797569727.245695.9292992844444922508.stgit@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox