Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Update binder.c for compatibility with kernel 5.3 #36

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion binder/binder.c
Original file line number Diff line number Diff line change
Expand Up @@ -3391,7 +3391,7 @@ static void binder_vma_close(struct vm_area_struct *vma)
binder_defer_work(proc, BINDER_DEFERRED_PUT_FILES);
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
Copy link
Member

Choose a reason for hiding this comment

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

The signature is different in 5.1 and 5.2 still. In order to support both we have to define the signature of both versions here too and add a proper if around them.

Copy link

Choose a reason for hiding this comment

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

To me it seems like the vm_fault_t (*fault)(struct vm_fault *vmf); signature was changed in kernel 4.17, and hasn't been changed after that, in mainline at least.
torvalds/linux@1c8f422
With the following patch to anbox-modules-dkms version 13 the module builds in both 5.1.15 and 5.4.12 for me.

--- binder/binder.c.orig 2020-01-17 14:08:56.306373591 +0100
+++ binder/binder.c 2020-01-17 14:09:23.078508434 +0100
@@ -3367,7 +3367,9 @@
binder_defer_work(proc, BINDER_DEFERRED_PUT_FILES);
}

-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
+static vm_fault_t binder_vm_fault(struct vm_fault *vmf)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
static int binder_vm_fault(struct vm_fault *vmf)
#else
static int binder_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)

static vm_fault_t binder_vm_fault(struct vm_fault *vmf)
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
static int binder_vm_fault(struct vm_fault *vmf)
Expand Down