???????л????????????
???????????? ???????[ 2013/2/1 10:17:45 ] ????????
????????????????????????????????BUG??????????ж??????reboot???????????????????????????????????????????????????????????????????????????????????????????????????????????÷???-EINTR??????????ж???????????е??????????????????????????????????????????????????д?????????????м???????????????????????????????????????????й?????????????????????????μ???????????????л????????????????
??????????????????????????????sigpending()???????????????sys_sigpending()???????sys_sigpending()?????????????е?????????????????????????????/proc/kallsyms????????sys_sigpending()???????????????????????????????sys_sigpending()?????0xffffffff810802e0??????????????????
/*
* fcluster.c
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/signal.h>
#include <linux/spinlock.h>
#include <linux/sched.h>
#include <linux/uaccess.h>
static int remove_mod = 0;
static int my_sigpending(sigset_t *set)
{
int (*sigpending)(sigset_t *set);
int ret;
mm_segment_t old_fs;
sigpending = (typeof(sigpending))0xffffffff810802e0;
old_fs = get_fs();
set_fs(get_ds());
ret = sigpending(set);
set_fs(old_fs);
return ret;
}
static int thread_process(void *arg)
{
sigset_t *sigset?? __sigset;
sigset = &__sigset;
allow_signal(SIGURG);
allow_signal(SIGTERM);
allow_signal(SIGKILL);
allow_signal(SIGSTOP);
allow_signal(SIGCONT);
printk(KERN_ALERT "the pid of thread_process is %d.
"?? current->pid);
my_sigpending(sigset);
printk(KERN_ALERT "Before receive signal?? signal map: 0x%lX.
"?? sigset->sig[0]);
for ( ; !remove_mod; ) {
/* Avoid infinite loop */
msleep(1000);
if (signal_pending(current)) {
my_sigpending(sigset);
printk(KERN_ALERT "Received signal?? signal map: 0x%lX.
"?? sigset->sig[0]);
printk(KERN_ALERT "Receive SIGURG signal ? %s.
"??
sigismember(sigset?? SIGURG) ? "true" : "false");
printk(KERN_ALERT "Receive SIGTERM signal ? %s.
"??
sigismember(sigset?? SIGTERM) ? "true" : "false");
printk(KERN_ALERT "Receive SIGKILL signal ? %s.
"??
sigismember(sigset?? SIGKILL) ? "true" : "false");
printk(KERN_ALERT "Receive SIGSTOP signal ? %s.
"??
sigismember(sigset?? SIGSTOP) ? "true" : "false");
/* Use halt to stop the system */
printk(KERN_ALERT "Receive SIGCONT signal ? %s.
"??
sigismember(sigset?? SIGCONT) ? "true" : "false");
break;
}
}
return 0;
}
static int __init fcluster_init(void)
{
kernel_thread(thread_process?? NULL?? CLONE_FILES);
return 0;
}
static void __exit fcluster_exit(void)
{
remove_mod = 1;
msleep(2000);
}
MODULE_LICENSE("GPL");
module_init(fcluster_init);
module_exit(fcluster_exit);
?????????????????????????????????????????????е???allow_signal()??????????????Щ????my_sigpending()???sys_sigpending()??????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11