Fixes for kernel 6.8

This commit is contained in:
ssfdust 2024-01-24 12:45:28 +08:00 committed by Christian Hoff
parent 13a93a4f7c
commit 44e5ba79f5
3 changed files with 22 additions and 3 deletions

View File

@ -2236,7 +2236,9 @@ static void binder_deferred_fd_close(int fd)
if (!twcb) if (!twcb)
return; return;
init_task_work(&twcb->twork, binder_do_fd_close); init_task_work(&twcb->twork, binder_do_fd_close);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0))
twcb->file = file_close_fd(fd);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0))
twcb->file = close_fd_get_file(fd); twcb->file = close_fd_get_file(fd);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0)) #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
close_fd_get_file(fd, &twcb->file); close_fd_get_file(fd, &twcb->file);

View File

@ -235,7 +235,11 @@ static int binder_update_page_range(struct binder_alloc *alloc, int allocate,
if (page->page_ptr) { if (page->page_ptr) {
trace_binder_alloc_lru_start(alloc, index); trace_binder_alloc_lru_start(alloc, index);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0))
on_lru = list_lru_del_obj(&binder_alloc_lru, &page->lru);
#else
on_lru = list_lru_del(&binder_alloc_lru, &page->lru); on_lru = list_lru_del(&binder_alloc_lru, &page->lru);
#endif
WARN_ON(!on_lru); WARN_ON(!on_lru);
trace_binder_alloc_lru_end(alloc, index); trace_binder_alloc_lru_end(alloc, index);
@ -286,7 +290,11 @@ free_range:
trace_binder_free_lru_start(alloc, index); trace_binder_free_lru_start(alloc, index);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0))
ret = list_lru_add_obj(&binder_alloc_lru, &page->lru);
#else
ret = list_lru_add(&binder_alloc_lru, &page->lru); ret = list_lru_add(&binder_alloc_lru, &page->lru);
#endif
WARN_ON(!ret); WARN_ON(!ret);
trace_binder_free_lru_end(alloc, index); trace_binder_free_lru_end(alloc, index);
@ -846,8 +854,13 @@ void binder_alloc_deferred_release(struct binder_alloc *alloc)
if (!alloc->pages[i].page_ptr) if (!alloc->pages[i].page_ptr)
continue; continue;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0))
on_lru = list_lru_del_obj(&binder_alloc_lru,
&alloc->pages[i].lru);
#else
on_lru = list_lru_del(&binder_alloc_lru, on_lru = list_lru_del(&binder_alloc_lru,
&alloc->pages[i].lru); &alloc->pages[i].lru);
#endif
page_addr = alloc->buffer + i * PAGE_SIZE; page_addr = alloc->buffer + i * PAGE_SIZE;
binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC,
"%s: %d: page %d at %pK %s\n", "%s: %d: page %d at %pK %s\n",

View File

@ -77,7 +77,9 @@ static int (*close_fd_get_file_ptr)(unsigned int fd, struct file **res)
#endif #endif
= NULL; = NULL;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0))
struct file *file_close_fd(unsigned int fd)
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0))
struct file *close_fd_get_file(unsigned int fd) struct file *close_fd_get_file(unsigned int fd)
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0)) #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
int close_fd_get_file(unsigned int fd, struct file **res) int close_fd_get_file(unsigned int fd, struct file **res)
@ -86,7 +88,9 @@ int __close_fd_get_file(unsigned int fd, struct file **res)
#endif #endif
{ {
if (!close_fd_get_file_ptr) if (!close_fd_get_file_ptr)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0))
close_fd_get_file_ptr = kallsyms_lookup_name_wrapper("file_close_fd");
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
close_fd_get_file_ptr = kallsyms_lookup_name_wrapper("close_fd_get_file"); close_fd_get_file_ptr = kallsyms_lookup_name_wrapper("close_fd_get_file");
#else #else
close_fd_get_file_ptr = kallsyms_lookup_name_wrapper("__close_fd_get_file"); close_fd_get_file_ptr = kallsyms_lookup_name_wrapper("__close_fd_get_file");