Skip to content
Advertisement

BUG: unable to handle kernel paging request when accessing a custom struct in syscall

Using linux with kernel 4.4.21, I was required to implement a system call which has a custom struct’s pointer among its parameters. These are the files to to edit:

JavaScript

I put sys_procmem.c (implementation) in linux-4.4.21/kernel/sys_procmem.c (sys_procmem.o added in that dir’s Makefile):

JavaScript

Test:

JavaScript

Both were killed miserably.

dmesg:

JavaScript

This was done inside a 64-bit Ubuntu 14.04 virtual machine. My friends had no problems when they use VirtualBox or VMWare Player, mine was KVM/QEMU (although the instructor advised us to use the former two explicitly, kernel compilation was indeed faster with KVM). Does a different hypervisor have anything to do with this?

Advertisement

Answer

Thanks to the comments. I have added copy_from_user and copy_to_user.

Now it works.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement