On 8/11/05, Vincenzo Mallozzi <vinjunior@xxxxxxxx> wrote: > Hi, > I've another problem with my kernel module. > I want to stop the threads I'm monitoring when they are going to terminate > their execution in order to can restore them to a previous state. > To do this, I've substituted the function related with the sys_exit system > call with the following one: > > static asmlinkage int cmc_sys_exit(int error_code) > { > if (current is one of the thread I'm monitoring){ > send_sig(SIGSTOP,current,1); > > return 0; > } > > > > return original_sys_exit(error_code); > } > > where original_sys_exit is the pointer to the original function. > > After the executing of this function, things seems to go well, as all threads > stop the execution and do not terminate; but when they are resumed to a > previous state, sometimes not all threads restart the execution (someone > terminate) or can happen that all restart their execution from the previous > state but when they re-terminate their execution they not stop (as in the > first execution), they segfault and exit. I am not very sure, but actually functions like _exit etc are declared using the GCC attribute "noreturn". Even if you are using different functions, there is a good chance that this attribute might be set. >From unistd.h extern void _exit (int __status) __attribute__ ((__noreturn__)); noreturn attribute *may* not restore the registers saved by the calling function (as part of the optimization). This can possibly explain the segmentation violations etc. > What goes wrong? > > Thanks. > Vincenzo Mallozzi. > > > > > > ___________________________________ > Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB > http://mail.yahoo.it > > > -- > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > > -- The difference between Theory and Practice is more so in Practice than in Theory. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/