c - Call do_fork inside kernel -
for experimental purposes need create child kernel process without shared memory. know, kthread_create , kernel_thread routines call do_fork clone_vm. need call do_fork without clone_vm
i have found in arch/x86_64/kernel/process.c(x86_64 suitable architecture experiment):
asmlinkage long sys_fork(struct pt_regs *regs) { return do_fork(sigchld, regs->rsp, regs, 0, null, null); }
i think, should call do_fork(sigchld, regs->rsp, regs, 0, null, null). can't understand how setup pt_regs structure. want setup structure based on registers of current process. there function fill pt_regs based on current process? or maybe there different way how create process own memory inside kernel?
kernel's address space always shared between processes. clone_vm
flag affects on user address space sharing.
so, if need kernel process, use kthread_create
. thread, created functions, allowed use kernel address space.
Comments
Post a Comment