2018-09-27 06:09:59 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-03-15 11:17:37 +01:00
|
|
|
// selinuxfs paths
|
|
|
|
#define SELINUX_MNT "/sys/fs/selinux"
|
|
|
|
#define SELINUX_ENFORCE SELINUX_MNT "/enforce"
|
|
|
|
#define SELINUX_POLICY SELINUX_MNT "/policy"
|
|
|
|
#define SELINUX_LOAD SELINUX_MNT "/load"
|
|
|
|
#define SELINUX_CONTEXT SELINUX_MNT "/context"
|
|
|
|
#define SELINUX_VERSION SELINUX_MNT "/policyvers"
|
|
|
|
|
|
|
|
// sepolicy paths
|
|
|
|
#define PLAT_POLICY_DIR "/system/etc/selinux/"
|
|
|
|
#define VEND_POLICY_DIR "/vendor/etc/selinux/"
|
|
|
|
#define PROD_POLICY_DIR "/product/etc/selinux/"
|
|
|
|
#define ODM_POLICY_DIR "/odm/etc/selinux/"
|
2020-02-21 09:49:33 +01:00
|
|
|
#define SYSEXT_POLICY_DIR "/system_ext/etc/selinux/"
|
2019-03-15 11:17:37 +01:00
|
|
|
#define SPLIT_PLAT_CIL PLAT_POLICY_DIR "plat_sepolicy.cil"
|
|
|
|
|
2020-06-04 08:29:42 +02:00
|
|
|
// Unconstrained domain the daemon and root processes run in
|
2019-03-15 11:17:37 +01:00
|
|
|
#define SEPOL_PROC_DOMAIN "magisk"
|
2020-06-04 08:29:42 +02:00
|
|
|
// Highly constrained domain, sole purpose is to connect to daemon
|
|
|
|
#define SEPOL_CLIENT_DOMAIN "magisk_client"
|
|
|
|
// Unconstrained file type that anyone can access
|
|
|
|
#define SEPOL_FILE_TYPE "magisk_file"
|
|
|
|
// Special file type to allow clients to transit to client domain automatically
|
|
|
|
#define SEPOL_EXEC_TYPE "magisk_exec"
|
2019-03-15 11:17:37 +01:00
|
|
|
|
2019-10-20 13:13:03 +02:00
|
|
|
extern void (*freecon)(char *con);
|
2019-03-14 11:34:22 +01:00
|
|
|
extern int (*setcon)(const char *con);
|
|
|
|
extern int (*getfilecon)(const char *path, char **con);
|
|
|
|
extern int (*lgetfilecon)(const char *path, char **con);
|
|
|
|
extern int (*fgetfilecon)(int fd, char **con);
|
|
|
|
extern int (*setfilecon)(const char *path, const char *con);
|
|
|
|
extern int (*lsetfilecon)(const char *path, const char *con);
|
|
|
|
extern int (*fsetfilecon)(int fd, const char *con);
|
|
|
|
void getfilecon_at(int dirfd, const char *name, char **con);
|
|
|
|
void setfilecon_at(int dirfd, const char *name, const char *con);
|
2018-09-27 06:09:59 +02:00
|
|
|
|
2019-02-09 07:51:46 +01:00
|
|
|
void selinux_builtin_impl();
|
2019-10-20 13:13:03 +02:00
|
|
|
void dload_selinux();
|
2018-09-27 06:09:59 +02:00
|
|
|
void restorecon();
|
2020-04-19 12:33:25 +02:00
|
|
|
void restore_tmpcon();
|