From 73eeed59d17bdc54849567c15a1afa7b4e36f817 Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Mon, 19 Feb 2024 12:57:24 +0900 Subject: [PATCH] Use the vm_flags wrapper since kernel version 6.3 Use the vm_flags wrapper since kernel version 6.3. Change-Id: Icc3eada1fe80b57da47939fd449297977716d867 Signed-off-by: Jaehoon Chung --- kernel/kdbus/pool.c | 5 +++++ kernel/zlogger/zlogger.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/kernel/kdbus/pool.c b/kernel/kdbus/pool.c index 5798153..565f9d0 100644 --- a/kernel/kdbus/pool.c +++ b/kernel/kdbus/pool.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "pool.h" #include "util.h" @@ -705,7 +706,11 @@ int kdbus_pool_mmap(const struct kdbus_pool *pool, struct vm_area_struct *vma) /* deny write access to the pool */ if (vma->vm_flags & VM_WRITE) return -EPERM; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0)) + vm_flags_clear(vma, VM_MAYWRITE); +#else vma->vm_flags &= ~VM_MAYWRITE; +#endif /* do not allow to map more than the size of the file */ if ((vma->vm_end - vma->vm_start) > pool->size) diff --git a/kernel/zlogger/zlogger.c b/kernel/zlogger/zlogger.c index 804e6f6..d78498b 100644 --- a/kernel/zlogger/zlogger.c +++ b/kernel/zlogger/zlogger.c @@ -547,7 +547,11 @@ static int zlogger_mmap(struct file *filp, struct vm_area_struct *vma) ptr->vma = vma; vma->vm_private_data = ptr; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0)) + vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP | VM_DONTCOPY); +#else vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP | VM_DONTCOPY; +#endif vma->vm_ops = &zlogger_vm_ops; page = virt_to_page((unsigned long)p); -- 2.34.1