diff --git a/kernel/patch/common/sucompat.c b/kernel/patch/common/sucompat.c index 0911bd8..ea8368b 100644 --- a/kernel/patch/common/sucompat.c +++ b/kernel/patch/common/sucompat.c @@ -54,6 +54,10 @@ static const char *current_su_path = 0; static struct list_head allow_uid_list; static spinlock_t list_lock; +const char* get_compile_timestamp() { + return __DATE__ " " __TIME__; +} + static void allow_reclaim_callback(struct rcu_head *rcu) { struct allow_uid *allow = container_of(rcu, struct allow_uid, rcu); @@ -257,6 +261,13 @@ const char *su_get_path() } KP_EXPORT_SYMBOL(su_get_path); +const char *su_get_ts() +{ + const char* timestamp = get_compile_timestamp(); + return timestamp; +} +KP_EXPORT_SYMBOL(su_get_ts); + // #define TRY_DIRECT_MODIFY_USER #define INLINE_HOOK_SYSCALL @@ -267,7 +278,6 @@ static void handle_before_execve(hook_local_t *hook_local, char **__user u_filen // copy to user len hook_local->data0 = 0; #endif - char __user *ufilename = *u_filename_p; char filename[SU_PATH_MAX_LEN]; int flen = compat_strncpy_from_user(filename, ufilename, sizeof(filename)); @@ -556,4 +566,4 @@ int su_compat_init() // log_boot("hook 32 __NR_faccessat2 rc: %d\n", rc); return 0; -} \ No newline at end of file +} diff --git a/kernel/patch/common/supercall.c b/kernel/patch/common/supercall.c index 05311e8..45837a0 100644 --- a/kernel/patch/common/supercall.c +++ b/kernel/patch/common/supercall.c @@ -227,6 +227,14 @@ static long call_su_get_path(char *__user ubuf, int buf_len) return compat_copy_to_user(ubuf, path, len + 1); } +static long call_su_get_ts(char *__user ubuf, int buf_len) +{ + const char *path = su_get_ts(); + int len = strlen(path); + if (buf_len <= len) return -ENOBUFS; + return compat_copy_to_user(ubuf, path, len + 1); +} + static long call_su_get_allow_sctx(char *__user usctx, int ulen) { int len = strlen(all_allow_sctx); diff --git a/kernel/patch/include/accctl.h b/kernel/patch/include/accctl.h index ebc87b5..dbdea1d 100644 --- a/kernel/patch/include/accctl.h +++ b/kernel/patch/include/accctl.h @@ -31,7 +31,7 @@ int su_allow_uids(int is_user, uid_t *out_uids, int out_num); int su_allow_uid_profile(int is_user, uid_t uid, struct su_profile *profile); int su_reset_path(const char *path); const char *su_get_path(); - +const char *su_get_ts(); /** * @brief Whether to make the current task bypass all selinux permission checks. * @@ -45,4 +45,4 @@ static inline void set_priv_sel_allow(struct task_struct *task, bool val) dsb(ish); } -#endif \ No newline at end of file +#endif diff --git a/kernel/patch/include/uapi/scdefs.h b/kernel/patch/include/uapi/scdefs.h index 42234bb..cb37077 100644 --- a/kernel/patch/include/uapi/scdefs.h +++ b/kernel/patch/include/uapi/scdefs.h @@ -106,6 +106,7 @@ struct su_profile #define SUPERCALL_SU_GET_PATH 0x1110 #define SUPERCALL_SU_RESET_PATH 0x1111 #define SUPERCALL_SU_GET_SAFEMODE 0x1112 +#define SUPERCALL_SU_GET_TS 0x1113 #define SUPERCALL_MAX 0x1200