aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Lawrence <paullawrence@google.com>2022-04-01 07:05:04 -0700
committerDaniel Rosenberg <drosen@google.com>2022-04-21 18:11:34 -0700
commita57ca0355f00b44c8edfeccd6a094554a0731b69 (patch)
tree6282a8f48d36ea02b62fe241decfe38514c2fd2a
parentacf23ee814e3d341ad2826f87ab357965b04b28a (diff)
downloadlibfuse-a57ca0355f00b44c8edfeccd6a094554a0731b69.tar.gz
ANDROID: fuse-bpf: Use fuse_bpf_args in uapi
fuse_args is not suitable for use in the uapi - it is not stable, and contains internal pointers. Replace with stable equivalent. Test: atest ScopedStorageDeviceTest passes Bug: 202785178 Change-Id: I27d5ae0d7e0aaf30c51f3b97124737841605ae69
-rw-r--r--include/fuse_kernel.h50
1 files changed, 28 insertions, 22 deletions
diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h
index 70278fa..b1f1e1d 100644
--- a/include/fuse_kernel.h
+++ b/include/fuse_kernel.h
@@ -874,38 +874,44 @@ struct fuse_copy_file_range_in {
#ifdef __KERNEL__
struct fuse_mount;
+/*
+ * Fuse BPF Args
+ *
+ * Used to communicate with bpf programs to allow checking or altering certain values.
+ * The end_offset allows the bpf verifier to check boundaries statically. This reflects
+ * the ends of the buffer. size shows the length that was actually used.
+ *
+ */
+
/** One input argument of a request */
-struct fuse_in_arg {
- unsigned size;
+struct fuse_bpf_in_arg {
+ uint32_t size;
const void *value;
+ const void *end_offset;
};
/** One output argument of a request */
-struct fuse_arg {
- unsigned size;
+struct fuse_bpf_arg {
+ uint32_t size;
void *value;
+ void *end_offset;
};
-struct fuse_args {
+#define FUSE_MAX_IN_ARGS 5
+#define FUSE_MAX_OUT_ARGS 3
+
+#define FUSE_BPF_FORCE (1 << 0)
+#define FUSE_BPF_OUT_ARGVAR (1 << 6)
+
+struct fuse_bpf_args {
uint64_t nodeid;
uint32_t opcode;
- unsigned short in_numargs;
- unsigned short out_numargs;
- int force:1;
- int noreply:1;
- int nocreds:1;
- int in_pages:1;
- int out_pages:1;
- int out_argvar:1;
- int page_zeroing:1;
- int page_replace:1;
- int may_block:1;
- struct fuse_in_arg in_args[5];
- struct fuse_arg out_args[3];
- void (*end)(struct fuse_mount *fm, struct fuse_args *args, int error);
-
- /* Path used for completing d_canonical_path */
- struct path *canonical_path;
+ uint32_t error_in;
+ uint32_t in_numargs;
+ uint32_t out_numargs;
+ uint32_t flags;
+ struct fuse_bpf_in_arg in_args[FUSE_MAX_IN_ARGS];
+ struct fuse_bpf_arg out_args[FUSE_MAX_OUT_ARGS];
};
#endif