kernel: fix -Wstrict-prototypes warnings/errors

* On newer kernel for some reason -Wno-strict-prototypes still does not fix the errors or warnings.
* To fix it, we just need to add void type.

Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
This commit is contained in:
rsuntk
2025-08-28 15:46:22 +07:00
committed by ShirkNeko
parent 6e5226efbb
commit 22eb11c391
13 changed files with 44 additions and 41 deletions

View File

@@ -63,7 +63,7 @@ static void remove_uid_from_arr(uid_t uid)
kfree(temp_arr); kfree(temp_arr);
} }
static void init_default_profiles() static void init_default_profiles(void)
{ {
kernel_cap_t full_cap = CAP_FULL_SET; kernel_cap_t full_cap = CAP_FULL_SET;
@@ -110,7 +110,7 @@ void ksu_show_allow_list(void)
} }
#ifdef CONFIG_KSU_DEBUG #ifdef CONFIG_KSU_DEBUG
static void ksu_grant_root_to_shell() static void ksu_grant_root_to_shell(void)
{ {
struct app_profile profile = { struct app_profile profile = {
.version = KSU_APP_PROFILE_VER, .version = KSU_APP_PROFILE_VER,

View File

@@ -135,10 +135,10 @@ static bool ksu_module_mounted = false;
extern int handle_sepolicy(unsigned long arg3, void __user *arg4); extern int handle_sepolicy(unsigned long arg3, void __user *arg4);
bool ksu_su_compat_enabled = true; bool ksu_su_compat_enabled = true;
extern void ksu_sucompat_init(); extern void ksu_sucompat_init(void);
extern void ksu_sucompat_exit(); extern void ksu_sucompat_exit(void);
static inline bool is_allow_su() static inline bool is_allow_su(void)
{ {
if (is_manager()) { if (is_manager()) {
// we are manager, allow! // we are manager, allow!
@@ -322,7 +322,8 @@ int ksu_handle_rename(struct dentry *old_dentry, struct dentry *new_dentry)
} }
#ifdef CONFIG_EXT4_FS #ifdef CONFIG_EXT4_FS
static void nuke_ext4_sysfs() { static void nuke_ext4_sysfs(void)
{
struct path path; struct path path;
int err = kern_path("/data/adb/modules", 0, &path); int err = kern_path("/data/adb/modules", 0, &path);
if (err) { if (err) {
@@ -342,7 +343,9 @@ static void nuke_ext4_sysfs() {
path_put(&path); path_put(&path);
} }
#else #else
static inline void nuke_ext4_sysfs() { } static inline void nuke_ext4_sysfs(void)
{
}
#endif #endif
int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3, int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,

View File

@@ -61,7 +61,7 @@ static bool android_context_saved_checked = false;
static bool android_context_saved_enabled = false; static bool android_context_saved_enabled = false;
static struct ksu_ns_fs_saved android_context_saved; static struct ksu_ns_fs_saved android_context_saved;
void ksu_android_ns_fs_check() void ksu_android_ns_fs_check(void)
{ {
if (android_context_saved_checked) if (android_context_saved_checked)
return; return;

View File

@@ -57,7 +57,7 @@ extern long ksu_strncpy_from_user_nofault(char *dst,
extern struct key *init_session_keyring; extern struct key *init_session_keyring;
#endif #endif
extern void ksu_android_ns_fs_check(); extern void ksu_android_ns_fs_check(void);
extern struct file *ksu_filp_open_compat(const char *filename, int flags, extern struct file *ksu_filp_open_compat(const char *filename, int flags,
umode_t mode); umode_t mode);
extern ssize_t ksu_kernel_read_compat(struct file *p, void *buf, size_t count, extern ssize_t ksu_kernel_read_compat(struct file *p, void *buf, size_t count,

View File

@@ -54,10 +54,10 @@ int ksu_handle_execveat(int *fd, struct filename **filename_ptr, void *argv,
flags); flags);
} }
extern void ksu_sucompat_init(); extern void ksu_sucompat_init(void);
extern void ksu_sucompat_exit(); extern void ksu_sucompat_exit(void);
extern void ksu_ksud_init(); extern void ksu_ksud_init(void);
extern void ksu_ksud_exit(); extern void ksu_ksud_exit(void);
#ifdef CONFIG_KSU_TRACEPOINT_HOOK #ifdef CONFIG_KSU_TRACEPOINT_HOOK
extern void ksu_trace_register(); extern void ksu_trace_register();
extern void ksu_trace_unregister(); extern void ksu_trace_unregister();

View File

@@ -45,9 +45,9 @@ static const char KERNEL_SU_RC[] =
" exec u:r:su:s0 root -- " KSUD_PATH " boot-completed\n" " exec u:r:su:s0 root -- " KSUD_PATH " boot-completed\n"
"\n"; "\n";
static void stop_vfs_read_hook(); static void stop_vfs_read_hook(void);
static void stop_execve_hook(); static void stop_execve_hook(void);
static void stop_input_hook(); static void stop_input_hook(void);
#ifdef CONFIG_KSU_KPROBES_HOOK #ifdef CONFIG_KSU_KPROBES_HOOK
static struct work_struct stop_vfs_read_work; static struct work_struct stop_vfs_read_work;
@@ -627,7 +627,7 @@ int __maybe_unused ksu_handle_compat_execve_ksud(const char __user *filename_use
#endif #endif
static void stop_vfs_read_hook() static void stop_vfs_read_hook(void)
{ {
#ifdef CONFIG_KSU_KPROBES_HOOK #ifdef CONFIG_KSU_KPROBES_HOOK
bool ret = schedule_work(&stop_vfs_read_work); bool ret = schedule_work(&stop_vfs_read_work);
@@ -638,7 +638,7 @@ static void stop_vfs_read_hook()
#endif #endif
} }
static void stop_execve_hook() static void stop_execve_hook(void)
{ {
#ifdef CONFIG_KSU_KPROBES_HOOK #ifdef CONFIG_KSU_KPROBES_HOOK
bool ret = schedule_work(&stop_execve_hook_work); bool ret = schedule_work(&stop_execve_hook_work);
@@ -653,7 +653,7 @@ static void stop_execve_hook()
#endif #endif
} }
static void stop_input_hook() static void stop_input_hook(void)
{ {
#ifdef CONFIG_KSU_KPROBES_HOOK #ifdef CONFIG_KSU_KPROBES_HOOK
static bool input_hook_stopped = false; static bool input_hook_stopped = false;
@@ -672,7 +672,7 @@ static void stop_input_hook()
} }
// ksud: module support // ksud: module support
void ksu_ksud_init() void ksu_ksud_init(void)
{ {
#ifdef CONFIG_KSU_KPROBES_HOOK #ifdef CONFIG_KSU_KPROBES_HOOK
int ret; int ret;
@@ -692,7 +692,7 @@ void ksu_ksud_init()
#endif #endif
} }
void ksu_ksud_exit() void ksu_ksud_exit(void)
{ {
#ifdef CONFIG_KSU_KPROBES_HOOK #ifdef CONFIG_KSU_KPROBES_HOOK
unregister_kprobe(&execve_kp); unregister_kprobe(&execve_kp);

View File

@@ -13,17 +13,17 @@ extern void ksu_add_manager(uid_t uid, int signature_index);
extern void ksu_remove_manager(uid_t uid); extern void ksu_remove_manager(uid_t uid);
extern int ksu_get_manager_signature_index(uid_t uid); extern int ksu_get_manager_signature_index(uid_t uid);
static inline bool ksu_is_manager_uid_valid() static inline bool ksu_is_manager_uid_valid(void)
{ {
return ksu_manager_uid != KSU_INVALID_UID; return ksu_manager_uid != KSU_INVALID_UID;
} }
static inline bool is_manager() static inline bool is_manager(void)
{ {
return unlikely(ksu_is_any_manager(current_uid().val) || ksu_manager_uid == current_uid().val); return unlikely(ksu_is_any_manager(current_uid().val) || ksu_manager_uid == current_uid().val);
} }
static inline uid_t ksu_get_manager_uid() static inline uid_t ksu_get_manager_uid(void)
{ {
return ksu_manager_uid; return ksu_manager_uid;
} }
@@ -33,7 +33,7 @@ static inline void ksu_set_manager_uid(uid_t uid)
ksu_manager_uid = uid; ksu_manager_uid = uid;
} }
static inline void ksu_invalidate_manager_uid() static inline void ksu_invalidate_manager_uid(void)
{ {
ksu_manager_uid = KSU_INVALID_UID; ksu_manager_uid = KSU_INVALID_UID;
} }

View File

@@ -38,7 +38,7 @@ static struct policydb *get_policydb(void)
static DEFINE_MUTEX(ksu_rules); static DEFINE_MUTEX(ksu_rules);
void apply_kernelsu_rules() void apply_kernelsu_rules(void)
{ {
struct policydb *db; struct policydb *db;
@@ -220,7 +220,7 @@ static int get_object(char *buf, char __user *user_object, size_t buf_sz,
} }
// reset avc cache table, otherwise the new rules will not take effect if already denied // reset avc cache table, otherwise the new rules will not take effect if already denied
static void reset_avc_cache() static void reset_avc_cache(void)
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0) || \ #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0) || \
!defined(KSU_COMPAT_USE_SELINUX_STATE) !defined(KSU_COMPAT_USE_SELINUX_STATE)

View File

@@ -101,7 +101,7 @@ static inline u32 current_sid(void)
} }
#endif #endif
bool is_ksu_domain() bool is_ksu_domain(void)
{ {
char *domain; char *domain;
u32 seclen; u32 seclen;
@@ -222,7 +222,7 @@ void susfs_set_kernel_sid(void)
#define DEVPTS_DOMAIN "u:object_r:ksu_file:s0" #define DEVPTS_DOMAIN "u:object_r:ksu_file:s0"
u32 ksu_get_devpts_sid() u32 ksu_get_devpts_sid(void)
{ {
u32 devpts_sid = 0; u32 devpts_sid = 0;
int err = security_secctx_to_secid(DEVPTS_DOMAIN, strlen(DEVPTS_DOMAIN), int err = security_secctx_to_secid(DEVPTS_DOMAIN, strlen(DEVPTS_DOMAIN),

View File

@@ -14,11 +14,11 @@ void setenforce(bool);
bool getenforce(void); bool getenforce(void);
bool is_ksu_domain(); bool is_ksu_domain(void);
bool is_zygote(void *cred); bool is_zygote(void *cred);
void apply_kernelsu_rules(); void apply_kernelsu_rules(void);
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
bool susfs_is_sid_equal(void *sec, u32 sid2); bool susfs_is_sid_equal(void *sec, u32 sid2);
@@ -32,6 +32,6 @@ void susfs_set_init_sid(void);
bool susfs_is_current_init_domain(void); bool susfs_is_current_init_domain(void);
#endif #endif
u32 ksu_get_devpts_sid(); u32 ksu_get_devpts_sid(void);
#endif #endif

View File

@@ -28,7 +28,7 @@
#define SU_PATH "/system/bin/su" #define SU_PATH "/system/bin/su"
#define SH_PATH "/system/bin/sh" #define SH_PATH "/system/bin/sh"
extern void escape_to_root(); extern void escape_to_root(void);
static const char sh_path[] = "/system/bin/sh"; static const char sh_path[] = "/system/bin/sh";
static const char ksud_path[] = KSUD_PATH; static const char ksud_path[] = KSUD_PATH;
@@ -372,7 +372,7 @@ static void destroy_kprobe(struct kprobe **kp_ptr)
#endif #endif
// sucompat: permited process can execute 'su' to gain root access. // sucompat: permited process can execute 'su' to gain root access.
void ksu_sucompat_init() void ksu_sucompat_init(void)
{ {
#ifdef CONFIG_KSU_KPROBES_HOOK #ifdef CONFIG_KSU_KPROBES_HOOK
su_kps[0] = init_kprobe(SYS_EXECVE_SYMBOL, execve_handler_pre); su_kps[0] = init_kprobe(SYS_EXECVE_SYMBOL, execve_handler_pre);
@@ -389,7 +389,7 @@ void ksu_sucompat_init()
#endif #endif
} }
void ksu_sucompat_exit() void ksu_sucompat_exit(void)
{ {
#ifdef CONFIG_KSU_KPROBES_HOOK #ifdef CONFIG_KSU_KPROBES_HOOK
int i; int i;

View File

@@ -328,7 +328,7 @@ static bool is_uid_exist(uid_t uid, char *package, void *data)
return exist; return exist;
} }
void track_throne() void track_throne(void)
{ {
struct file *fp = struct file *fp =
ksu_filp_open_compat(SYSTEM_PACKAGES_LIST_PATH, O_RDONLY, 0); ksu_filp_open_compat(SYSTEM_PACKAGES_LIST_PATH, O_RDONLY, 0);
@@ -440,12 +440,12 @@ out:
} }
} }
void ksu_throne_tracker_init() void ksu_throne_tracker_init(void)
{ {
// nothing to do // nothing to do
} }
void ksu_throne_tracker_exit() void ksu_throne_tracker_exit(void)
{ {
// nothing to do // nothing to do
} }

View File

@@ -1,10 +1,10 @@
#ifndef __KSU_H_UID_OBSERVER #ifndef __KSU_H_UID_OBSERVER
#define __KSU_H_UID_OBSERVER #define __KSU_H_UID_OBSERVER
void ksu_throne_tracker_init(); void ksu_throne_tracker_init(void);
void ksu_throne_tracker_exit(); void ksu_throne_tracker_exit(void);
void track_throne(); void track_throne(void);
#endif #endif