Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add supercall to get kernelpatch build times #126

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions kernel/patch/common/sucompat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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));
Expand Down Expand Up @@ -556,4 +566,4 @@ int su_compat_init()
// log_boot("hook 32 __NR_faccessat2 rc: %d\n", rc);

return 0;
}
}
8 changes: 8 additions & 0 deletions kernel/patch/common/supercall.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions kernel/patch/include/accctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -45,4 +45,4 @@ static inline void set_priv_sel_allow(struct task_struct *task, bool val)
dsb(ish);
}

#endif
#endif
1 change: 1 addition & 0 deletions kernel/patch/include/uapi/scdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

别跟su放一起吧,例如加个 SUPERCALL_BUILD_GET_TS,还有上面的函数位置


#define SUPERCALL_MAX 0x1200

Expand Down
Loading