1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-24 11:45:18 +03:00
aports/testing/zfs-src/4900-ppc-get-user-workaround.patch
Umar Getagazov ec5d996611 testing/zfs-src: new aport
https://zfsonlinux.org
ZFS for Linux (sources, AKMS)
2022-03-24 23:16:02 +07:00

60 lines
2 KiB
Diff

Description: PPC get_user workaround
Linux 5.12 PPC 5.12 get_user() and __copy_from_user_inatomic()
inline helpers very indirecly include a reference to the GPL'd
array mmu_feature_keys[] and fails to build. Workaround this by
using copy_from_user() and throwing EFAULT for any calls to
__copy_from_user_inatomic(). This is a workaround until a fix
for Linux commit 7613f5a66becfd0e43a0f34de8518695888f5458
"powerpc/64s/kuap: Use mmu_has_feature()" is fully addressed.
Author: Colin Ian King <colin.king@canonical.com>
Origin: ubuntu
Forwarded: no
Last-Update: 2021-04-28
Index: zfs-linux-2.0.3/module/os/linux/zfs/zfs_uio.c
===================================================================
--- zfs-linux-2.0.3.orig/module/os/linux/zfs/zfs_uio.c
+++ zfs-linux-2.0.3/module/os/linux/zfs/zfs_uio.c
@@ -47,6 +47,7 @@
#include <sys/strings.h>
#include <linux/kmap_compat.h>
#include <linux/uaccess.h>
+#include <linux/printk.h>
/*
* Move "n" bytes at byte address "p"; "rw" indicates the direction
@@ -79,11 +80,16 @@ uiomove_iov(void *p, size_t n, enum uio_
(iov->iov_base + skip), cnt)) {
return (EFAULT);
}
+#if defined(__PPC64__)
+ printk_ratelimited(KERN_ERR "uiomove_iov(): __copy_from_user_inatomic() not available to ZFS\n");
+ return (EFAULT);
+#else
pagefault_disable();
b_left =
__copy_from_user_inatomic(p,
(iov->iov_base + skip), cnt);
pagefault_enable();
+#endif
} else {
b_left =
copy_from_user(p,
@@ -248,7 +254,7 @@ uio_prefaultpages(ssize_t n, struct uio
/* touch each page in this segment. */
p = iov->iov_base + skip;
while (cnt) {
- if (get_user(tmp, (uint8_t *)p))
+ if (copy_from_user(&tmp, p, 1))
return (EFAULT);
ulong_t incr = MIN(cnt, PAGESIZE);
p += incr;
@@ -256,7 +262,7 @@ uio_prefaultpages(ssize_t n, struct uio
}
/* touch the last byte in case it straddles a page. */
p--;
- if (get_user(tmp, (uint8_t *)p))
+ if (copy_from_user(&tmp, p, 1))
return (EFAULT);
}
}