Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Mar 2021 23:11:54 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 3b1ecc9fa1b5 - main - LinuxKPI: remove < 5.0 version support
Message-ID:  <202103242311.12ONBs86037124@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=3b1ecc9fa1b57ca7a1c86661e9a323bc41c97ecc

commit 3b1ecc9fa1b57ca7a1c86661e9a323bc41c97ecc
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2021-03-23 14:24:49 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2021-03-24 23:00:03 +0000

    LinuxKPI: remove < 5.0 version support
    
    We are not aware of any out-of-tree consumers anymore
    which would need KPI support for before Linux version 5.
    Update the two in-tree consumers to use the new KPI.
    This allows us to remove the extra version check and
    will also give access to {lower,upper}_32_bits() unconditionally.
    
    Sponsored-by:   The FreeBSD Foundation
    Reviewed-by:    hselasky, rlibby, rstone
    MFC-after:      2 weeks
    X-MFC:          to 13 only
    Differential Revision: https://reviews.freebsd.org/D29391
---
 sys/compat/linuxkpi/common/include/asm/uaccess.h    | 4 ----
 sys/compat/linuxkpi/common/include/linux/compiler.h | 3 ---
 sys/compat/linuxkpi/common/include/linux/uaccess.h  | 4 ----
 sys/dev/pms/freebsd/driver/common/lxencrypt.c       | 4 ++--
 sys/ofed/drivers/infiniband/core/ib_uverbs_main.c   | 3 +--
 5 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/asm/uaccess.h b/sys/compat/linuxkpi/common/include/asm/uaccess.h
index 0ae20b09dc8c..102373634ba3 100644
--- a/sys/compat/linuxkpi/common/include/asm/uaccess.h
+++ b/sys/compat/linuxkpi/common/include/asm/uaccess.h
@@ -52,11 +52,7 @@ copy_from_user(void *to, const void *from, unsigned long n)
 #define	__copy_from_user(...)	copy_from_user(__VA_ARGS__)
 #define	__copy_in_user(...)	copy_from_user(__VA_ARGS__)
 
-#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000
 #define	user_access_begin(ptr, len) access_ok(ptr, len)
-#else
-#define	user_access_begin() do { } while (0)
-#endif
 #define	user_access_end() do { } while (0)
 
 #define	unsafe_get_user(x, ptr, err) do { \
diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h
index 1177674aa68f..d8aef4fa7988 100644
--- a/sys/compat/linuxkpi/common/include/linux/compiler.h
+++ b/sys/compat/linuxkpi/common/include/linux/compiler.h
@@ -81,11 +81,8 @@
 
 #define	barrier()			__asm__ __volatile__("": : :"memory")
 
-#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000
-/* Moved from drm_os_freebsd.h */
 #define	lower_32_bits(n)		((u32)(n))
 #define	upper_32_bits(n)		((u32)(((n) >> 16) >> 16))
-#endif
 
 #define	___PASTE(a,b) a##b
 #define	__PASTE(a,b) ___PASTE(a,b)
diff --git a/sys/compat/linuxkpi/common/include/linux/uaccess.h b/sys/compat/linuxkpi/common/include/linux/uaccess.h
index c09c363a98a7..10a06a220f86 100644
--- a/sys/compat/linuxkpi/common/include/linux/uaccess.h
+++ b/sys/compat/linuxkpi/common/include/linux/uaccess.h
@@ -61,11 +61,7 @@
 #define	put_user(_x, _p)	__put_user(_x, _p)
 #define	clear_user(...)		linux_clear_user(__VA_ARGS__)
 
-#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000
 #define	access_ok(a,b)		linux_access_ok(a,b)
-#else
-#define	access_ok(a,b,c)	linux_access_ok(b,c)
-#endif
 
 extern int linux_copyin(const void *uaddr, void *kaddr, size_t len);
 extern int linux_copyout(const void *kaddr, void *uaddr, size_t len);
diff --git a/sys/dev/pms/freebsd/driver/common/lxencrypt.c b/sys/dev/pms/freebsd/driver/common/lxencrypt.c
index c53c52fb2378..0d469f9fdbf7 100644
--- a/sys/dev/pms/freebsd/driver/common/lxencrypt.c
+++ b/sys/dev/pms/freebsd/driver/common/lxencrypt.c
@@ -838,7 +838,7 @@ printf("%s: Minor %d\n", __FUNCTION__, pIoctlPayload->hdr.MinorFunction);
                 printf("%s: Add kek at index 0x%x wrapper 0x%x format 0x%x\n", __FUNCTION__, kek_add->kekIndex, kek_add->wrapperKekIndex, kek_add->blobFormat);
                 
                 /* Copy kek_blob from user pointer to local buffer */
-                if(access_ok(VERIFY_READ, kek_add->EncryptKekBlob, sizeof(kek_blob))) {
+                if(access_ok(kek_add->EncryptKekBlob, sizeof(kek_blob))) {
                     printf("%s: Starting copy from user %p to kernel %p\n", __FUNCTION__, kek_add->EncryptKekBlob, &kek_blob);
                     if((rv = copy_from_user(&kek_blob, kek_add->EncryptKekBlob, sizeof(kek_blob))) != 0) {
                         printf("%s: Copy error, %d left\n", __FUNCTION__, rv);
@@ -873,7 +873,7 @@ printf("%s: Minor %d\n", __FUNCTION__, pIoctlPayload->hdr.MinorFunction);
                 printf("%s: Add dek at index 0x%x, table %x, kek index %x, blob format %x, entry size %x\n", __FUNCTION__, dek_index, dek_table, kek_index, blob_format, entry_sz);
                 
                 /* Copy dek_blob from user pointer to local buffer */
-                if(access_ok(VERIFY_READ, dek_add->dekBlob, sizeof(dek_blob))) {
+                if(access_ok(dek_add->dekBlob, sizeof(dek_blob))) {
                     printf("%s: Starting copy from user %p to kernel %p\n", __FUNCTION__, dek_add->dekBlob, &dek_blob);
                     if((rv = copy_from_user(&dek_blob, dek_add->dekBlob, sizeof(dek_blob))) != 0) {
                         printf("%s: Copy error, %d left\n", __FUNCTION__, rv);
diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c
index 8aab2ac3ff8d..e1b560774fbc 100644
--- a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c
+++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c
@@ -856,8 +856,7 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
 				goto out;
 			}
 
-			if (!access_ok(VERIFY_WRITE,
-				       (void __user *) (unsigned long) ex_hdr.response,
+			if (!access_ok((void __user *) (unsigned long) ex_hdr.response,
 				       (hdr.out_words + ex_hdr.provider_out_words) * 8)) {
 				ret = -EFAULT;
 				goto out;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103242311.12ONBs86037124>