manager: add app_profile set/get

This commit is contained in:
tiann
2023-05-16 20:33:09 +08:00
parent ed0cfd231e
commit 08d9e5d6bc
2 changed files with 48 additions and 0 deletions

View File

@@ -33,4 +33,33 @@ bool add_to_deny_list(int uid);
bool remove_from_deny_list(int uid);
// NGROUPS_MAX for Linux is 65535 generally, but we only supports 32 groups.
#define KSU_MAX_GROUPS 32
#define KSU_SELINUX_DOMAIN 64
#define DEFAULT_ROOT_PROFILE_KEY 0
#define DEFAULT_NON_ROOT_PROFILE_KEY 9999 // This UID means NOBODY in Android
struct app_profile {
int32_t key; // this is usually the uid of the app, but can be other value for special apps
int32_t uid;
int32_t gid;
int32_t groups[KSU_MAX_GROUPS];
int32_t groups_count;
// kernel_cap_t is u32[2]
uint64_t capabilities;
char selinux_domain[KSU_SELINUX_DOMAIN];
bool allow_su;
bool mount_module;
};
bool set_app_profile(const app_profile *profile);
bool get_app_profile(int32_t key, app_profile *profile);
#endif //KERNELSU_KSU_H