How to move pointer allocated in kernel space to user space.
Hi am new to kernel programming and I am trying to write a system call in linux that get information from the kernel and send the information to user space program in a struct.
My function prototype is : long sys_get_info(struct info *info); My struct has : Code:
struct info { My question is can I kmalloc a char pointer to store the root_path and then assign that to the value of my struct and access it in user space? |
It would be used by haxors to exhaust kernel-memory.
Instead ask the caller to provide space. Code:
int sys_get_info (void *buff, size_t bufsize, size_t *retsize); |
I am not allowed to change the function prototype is there another way to do it???
|
Ok I changed my struct to :
Code:
struct info { After running my syscall test in a c program and running dmesg to see if it printed the root_path kernel side, it did print it. But in user program root_path disappeared as when I execute the program it prints nothing. Can somebody please help me I dont know what I am doing wrong. |
All times are GMT -5. The time now is 01:49 AM. |