Sending siginfo from kernel to user space

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

 



I am sending a signal from kernel space to user space with Linux 2.4.20-8.  



In user space, I have installed a signal handler:


    saio.sa_handler = signal_handler_IO;

    sigemptyset(&saio.sa_mask);

    saio.sa_flags = SA_SIGINFO;

    saio.sa_restorer = NULL;

    sigaction(SA_SIGINFO, &saio, NULL);



In kernel space:


    info.si_errno = 1212;

    info.si_code  = SI_KERNEL;

    send_sig_info(SA_SIGINFO, &info, find_task_by_pid(pid));



This results in the signal handler, 


    void signal_handler_IO (int status, struct siginfo *info, void *p) 


being called in user space, which gives the following values in info:


    info->si_signo = 4  /* corresponds to SA_SIGINFO */

    info->si_errno = 0  /* expect 1212               */

    info->si_code  = 0  /* expect SI_KERNEL (128)    */ 

 


Note that the values I put in si_errno and si_code do not get passed to the 
user.  si_signo has the correct value, but the user can know this from the 
original sigaction call.



If instead, I call send_sig_info(SA_SIGINFO, (struct siginfo*)0, 
find_task_by_pid(pid)), as expected I get:


    info->si_signo = 4  

    info->si_errno = 0

    info->si_code  = 0  /* corresponds to SI_USER, as expected */



If I call send_sig_info(SA_SIGINFO, (struct siginfo*)1, 
find_task_by_pid(pid)), as expected I get:


    info->si_signo = 4  

    info->si_errno = 0

    info->si_code  = 128    /* corresponds to SI_KERNEL, as expected */



Apparently, there is a problem copying the info structure.  I need to pass 
info to the kernel.  Any ideas?



Thank you.



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