kernel_thread() causes segfault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I want to write a new syscall in which caller process would create kernel thread which shares the process address space, file descriptor table, parent pid etc.
The new kernel thread would be clone of current thread but it would never execute any userspace code.

The kernel_thread() function with following arguments would be ideal to achieve this task:
kernel_thread(some_function, some_args, CLONE_FS | CLONE_FILES | CLONE_PARENT)

In latest kernels (v3.1x), this function causes segmentation fault in the user process.
However same code works perfectly in older kernels (v2.6).

According to this link, and this code (call chain: kernel_thread -> do_fork -> copy_process -> copy_thread), it looks like only the kernel thread can spawn another kernel thread. (I tried to set PF_KTHREAD flag in current->flags before calling kernel_thread function, but the system crashed.)

Is there any clean way of creating kernel thread that shares process address space, file descriptor table, parent pid etc?


Thanks,
Shashank Khasare
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux