linux/security/integrity/ima
Mimi Zohar 867c202654 ima: fix add LSM rule bug
If security_filter_rule_init() doesn't return a rule, then not everything
is as fine as the return code implies.

This bug only occurs when the LSM (eg. SELinux) is disabled at runtime.

Adding an empty LSM rule causes ima_match_rules() to always succeed,
ignoring any remaining rules.

 default IMA TCB policy:
  # PROC_SUPER_MAGIC
  dont_measure fsmagic=0x9fa0
  # SYSFS_MAGIC
  dont_measure fsmagic=0x62656572
  # DEBUGFS_MAGIC
  dont_measure fsmagic=0x64626720
  # TMPFS_MAGIC
  dont_measure fsmagic=0x01021994
  # SECURITYFS_MAGIC
  dont_measure fsmagic=0x73636673

  < LSM specific rule >
  dont_measure obj_type=var_log_t

  measure func=BPRM_CHECK
  measure func=FILE_MMAP mask=MAY_EXEC
  measure func=FILE_CHECK mask=MAY_READ uid=0

Thus without the patch, with the boot parameters 'tcb selinux=0', adding
the above 'dont_measure obj_type=var_log_t' rule to the default IMA TCB
measurement policy, would result in nothing being measured.  The patch
prevents the default TCB policy from being replaced.

Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Cc: James Morris <jmorris@namei.org>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Cc: David Safford <safford@watson.ibm.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-01-03 16:36:33 -08:00
..
ima.h IMA: drop refcnt from ima_iint_cache since it isn't needed 2010-10-26 11:37:19 -07:00
ima_api.c IMA: move read counter into struct inode 2010-10-26 11:37:18 -07:00
ima_audit.c Merge branch 'master' into next 2010-05-06 10:56:07 +10:00
ima_crypto.c Merge branch 'master' into next 2010-05-06 10:56:07 +10:00
ima_fs.c ima: use generic_file_llseek for securityfs 2010-08-02 15:34:58 +10:00
ima_iint.c IMA: explicit IMA i_flag to remove global lock on inode_delete 2010-10-26 11:37:19 -07:00
ima_init.c Merge branch 'master' into next 2010-05-06 10:56:07 +10:00
ima_main.c IMA: fix the ToMToU logic 2010-10-26 11:37:19 -07:00
ima_policy.c ima: fix add LSM rule bug 2011-01-03 16:36:33 -08:00
ima_queue.c Merge branch 'master' into next 2010-05-06 10:56:07 +10:00
Kconfig ima: remove ACPI dependency 2010-05-17 09:21:58 +10:00
Makefile integrity: IMA display 2009-02-06 09:05:31 +11:00