diff options
author | Alexander Sulfrian | 2020-03-28 16:25:03 +0100 |
---|---|---|
committer | Alexander Sulfrian | 2020-03-28 16:25:03 +0100 |
commit | 5318a756644ca9c97d29b89c3b3a7cb4289d4009 (patch) | |
tree | 2a11f0c6c4ef5c9fbfa93c1f37264a7aae7a5492 | |
parent | a38228ccf5ea1e3cb47d7fdd66ed871ed0faee45 (diff) | |
download | aur-5318a756644ca9c97d29b89c3b3a7cb4289d4009.tar.gz |
Keep compatibility with older kernels
The archlinuxarm targets may have an older kernel.
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | PKGBUILD | 8 | ||||
-rw-r--r-- | access_ok_compat.patch | 67 | ||||
-rw-r--r-- | access_ok_remove_type.patch | 33 |
4 files changed, 74 insertions, 40 deletions
@@ -1,7 +1,7 @@ pkgbase = eq3_char_loop-dkms pkgdesc = eQ-3 IPC loopback char driver pkgver = 2.19.9 - pkgrel = 3 + pkgrel = 4 url = https://github.com/eq-3/occu arch = x86_64 arch = arm @@ -11,13 +11,13 @@ pkgbase = eq3_char_loop-dkms depends = dkms conflicts = eq3_char_loop source = https://github.com/eq-3/occu/raw/2.19.9/KernelDrivers/eq3_char_loop.c - source = access_ok_remove_type.patch + source = access_ok_compat.patch source = 64bit_support.patch source = Makefile source = Kbuild source = dkms.conf sha256sums = 88093c1c242830f9d336b4e2cae53e38f83432640566470e48042f728216924f - sha256sums = 892d8d914f5d436795d6d120cef41b875cceafac2940fc25f79c1efa6903667e + sha256sums = f37d953e9a39bd58a94beb2a9f8f0a9a081f5f92f44f61c91b8fcb2e731bef14 sha256sums = f65af98cb61ede07f389c85c62d66032b19c7f8e4c77d7ce1d1fc09770bf6bcc sha256sums = f4d92e560e8501b13d95e9a8f2e2d9c03acdb994c5b2de8d7f9cda5682550085 sha256sums = 28c7d141374ea40099f6cef84ad601443e044a8278699269627d531030320756 @@ -3,7 +3,7 @@ _pkgbase=eq3_char_loop pkgname=${_pkgbase}-dkms pkgver=2.19.9 -pkgrel=3 +pkgrel=4 pkgdesc="eQ-3 IPC loopback char driver" arch=('x86_64' 'arm' 'armv6h' 'armv7h') url="https://github.com/eq-3/occu" @@ -12,13 +12,13 @@ depends=('dkms') conflicts=("${_pkgbase}") source=("https://github.com/eq-3/occu/raw/${pkgver}/KernelDrivers/${_pkgbase}.c" - "access_ok_remove_type.patch" + "access_ok_compat.patch" "64bit_support.patch" "Makefile" "Kbuild" "dkms.conf") sha256sums=('88093c1c242830f9d336b4e2cae53e38f83432640566470e48042f728216924f' - '892d8d914f5d436795d6d120cef41b875cceafac2940fc25f79c1efa6903667e' + 'f37d953e9a39bd58a94beb2a9f8f0a9a081f5f92f44f61c91b8fcb2e731bef14' 'f65af98cb61ede07f389c85c62d66032b19c7f8e4c77d7ce1d1fc09770bf6bcc' 'f4d92e560e8501b13d95e9a8f2e2d9c03acdb994c5b2de8d7f9cda5682550085' '28c7d141374ea40099f6cef84ad601443e044a8278699269627d531030320756' @@ -29,7 +29,7 @@ prepare() { cp --remove-destination "$(readlink eq3_char_loop.c)" eq3_char_loop.c fi - patch --forward --strip=1 --input="${srcdir}/access_ok_remove_type.patch" + patch --forward --strip=1 --input="${srcdir}/access_ok_compat.patch" patch --forward --strip=2 --input="${srcdir}/64bit_support.patch" } diff --git a/access_ok_compat.patch b/access_ok_compat.patch new file mode 100644 index 000000000000..8c6caf3d234a --- /dev/null +++ b/access_ok_compat.patch @@ -0,0 +1,67 @@ +--- a/eq3_char_loop.c 2020-03-27 23:57:42.975868561 +0100 ++++ b/eq3_char_loop.c 2020-03-28 16:22:56.020584770 +0100 +@@ -45,6 +45,12 @@ + #define EQ3LOOP_NUMBER_OF_CHANNELS 4
+ #define EQ3LOOP_DRIVER_NAME "eq3loop"
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0))
++ #define _access_ok(__type, __addr, __size) access_ok(__addr, __size)
++#else
++ #define _access_ok(__type, __addr, __size) access_ok(__type, __addr, __size)
++#endif
++
+ /* Use 'L' as magic number */
+ #define EQ3LOOP_IOC_MAGIC 'L'
+
+@@ -419,7 +425,7 @@ +
+ /*
+ * extract the type and number bitfields, and don't decode
+- * wrong cmds: return ENOTTY (inappropriate ioctl) before access_ok()
++ * wrong cmds: return ENOTTY (inappropriate ioctl) before _access_ok()
+ */
+ if (_IOC_TYPE(cmd) != EQ3LOOP_IOC_MAGIC) return -ENOTTY;
+
+@@ -445,20 +451,20 @@ +
+ /*
+ * extract the type and number bitfields, and don't decode
+- * wrong cmds: return ENOTTY (inappropriate ioctl) before access_ok()
++ * wrong cmds: return ENOTTY (inappropriate ioctl) before _access_ok()
+ */
+ if (_IOC_TYPE(cmd) != EQ3LOOP_IOC_MAGIC) return -ENOTTY;
+
+ /*
+ * the direction is a bitmask, and VERIFY_WRITE catches R/W
+ * transfers. `Type' is user-oriented, while
+- * access_ok is kernel-oriented, so the concept of "read" and
++ * _access_ok is kernel-oriented, so the concept of "read" and
+ * "write" is reversed
+ */
+ if (_IOC_DIR(cmd) & _IOC_READ)
+- ret = !access_ok(VERIFY_WRITE, (void *)arg, _IOC_SIZE(cmd));
++ ret = !_access_ok(VERIFY_WRITE, (void *)arg, _IOC_SIZE(cmd));
+ else if (_IOC_DIR(cmd) & _IOC_WRITE)
+- ret = !access_ok(VERIFY_READ, (void *)arg, _IOC_SIZE(cmd));
++ ret = !_access_ok(VERIFY_READ, (void *)arg, _IOC_SIZE(cmd));
+ if (ret) return -EFAULT;
+
+ switch(cmd) {
+@@ -500,7 +506,7 @@ + switch(cmd) {
+
+ case TCGETS:
+- if( access_ok(VERIFY_READ, (void *)arg, sizeof(struct termios) ) )
++ if( _access_ok(VERIFY_READ, (void *)arg, sizeof(struct termios) ) )
+ {
+ ret = copy_to_user( (void*)arg, &channel->termios, sizeof(struct termios) );
+ } else {
+@@ -508,7 +514,7 @@ + }
+ break;
+ case TCSETS:
+- if( access_ok(VERIFY_WRITE, (void *)arg, sizeof(struct termios) ) )
++ if( _access_ok(VERIFY_WRITE, (void *)arg, sizeof(struct termios) ) )
+ {
+ ret = copy_from_user( &channel->termios, (void*)arg, sizeof(struct termios) );
+ } else {
diff --git a/access_ok_remove_type.patch b/access_ok_remove_type.patch deleted file mode 100644 index f3a8f3906877..000000000000 --- a/access_ok_remove_type.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff -r -u a/eq3_char_loop.c b/eq3_char_loop.c ---- a/eq3_char_loop.c 2020-03-27 23:57:42.975868561 +0100 -+++ b/eq3_char_loop.c 2020-03-27 23:58:16.482782251 +0100 -@@ -456,9 +456,9 @@ - * "write" is reversed
- */
- if (_IOC_DIR(cmd) & _IOC_READ)
-- ret = !access_ok(VERIFY_WRITE, (void *)arg, _IOC_SIZE(cmd));
-+ ret = !access_ok((void *)arg, _IOC_SIZE(cmd));
- else if (_IOC_DIR(cmd) & _IOC_WRITE)
-- ret = !access_ok(VERIFY_READ, (void *)arg, _IOC_SIZE(cmd));
-+ ret = !access_ok((void *)arg, _IOC_SIZE(cmd));
- if (ret) return -EFAULT;
-
- switch(cmd) {
-@@ -500,7 +500,7 @@ - switch(cmd) {
-
- case TCGETS:
-- if( access_ok(VERIFY_READ, (void *)arg, sizeof(struct termios) ) )
-+ if( access_ok((void *)arg, sizeof(struct termios) ) )
- {
- ret = copy_to_user( (void*)arg, &channel->termios, sizeof(struct termios) );
- } else {
-@@ -508,7 +508,7 @@ - }
- break;
- case TCSETS:
-- if( access_ok(VERIFY_WRITE, (void *)arg, sizeof(struct termios) ) )
-+ if( access_ok((void *)arg, sizeof(struct termios) ) )
- {
- ret = copy_from_user( &channel->termios, (void*)arg, sizeof(struct termios) );
- } else {
|