Re: Re: daemonize and allow_signal (was: Re: Re: Re: kernel thread blocked in sock_recvmsg() not kill-able)

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

 



Hello Toni...

> yes, it works as i expected, with no need to msleep() and checking
> for signals after the sock_recvmsg() in the main loop (the function
> sock_recvmsg exits with a error code -512 after a SIGKILL):

I see, thanks for sharing your progress, Toni. I really appreciate it.

> 	oldfs = get_fs();
> 	set_fs(KERNEL_DS);
> 	size = sock_recvmsg(sock,&msg,len,msg.msg_flags);
> 	set_fs(oldfs);
>
> 	if (signal_pending(current))
> 		break;

Yeah, this reminds me to two things:
1. sock_recvmsg() usually expect data comes from user space. By using 
set_fs(), we temporarily switch to kernel data segment, thus avoiding 
access violation
2. By calling  signal_pending(), we can manually check pending signal 
wherever and whenever we want

And final conclusion is, luckily the data receiving procedure puts the 
process in interruptible state, if not, we need to do a really dirty 
hack to get out from the sleep and certainly this is not preferred at 
all.

regards

Mulyadi


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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