bpf: add a pad for fuse bpf struction [1/1]

PD#SWPL-132090

Problem:
fuse bpf has a bug when using 32bit kernel

Solution:
Google provide this patch to fix it

Verify:
s4

Change-Id: Id3bc70edb8012f061383afa74d5bc7e1623a986c
Signed-off-by: Jiucheng Xu <jiucheng.xu@amlogic.com>
This commit is contained in:
Jiucheng Xu
2023-09-20 19:28:36 +08:00
committed by Luan Yuan
parent 0ca1950f02
commit dbc243422b
@@ -0,0 +1,65 @@
From d1ce15f9fcba52d106bcbab9fd65e1900d602d04 Mon Sep 17 00:00:00 2001
From: Paul Lawrence <paullawrence@google.com>
Date: Fri, 7 Jul 2023 12:33:52 -0700
Subject: [PATCH] ANDROID: fuse-bpf: Align data structs for 32-bit kernels
BPF is always 64-bit code, so we need to pad the uapi structs to be the
same on 32-bit as 64-bit
Bug: 285477572
Test: Cuttlefish x86_64, x86 and x86 only all boot and load fuseMedia
Change-Id: Idf5b09b2581b8d097048e7d2ff4039cd1806c082
Signed-off-by: Paul Lawrence <paullawrence@google.com>
---
include/uapi/linux/android_fuse.h | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/include/uapi/linux/android_fuse.h b/include/uapi/linux/android_fuse.h
index 221e30ea7f01..58f3d171952d 100644
--- a/include/uapi/linux/android_fuse.h
+++ b/include/uapi/linux/android_fuse.h
@@ -56,15 +56,29 @@ struct fuse_in_postfilter_header {
/** One input argument of a request */
struct fuse_bpf_in_arg {
uint32_t size;
- const void *value;
- const void *end_offset;
+ uint32_t padding;
+ union {
+ const void *value;
+ uint64_t padding2;
+ };
+ union {
+ const void *end_offset;
+ uint64_t padding3;
+ };
};
/** One output argument of a request */
struct fuse_bpf_arg {
uint32_t size;
- void *value;
- void *end_offset;
+ uint32_t padding;
+ union {
+ void *value;
+ uint64_t padding2;
+ };
+ union {
+ void *end_offset;
+ uint64_t padding3;
+ };
};
#define FUSE_MAX_IN_ARGS 5
@@ -80,6 +94,7 @@ struct fuse_bpf_args {
uint32_t in_numargs;
uint32_t out_numargs;
uint32_t flags;
+ uint32_t padding;
struct fuse_bpf_in_arg in_args[FUSE_MAX_IN_ARGS];
struct fuse_bpf_arg out_args[FUSE_MAX_OUT_ARGS];
};
--
2.25.1