securityを使えば良いらしい。

LIDSを軽く調べてみたが、LIDSでは使っていないみたいなので気付かなかった。
SELinuxで使用しているのでSELinuxを調査。

SELinuxの場合には、/usr/src/linux/security/selinux/hooks.c内に

152 static int task_alloc_security(struct task_struct *task)
153 {
154 struct task_security_struct *tsec;
155
156 tsec = kzalloc(sizeof(struct task_security_struct), GFP_KERNEL);
157 if (!tsec)
158 return -ENOMEM;
159
160 tsec->task = task;
161 tsec->osid = tsec->sid = tsec->ptrace_sid = SECINITSID_UNLABELED
;
162 task->security = tsec;
163
164 return 0;
165 }

となっている。task構造体のメンバの*securityにtask_security_structをポイントする\
ポインタ tsecを入れているらしい。

task_security_struct()構造体は、
/usr/src/linux/security/selinux/include/objsec.hファイルで

29 struct task_security_struct {
30 struct task_struct *task; /* back pointer to task object */
31 u32 osid; /* SID prior to last execve */
32 u32 sid; /* current SID */
33 u32 exec_sid; /* exec SID */
34 u32 create_sid; /* fscreate SID */
35 u32 ptrace_sid; /* SID of ptrace parent */
36 };

で定義している。この辺のスキームを真似れば良いらしい。プロセス毎の独自ケーパビリティを
どう保持させるかを考えていた所なので、非常に参考になる。