On Mon, 2020-04-20 at 17:51 +0000, Yiyang Su wrote: > Hello, > > Current i am using Kernel 4.14.169 and trying to add some LSM rules such as "measure subj_user=_ func=FILE_CHECK mask=MAY_READ" into ima policy, but i cannot update the policy. Same happens by updating for subj_role, subj_type, obj_user, obj_role, and obj_type. > > The issue can be produced: > ### > echo "measure subj_user=_ func=INODE_PERM mask=MAY_READ" > /sys/kernel/security/ima/policy > sh: write error: Invalid argument > IMA: policy update failed > > [ 1558.886333] audit: type=1805 audit(1587051889.726:28): action="measure" subj_user="_" res=0 > [ 1558.903324] audit: type=1802 audit(1587051889.726:29): pid=255 uid=0 auid=4294967295 ses=4294967295 op="update_policy" cause="invalid-policy" comm="sh" res=0 > [ 1558.917414] audit: type=1300 audit(1587051889.726:29): arch=40000028 syscall=4 per=800000 success=no exit=-22 a0=1 a1=aab98 a2=32 a3=0 items=0 ppid=1 pid=255 auid=4294967295 uid=0 gid=0 euid=0 suid=0 ) > [ 1558.945176] audit: type=1327 audit(1587051889.726:29): proctitle="-sh" > [ 1558.951699] audit: type=1802 audit(1587051889.736:30): pid=255 uid=0 auid=4294967295 ses=4294967295 op="policy_update" cause="failed" comm="sh" res=0 > ### > > But there is no problem to update a rule such as "measure fowner=55" > ### > echo "measure fowner=55" > /sys/kernel/security/ima/policy > IMA: policy update completed > ### > > The kernel option CONFIG_IMA_LSM_RULES=y is enabled. Perhaps the difference isn't the LSM options, but the "func=" definition? I've never seen "func=INODE_PERM". Mimi