From 1063c2fa628aca25c8f2f8e2ffdd6ef721155680 Mon Sep 17 00:00:00 2001 From: Yu-Ting Tseng Date: Tue, 9 Jul 2024 00:00:49 -0700 Subject: [PATCH] BACKPORT: FROMGIT: binder: frozen notification binder_features flag Add a flag to binder_features to indicate that the freeze notification feature is available. Signed-off-by: Yu-Ting Tseng Acked-by: Carlos Llamas Link: https://lore.kernel.org/r/20240709070047.4055369-6-yutingtseng@google.com Signed-off-by: Greg Kroah-Hartman Bug: 363013421 (cherry picked from commit 30b968b002a92870325a5c9d1ce78eba0ce386e7 git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git char-misc-next) Change-Id: Ic26c8ae42d27c6fd8f5daed5eecabd1652e29502 [cmllamas: fix trivial conflicts due to missing extended_error] Signed-off-by: Carlos Llamas --- drivers/android/binderfs.c | 8 ++++++++ .../selftests/filesystems/binderfs/binderfs_test.c | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index 98678d965010..d715305d8fcb 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c @@ -61,6 +61,7 @@ enum binderfs_stats_mode { struct binder_features { bool oneway_spam_detection; + bool freeze_notification; }; static const match_table_t tokens = { @@ -71,6 +72,7 @@ static const match_table_t tokens = { static struct binder_features binder_features = { .oneway_spam_detection = true, + .freeze_notification = true, }; static inline struct binderfs_info *BINDERFS_I(const struct inode *inode) @@ -621,6 +623,12 @@ static int init_binder_features(struct super_block *sb) if (IS_ERR(dentry)) return PTR_ERR(dentry); + dentry = binderfs_create_file(dir, "freeze_notification", + &binder_features_fops, + &binder_features.freeze_notification); + if (IS_ERR(dentry)) + return PTR_ERR(dentry); + return 0; } diff --git a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c index e6e679a03bc9..8fca95b5beb9 100644 --- a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c +++ b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c @@ -147,6 +147,7 @@ static void __do_binderfs_test(void) char device_path[sizeof("/dev/binderfs/") + BINDERFS_MAX_NAME]; static const char * const binder_features[] = { "oneway_spam_detection", + "freeze_notification", }; change_to_mountns();