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

Conversation

SoulInfernoDE
Copy link

fixes error while compiling binder with kernel versions 5.3

/var/lib/dkms/anbox/1/build/binder/binder.c:3406:11: error: initialization of ‘vm_fault_t (*)(struct vm_fault )’ {aka ‘unsigned int ()(struct vm_fault )’} from incompatible pointer type ‘int ()(struct vm_fault
*)’ [-Werror=incompatible-pointer-types]
.fault = binder_vm_fault,
^~~~~~~~~~~~~~~
/var/lib/dkms/anbox/1/build/binder/binder.c:3406:11: note: (near initialization for ‘binder_vm_ops.fault’)
cc1: some warnings being treated as errors

👍 fixed 👍

SoulInfernoDE and others added 2 commits October 22, 2019 06:13
fixes error while compiling binder with kernel versions 5.3

/var/lib/dkms/anbox/1/build/binder/binder.c:3406:11: error: initialization of ‘vm_fault_t (*)(struct vm_fault *)’ {aka ‘unsigned int (*)(struct vm_fault *)’} from incompatible pointer type ‘int (*)(struct vm_fault
 *)’ [-Werror=incompatible-pointer-types]
  .fault = binder_vm_fault,
           ^~~~~~~~~~~~~~~
/var/lib/dkms/anbox/1/build/binder/binder.c:3406:11: note: (near initialization for ‘binder_vm_ops.fault’)
cc1: some warnings being treated as errors


:+1:  fixed :+1:
@@ -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)

@TheOneWithTheBraid
Copy link

TheOneWithTheBraid commented Mar 28, 2020

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants