Re: kernel thread blocked in sock_recvmsg() not kill-able

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

 



hi,

> > when the module is unloaded, the module remains blocked until a datagram
> > is received and the 'main loop' ends
> 
> 
> Have you tried allowing signals to the thread using allow_signal() (if
> you are using 2.6 based kernels)?
> 

AFAIK, this two lines are equivalent to allow_signal (and both don't
work as i need):

siginitsetinv(&current->blocked, sigmask(SIGKILL));
sigprocmask(SIG_SETMASK, &current->blocked, NULL);

allow_signal(SIGKILL);

> > what is the correct way to force the kernel thread to exit?
> >
> 
> Alternatively, you could check for signals using signal_pending() and
> do appropriate cleanups for the thread. However, then you would have
> to maintain module usage counts. sock_recvmsg return -EINTR when a
> signal is received.

in fact, there's no problem when a signal is sent with nonblocking IO
(and msleep after) and kthread exits cleanly, how signal_pending can be
executed if kthread is blocked in sock_recvmsg()?

> 
> BTW, you have not set the memory segment back to oldfs.
> 
i did it, maybe was a mistake with the file i sent...

oldfs = get_fs();
set_fs(KERNEL_DS);
size = sock_recvmsg(sock,&msg,len,0);
set_fs(oldfs);

> --
> Goldwyn :o)
> 
-- 
toni <agar9938@xxxxxxxxxxxxxxxxxx>


--
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