From 62ae9b04301aff8f515e7b7a021aa13cf26ff563 Mon Sep 17 00:00:00 2001 From: Daniel Rosenberg Date: Mon, 10 Feb 2025 16:01:25 -0800 Subject: [PATCH] ANDROID: fuse: Add flag for Android passthrough support Android does not work with unmodified Android passthrough. This feature flag marks that those modifications are in place, and that passthrough will function as Android expects. Bug: 376007121 Test: cat /sys/fs/fuse/fuse_passthrough Change-Id: I2cd2a6f646e2b6172b5ecc5cc699318395082f63 Signed-off-by: Daniel Rosenberg --- Documentation/ABI/testing/sysfs-fs-fuse | 8 ++++++++ fs/fuse/inode.c | 22 ++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-fs-fuse b/Documentation/ABI/testing/sysfs-fs-fuse index b9956842b36f..9d14e572c2e7 100644 --- a/Documentation/ABI/testing/sysfs-fs-fuse +++ b/Documentation/ABI/testing/sysfs-fs-fuse @@ -5,6 +5,14 @@ Description: Read-only file that contains the word 'supported' if fuse-bpf is supported, does not exist otherwise +What: /sys/fs/fuse/features/fuse_passthrough +Date: February 2025 +Contact: Daniel Rosenberg +Description: + Read-only file that contains the word 'supported' if fuse + passthrough with Android modifications is supported, does not + exist otherwise + What: /sys/fs/fuse/bpf_prog_type_fuse Date: December 2022 Contact: Paul Lawrence diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 1d003e300c52..a765b0910d6b 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -2242,6 +2242,17 @@ static void fuse_fs_cleanup(void) static struct kobject *fuse_kobj; +#ifdef CONFIG_FUSE_PASSTHROUGH +static ssize_t fuse_passthrough_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buff) +{ + return sysfs_emit(buff, "supported\n"); +} + +static struct kobj_attribute fuse_passthrough_attr = + __ATTR_RO(fuse_passthrough); +#endif + static ssize_t fuse_bpf_show(struct kobject *kobj, struct kobj_attribute *attr, char *buff) { @@ -2251,14 +2262,17 @@ static ssize_t fuse_bpf_show(struct kobject *kobj, static struct kobj_attribute fuse_bpf_attr = __ATTR_RO(fuse_bpf); -static struct attribute *bpf_features[] = { +static struct attribute *fuse_features[] = { &fuse_bpf_attr.attr, +#ifdef CONFIG_FUSE_PASSTHROUGH + &fuse_passthrough_attr.attr, +#endif NULL, }; -static const struct attribute_group bpf_features_group = { +static const struct attribute_group fuse_features_group = { .name = "features", - .attrs = bpf_features, + .attrs = fuse_features, }; /* @@ -2286,7 +2300,7 @@ static const struct attribute_group bpf_attr_group = { }; static const struct attribute_group *attribute_groups[] = { - &bpf_features_group, + &fuse_features_group, &bpf_attr_group, NULL };