BACKPORT: 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.

The end_offset values are currently unused and unset, but will be used
in a follow up patch by the verifier.

Test: fuse_test, atest ScopedStorageDeviceTest pass
Bug: 202785178
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: Ic1c12f9706aeae233cc30a0d68ed2533030e485b
This commit is contained in:
Daniel Rosenberg 2022-03-30 15:19:00 -07:00 • committed by Alexander Martinz
commit 29efcdd0db
No known key found for this signature in database
GPG key ID: CF15BDD9A321A9B2
5 changed files with 395 additions and 305 deletions

View file

@ -965,42 +965,44 @@ struct fuse_removemapping_one {
#define FUSE_REMOVEMAPPING_MAX_ENTRY \
(PAGE_SIZE / sizeof(struct fuse_removemapping_one))
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;
uint32_t error_in;
unsigned short in_numargs;
unsigned short out_numargs;
bool force:1;
bool noreply:1;
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;
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 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];
};
#define FUSE_BPF_USER_FILTER 1