All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Timothy R. Chavez" <tinytim@us.ibm.com>
To: SE-Linux <selinux@tycho.nsa.gov>
Cc: Linux Audit Discussion <linux-audit@redhat.com>
Subject: Best method for obtaining the 'sid' of a task?
Date: Fri, 27 Jan 2006 13:38:44 -0600	[thread overview]
Message-ID: <1138390724.7916.21.camel@localhost> (raw)

Hello,

The audit subsystem would like to collect and record security label
information on a user process emitting audit messages.  Due to the
asynchronous nature of netlink, the kernel cannot rely on the pid sent
in the kernel-bound netlink packet because the pid may have already been
recycled and the information recorded to the audit log, incorrect.
Furthermore, we're not permitted to package the security label with the
kernel-bound message itself due to the potential of spoofing.  Thus, the
solution seems to be similar to that of login uid, where we package the
sid with the kernel-bound netlink packet at time of delivery when we
know we have the right process (because we are running as that process).
This guarantees that the sid cannot be spoofed and that we're in fact
sending the correct sid.  Once the kernel receives this packet, it can
then resolve the sid to the correct security label.  One of the pitfalls
of this approach may be that the sid disappears because policy is
reloaded while the packet is in transit.  Is this correct?  I think, in
terms of an IT security evaluation, we can make the assumption that this
won't be done.  Aside from this concern, the question I have is this:

"What is the best way to do this?"

Because I am not exposed to: task_security_struct in net/af_netlink.c, I
cannot simply do a:

if (current->security)
	NETLINK_CB(skb).selinux_sid = current->security->sid;

So I did a little digging and I thought perhaps the security hook,
selinux_getprocattr(), could be modified such that I can pass into it
&NETLINK_CB(skb).selinux_sid and obtain the 'sid' in addition to the
context since we're already obtaining the sid there.  The disadvantage I
see here, is that it changes the interface.  I'm not sure how sensitive
people are to this.  Are there any alternative (possibly better)
suggestions?

Thanks.

-tim


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

             reply	other threads:[~2006-01-27 19:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-27 19:38 Timothy R. Chavez [this message]
2006-01-27 20:23 ` Best method for obtaining the 'sid' of a task? Stephen Smalley

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=1138390724.7916.21.camel@localhost \
    --to=tinytim@us.ibm.com \
    --cc=linux-audit@redhat.com \
    --cc=selinux@tycho.nsa.gov \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.