When calling get_full_comm() within system call hooks, current->mm may be null (prctl). A fallback mechanism for current->comm must be added beforehand to prevent null pointer dereferences when accessing mm->arg_start/arg_end. Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
43 lines
956 B
C
43 lines
956 B
C
#ifndef __KSU_MANUAL_SU_H
|
|
#define __KSU_MANUAL_SU_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/sched.h>
|
|
|
|
#define ksu_task_is_dead(t) ((t)->exit_state != 0)
|
|
|
|
#define MAX_PENDING 16
|
|
#define REMOVE_DELAY_CALLS 150
|
|
#define MAX_TOKENS 10
|
|
|
|
#define KSU_SU_VERIFIED_BIT (1UL << 0)
|
|
#define KSU_TOKEN_LENGTH 32
|
|
#define KSU_TOKEN_ENV_NAME "KSU_AUTH_TOKEN"
|
|
#define KSU_TOKEN_EXPIRE_TIME 150
|
|
|
|
#define MANUAL_SU_OP_GENERATE_TOKEN 0
|
|
#define MANUAL_SU_OP_ESCALATE 1
|
|
#define MANUAL_SU_OP_ADD_PENDING 2
|
|
|
|
struct pending_uid {
|
|
uid_t uid;
|
|
int use_count;
|
|
int remove_calls;
|
|
};
|
|
|
|
struct manual_su_request {
|
|
uid_t target_uid;
|
|
pid_t target_pid;
|
|
char token_buffer[KSU_TOKEN_LENGTH + 1];
|
|
};
|
|
|
|
struct ksu_token_entry {
|
|
char token[KSU_TOKEN_LENGTH + 1];
|
|
unsigned long expire_time;
|
|
bool used;
|
|
};
|
|
|
|
int ksu_handle_manual_su_request(int option, struct manual_su_request *request);
|
|
bool is_pending_root(uid_t uid);
|
|
void remove_pending_root(uid_t uid);
|
|
#endif |