■
解析日記になってきたので分かりやすさのため「SELinux解析」トピックを作る。
最近思うのは,アクセスベクタの意味を調べる場合,
ソース解析にミスがある可能性があるので,
本当は,検証コードを書かなければと思う。
#またはSmalley氏に聞くのが一番早そうだけど…
オブジェクトクラスfdの解析
fdについては「use」が定義されているだけ。
チェックされてる場所
●その1 親プロセス(ドメイン異なる)からFile Descriptorを継承 static inline int file_has_perm(struct task_struct *tsk, 1011 struct file *file, 1012 u32 av) … 1026 if (tsec->sid != fsec->sid) { 1027 rc = avc_has_perm(tsec->sid, fsec->sid, 1028 SECCLASS_FD, 1029 FD__USE, 1030 &ad); ●その2(UNIXドメインソケットでfdを受信) 2602 static int selinux_file_receive(struct file *file) 2603 { 2604 return file_has_perm(current, file, file_to_av(file)); 2605 } ●その3 ioctlでファイルディスクリプタの属性変更 2374 static int selinux_file_ioctl(struct file *file, unsigned int cmd, 2375 unsigned long arg) 2376 { 2377 int error = 0; 2378 2379 switch (cmd) { … 2401 case FIOASYNC: 2402 error = file_has_perm(current, file, 0); 2403 break; ●その4 fcntlでファイルディスクリプタの属性変更 2523 static int selinux_file_fcntl(struct file *file, unsigned int cmd, 2524 unsigned long arg) 2525 { 2526 int err = 0; 2527 2528 switch (cmd) { … 2539 /* fall through */ 2540 case F_SETOWN: 2541 case F_SETSIG: 2542 case F_GETFL: 2543 case F_GETOWN: 2544 case F_GETSIG: 2545 /* Just check FD__USE permission */ 2546 err = file_has_perm(current, file, 0); 2547 break;