Blob Blame History Raw
From: Luis Henriques <lhenriques@suse.de>
Subject: [PATCH] fuse: handle kABI change in struct fuse_args
Patch-mainline: Never, kABI fix
References: bsc#1197343 CVE-2022-1011

Commit 0c4bcfdecb1a ("fuse: fix pipe buffer lifetime for direct_io")
requires a kABI fix as it adds a field to struct fuse_args.  Fortunately,
that struct has a hole immediately after the bit fields, so using the
__GENKSYMS__ magic seems appropriate.  Here's the pahole output:

$ pahole -C fuse_args fuse.ko
struct fuse_args {
        uint64_t                   nodeid;               /*     0     8 */
        uint32_t                   opcode;               /*     8     4 */
        short unsigned int         in_numargs;           /*    12     2 */
        short unsigned int         out_numargs;          /*    14     2 */
        bool                       force:1;              /*    16: 0  1 */
        bool                       noreply:1;            /*    16: 1  1 */
        bool                       nocreds:1;            /*    16: 2  1 */
        bool                       in_pages:1;           /*    16: 3  1 */
        bool                       out_pages:1;          /*    16: 4  1 */
        bool                       out_argvar:1;         /*    16: 5  1 */
        bool                       page_zeroing:1;       /*    16: 6  1 */
        bool                       page_replace:1;       /*    16: 7  1 */
        bool                       may_block:1;          /*    17: 0  1 */

        /* XXX 7 bits hole, try to pack */
        /* XXX 6 bytes hole, try to pack */

        struct fuse_in_arg         in_args[3];           /*    24    48 */
        /* --- cacheline 1 boundary (64 bytes) was 8 bytes ago --- */
        struct fuse_arg            out_args[2];          /*    72    32 */
        void                       (*end)(struct fuse_mount *, struct fuse_args *, int); /*   104     8 */

        /* size: 112, cachelines: 2, members: 16 */
        /* sum members: 104, holes: 1, sum holes: 6 */
        /* sum bitfield members: 9 bits, bit holes: 1, sum bit holes: 7 bits */
        /* last cacheline: 48 bytes */
};

Signed-off-by: Luís Henriques <lhenriques@suse.de>
---
 fs/fuse/fuse_i.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index eac4984cc753..f22a0b8b57a1 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -256,11 +256,13 @@ struct fuse_args {
 	bool nocreds:1;
 	bool in_pages:1;
 	bool out_pages:1;
-	bool user_pages:1;
 	bool out_argvar:1;
 	bool page_zeroing:1;
 	bool page_replace:1;
 	bool may_block:1;
+#ifndef __GENKSYMS__
+	bool user_pages:1;
+#endif
 	struct fuse_in_arg in_args[3];
 	struct fuse_arg out_args[2];
 	void (*end)(struct fuse_mount *fm, struct fuse_args *args, int error);