From d2f89a2b8ae5d1aa5650c22a863b8b8690d841d0 Mon Sep 17 00:00:00 2001 From: llyyr Date: Wed, 5 Mar 2025 04:53:49 +0530 Subject: [PATCH] Fix for kernel 6.13+ --- binder/binder.c | 4 +++- binder/binder_alloc.c | 15 +++++++++++++-- binder/binder_alloc.h | 2 ++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/binder/binder.c b/binder/binder.c index c0f6f12..ee38063 100644 --- a/binder/binder.c +++ b/binder/binder.c @@ -3128,7 +3128,9 @@ static void binder_transaction(struct binder_proc *proc, u32 secid; size_t added_size; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0) + security_cred_getsecid(proc->cred, &secid); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) security_task_getsecid_obj(proc->tsk, &secid); #else security_task_getsecid(proc->tsk, &secid); diff --git a/binder/binder_alloc.c b/binder/binder_alloc.c index bfdec52..36941d3 100644 --- a/binder/binder_alloc.c +++ b/binder/binder_alloc.c @@ -1055,6 +1055,13 @@ err_get_alloc_mutex_failed: return LRU_SKIP; } +enum lru_status binder_alloc_free_page_no_lock(struct list_head *item, + struct list_lru_one *lru, + void *cb_arg) +{ + return binder_alloc_free_page(item, lru, NULL, cb_arg); +} + static unsigned long binder_shrink_count(struct shrinker *shrink, struct shrink_control *sc) { @@ -1066,9 +1073,13 @@ static unsigned long binder_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) { unsigned long ret; - +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) + ret = list_lru_walk(&binder_alloc_lru, binder_alloc_free_page_no_lock, + NULL, sc->nr_to_scan); +#else ret = list_lru_walk(&binder_alloc_lru, binder_alloc_free_page, - NULL, sc->nr_to_scan); + NULL, sc->nr_to_scan); +#endif return ret; } diff --git a/binder/binder_alloc.h b/binder/binder_alloc.h index f6052c9..f766a68 100644 --- a/binder/binder_alloc.h +++ b/binder/binder_alloc.h @@ -117,6 +117,8 @@ static inline void binder_selftest_alloc(struct binder_alloc *alloc) {} enum lru_status binder_alloc_free_page(struct list_head *item, struct list_lru_one *lru, spinlock_t *lock, void *cb_arg); +enum lru_status binder_alloc_free_page_no_lock(struct list_head *item, + struct list_lru_one *lru, void *cb_arg); extern struct binder_buffer *binder_alloc_new_buf(struct binder_alloc *alloc, size_t data_size, size_t offsets_size,