diff --git a/kerneldriver/core/response_unit/secDetector_ringbuffer.c b/kerneldriver/core/response_unit/secDetector_ringbuffer.c index b367d74f9de02fd49dea524929a2ac56979ea470..430e07c3a0f3b309f37fa20f617cb5710b45ab0c 100644 --- a/kerneldriver/core/response_unit/secDetector_ringbuffer.c +++ b/kerneldriver/core/response_unit/secDetector_ringbuffer.c @@ -17,6 +17,7 @@ #include #include #include +#include static unsigned long rb_datasz; static unsigned long rb_mask; @@ -287,7 +288,11 @@ static int ringbuffer_mmap(struct file *flip, struct vm_area_struct *vma) vma->vm_end - vma->vm_start != PAGE_SIZE) return -EPERM; } else { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) + vm_flags_clear(vma, VM_MAYWRITE); +#else vma->vm_flags &= ~VM_MAYWRITE; +#endif } /* remap_vmalloc_range() checks size and offset */ return remap_vmalloc_range(vma, g_rb, vma->vm_pgoff + RINGBUF_PGOFF); @@ -366,8 +371,11 @@ int __init secDetector_ringbuf_dev_init(unsigned int rb_sz) ret = major; goto error_free; } - +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) + class = class_create(MODULE_DEVICE); +#else class = class_create(THIS_MODULE, MODULE_DEVICE); +#endif if (IS_ERR(class)) { ret = PTR_ERR(class); goto error_class_create;