如何从内核模块中标记进程?

huangapple go评论52阅读模式
英文:

How can I flag a process from a kernel module?

问题

我有一个内核模块(用C编写),它正在工作,并希望实现以下功能:

  1. 接受用户输入的进程号
  2. 将该进程标记为SIGNAL_UNKILLABLE,就像Linux源代码中所示

    #define SIGNAL_UNKILLABLE 0x00000040 /* for init: ignore fatal signals */

我已经在C中创建了一个内核模块并在网上搜索,但没有有效的结果。

英文:

I have a kernel module(in c), which is working and would like to:

  1. accept input from a user for a process number
  2. mark that process as SIGNAL_UNKILLABLE as in the linux source code
    > #define SIGNAL_UNKILLABLE 0x00000040 /* for init: ignore fatal signals */

I created a kernel module in c and searched online, but no working results.

答案1

得分: 0

"How can I flag a process from a kernel module?

Looking at https://elixir.bootlin.com/linux/v6.0.19/A/ident/SIGNAL_UNKILLABLE, should be super normally.

struct task_struct *t = find_task_by_vpid(thepid);
t->signal->flags |= SIGNAL_UNKILLABLE;"

英文:

> How can I flag a process from a kernel module?

Looking at https://elixir.bootlin.com/linux/v6.0.19/A/ident/SIGNAL_UNKILLABLE, should be super normally.

struct task_struct *t = find_task_by_vpid(thepid);
t->signal->flags |= SIGNAL_UNKILLABLE;

huangapple
  • 本文由 发表于 2023年5月7日 21:34:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76194248.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定