public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Mimi Zohar <zohar@us.ibm.com>, James Morris <jmorris@namei.org>,
	Serge Hallyn <serge.hallyn@canonical.com>,
	David Safford <safford@watson.ibm.com>
Subject: [44/49] ima: fix add LSM rule bug
Date: Wed, 05 Jan 2011 15:01:02 -0800	[thread overview]
Message-ID: <20110105230327.885615410@clark.site> (raw)
In-Reply-To: <20110105234415.GA22369@kroah.com>

2.6.32-longterm review patch.  If anyone has any objections, please let us know.

------------------

From: Mimi Zohar <zohar@linux.vnet.ibm.com>

commit 867c20265459d30a01b021a9c1e81fb4c5832aa9 upstream.

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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 security/integrity/ima/ima_policy.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -249,6 +249,8 @@ static int ima_lsm_rule_init(struct ima_
 	result = security_filter_rule_init(entry->lsm[lsm_rule].type,
 					   Audit_equal, args,
 					   &entry->lsm[lsm_rule].rule);
+	if (!entry->lsm[lsm_rule].rule)
+		return -EINVAL;
 	return result;
 }
 



  parent reply	other threads:[~2011-01-05 23:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-05 23:44 [00/49] 2.6.32.28-longterm review (try 2) Greg KH
2011-01-05 23:00 ` [33/49] [SCSI] bfa: fix system crash when reading sysfs fc_host statistics Greg KH
2011-01-05 23:00 ` [34/49] igb: only use vlan_gro_receive if vlans are registered Greg KH
2011-01-26 22:37   ` Alexander Duyck
2011-01-05 23:00 ` [35/49] net: release dst entry while cache-hot for GSO case too Greg KH
2011-01-05 23:00 ` [36/49] install_special_mapping skips security_file_mmap check Greg KH
2011-01-05 23:00 ` [37/49] USB: misc: uss720.c: add another vendor/product ID Greg KH
2011-01-05 23:00 ` [38/49] USB: ftdi_sio: Add D.O.Tec PID Greg KH
2011-01-05 23:00 ` [39/49] USB: usb-storage: unusual_devs entry for the Samsung YP-CP3 Greg KH
2011-01-05 23:00 ` [40/49] p54usb: add 5 more USBIDs Greg KH
2011-01-05 23:00 ` [41/49] p54usb: New USB ID for Gemtek WUBI-100GW Greg KH
2011-01-05 23:01 ` [42/49] sound: Prevent buffer overflow in OSS load_mixer_volumes Greg KH
2011-01-05 23:01 ` [43/49] mv_xor: fix race in tasklet function Greg KH
2011-01-05 23:01 ` Greg KH [this message]
2011-01-05 23:01 ` [45/49] ALSA: hda: Use LPIB for Dell Latitude 131L Greg KH
2011-01-05 23:01 ` [46/49] ALSA: hda: Use LPIB quirk for Dell Inspiron m101z/1120 Greg KH
2011-01-05 23:01 ` [47/49] block: Deprecate QUEUE_FLAG_CLUSTER and use queue_limits instead Greg KH
2011-01-05 23:01 ` [48/49] sctp: Fix a race between ICMP protocol unreachable and connect() Greg KH
2011-01-05 23:01 ` [49/49] posix-cpu-timers: workaround to suppress the problems with mt exec Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110105230327.885615410@clark.site \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=safford@watson.ibm.com \
    --cc=serge.hallyn@canonical.com \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=zohar@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox