mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kyle Moffett <mrmacman_g4@mac.com>
To: Crispin Cowan <crispin@novell.com>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>,
	Andreas Gruenbacher <agruen@suse.de>,
	James Morris <jmorris@namei.org>,
	Chris Wright <chrisw@sous-sol.org>,
	linux-security-module@vger.kernel.org,
	Andrew Morgan <agm@google.com>, Andrew Morton <akpm@google.com>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	lkml <linux-kernel@vger.kernel.org>,
	Arjan van de Ven <arjan@infradead.org>, Greg KH <greg@kroah.com>,
	Eric Paris <eparis@redhat.com>
Subject: Re: [PATCH try #2] security: Convert LSM into a static interface
Date: Tue, 26 Jun 2007 21:22:45 -0400	[thread overview]
Message-ID: <E83D42B8-F8B8-41D1-AA4A-C669EC3F37B1@mac.com> (raw)
In-Reply-To: <4681B611.1000704@novell.com>

On Jun 26, 2007, at 20:57:53, Crispin Cowan wrote:
> Kyle Moffett wrote:
>> Let's go over the differences between "my fs" and "my LSM", and  
>> the similarities between "my VM" and "my LSM":  Filesystems don't  
>> get hooked from virtually every userspace-initiated operation,  
>> whereas both VMs and LSMs do.  VMs and LSMs attach anonymous state  
>> data to a large percentage of the allocated objects in the system,  
>> whereas filesystems allocate their own independent datastructure  
>> and use that.  Would you want to "rmmod ext3" and then "modprobe  
>> ext2" while you have an ext2-as-ext3 filesystem *mounted*???  If  
>> you want a good analogy, that's a better one than the "my fs can't  
>> be a module" crap.
>>
>> This whole discussion boils down to 2 points:
>>   1) As currently implemented, no LSM may be safely rmmod-ed
>>   2) Someone has submitted a patch which fixes that problem (you  
>> can't
>> rmmod them at all, so no crashes)
>>
>> If you really want to do modular LSMs, then you need to submit a  
>> patch which fixes all the race conditions in LSM removal *without*  
>> adding much extra overhead.  I'm sure if your solutions works then  
>> everyone will be much more open to modular LSMs.
>
> Hmmm. You seem to be mostly concerned with safely rmmod'ing  
> modules. In contrast, my main concern with the proposed patch is  
> that it removes the ability to *insert* a module.

You must have missed this in my emails:
>>   2) When you "modprobe my_custom_security_module", how exactly do  
>> you expect that all the processes, files, shared memory segments,  
>> file descriptors, sockets, SYSV mutexes, packets, etc will get  
>> appropriate security pointers?  This isn't even solvable the same  
>> way the "rmmod" problem is, since most of that isn't even  
>> accessible without iterating over the ENTIRE dcache, icache, every  
>> process, every process' file-descriptors, every socket, every unix  
>> socket, every anonymous socket, every SYSV shm object, every  
>> currently-in-process packet.

I'd argue that security-module-insertion is actually MORE complicated  
than removal.  Here's one example:  TOMOYO cares about the process  
execution tree, but you can't penalize the no-LSM case by a percent  
or two to add that kind of data.  When TOMOYO is loaded, it wants to  
do access control based on process execution trees for which data  
DOES NOT EXIST!!!  Not only that, but the processes which originally  
ran the one you care about (and which you'd need to recreate that  
data) may have exited anywhere from seconds to years before.  It is  
fundamentally IMPOSSIBLE to recreate that data, even if you could  
solve the problems of how to do it while the system is running  
without racing with existing process operations.  Imagine a process  
which hasn't had security data tagged to it yet which opens thousands  
of FIFOs per second, waits for your tagging code to assign security  
data to them in the filesystem, and then removes them; if you did it  
right you could prevent the code from EVER completely tagging every  
object (even assuming you could recreate enough information).

Such a need to add extra security data to multiple classes of objects  
is *fundamental* to any security module (isn't that the whole  
point?)  As such, you can't just "modprobe" one and expect it to  
work.  That's like mounting an ext2 filesystem, and then later trying  
to "modprobe ext3" and dynamically switch to the ext3 code and enable  
journalling all at once ON THE MOUNTED FILESYSTEM!!!

Sure, theoretically it *could* be done, but the code complexity is  
hardly worth it (plus nobody has yet even tried posting patches to  
make it happen).

> Consider the use case of joe admin who is running enterprise- 
> supported RHEL or SLES, and wants to try some newfangled LSM  
> FooSecureMod thingie.  So he grabs a machine, config's selinux=0 or  
> apparmor=0 and loads his own module on boot, and plays with it. He  
> even likes FooSecure, better than SELinux or AppArmor, and wants to  
> roll it out across his data center.

Flatly impossible.  You simply cannot "load" a security module and  
hope to provide any useful information about the system's present  
state.  If you want comprehensive security it has to be there before  
a single byte of userspace code is executed.  SELinux sort-of handles  
unlabelled objects by treating them with a small set of initial  
"types", but that's only enough to get the system up enough to  
actually relabel objects with type-transitions (after init loads the  
selinux policy it reexecs itself, before doing anything else).

> So to solve the problem James & Kyle are concerned with, and  
> preserve user choice, how about we *only* remove the ability to  
> rmmod, and leave in place the ability to modprobe? Or even easier,  
> LSMs that don't want to be unloaded can just block rmmod, and  
> simple LSMs that can be unloaded safely can permit it.

An LSM simple enough to unload would be too simple for anybody to  
want to load in the first place (even capabilities can have this  
problem).  What kind of security module would you load that doesn't  
need to add security data to objects?

Then of course there's also the -ENOPATCH problem.

Cheers,
Kyle Moffett


  reply	other threads:[~2007-06-27  1:23 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070611123714.GA2063@sergelap.austin.ibm.com>
     [not found] ` <878322.98602.qm@web36606.mail.mud.yahoo.com>
     [not found]   ` <afff21250706110926l244ddc28i44289cb08a6721e2@mail.gmail.com>
     [not found]     ` <20070617135239.GA17689@sergelap>
     [not found]       ` <4676007F.7060503@kernel.org>
     [not found]         ` <20070618044017.GW3723@sequoia.sous-sol.org>
     [not found]           ` <20070620171037.GA28670@sergelap.ibm.com>
     [not found]             ` <20070620174613.GF3723@sequoia.sous-sol.org>
2007-06-21 16:00               ` implement-file-posix-capabilities.patch Serge E. Hallyn
2007-06-23  8:13                 ` implement-file-posix-capabilities.patch Andrew Morgan
2007-06-24 15:51                   ` implement-file-posix-capabilities.patch Serge E. Hallyn
2007-06-24 16:18                     ` implement-file-posix-capabilities.patch James Morris
2007-06-24 20:58                       ` [PATCH][RFC] security: Convert LSM into a static interface James Morris
2007-06-24 22:09                         ` Chris Wright
2007-06-24 22:37                           ` James Morris
2007-06-25  1:38                             ` Chris Wright
2007-06-24 23:40                           ` Casey Schaufler
2007-06-25  1:39                             ` Chris Wright
2007-06-25  3:37                               ` Casey Schaufler
2007-06-25  3:57                                 ` Chris Wright
2007-06-25 13:02                                   ` Casey Schaufler
2007-06-25 14:24                                 ` Roberto De Ioris
2007-06-25  4:33                           ` [PATCH try #2] " James Morris
2007-06-25  4:48                             ` Petr Vandrovec
2007-06-25  4:58                               ` James Morris
2007-06-25 16:59                             ` Stephen Smalley
2007-06-25 23:56                               ` [PATCH try #3] " James Morris
2007-06-25 20:37                             ` [PATCH try #2] " Andreas Gruenbacher
2007-06-25 21:14                               ` James Morris
2007-06-26  3:57                                 ` Serge E. Hallyn
2007-06-26 13:15                                   ` Adrian Bunk
2007-06-26 14:06                                     ` Serge E. Hallyn
2007-06-26 14:59                                       ` Adrian Bunk
2007-06-26 15:53                                         ` Serge E. Hallyn
2007-06-26 18:52                                           ` Adrian Bunk
2007-06-26 18:18                                       ` Greg KH
2007-06-26 18:40                                         ` Serge E. Hallyn
2007-06-26  4:09                               ` Kyle Moffett
2007-06-26  4:25                                 ` Kyle Moffett
2007-06-26 13:47                                 ` Serge E. Hallyn
2007-06-27  0:07                                   ` Kyle Moffett
2007-06-27  0:57                                     ` Crispin Cowan
2007-06-27  1:22                                       ` Kyle Moffett [this message]
2007-06-27  4:24                                       ` Chris Wright
2007-06-27 13:41                                     ` Serge E. Hallyn
2007-06-27 14:36                                       ` James Morris
2007-06-27 17:21                                         ` Serge E. Hallyn
2007-06-27 18:51                                           ` Serge E. Hallyn
2007-06-27 19:28                                             ` James Morris
2007-06-28  2:48                                               ` Serge E. Hallyn
2007-06-25  3:57                         ` [PATCH][RFC] " Serge E. Hallyn
2007-06-25  4:10                           ` Chris Wright
2007-06-25  4:54                             ` Serge E. Hallyn
2007-06-25 13:50                           ` Casey Schaufler
2007-06-25 13:54                             ` James Morris
2007-06-25 14:32                             ` Serge E. Hallyn
2007-06-25 15:08                               ` Casey Schaufler
2007-06-27  5:00                     ` implement-file-posix-capabilities.patch Andrew Morgan
2007-06-27 13:16                       ` implement-file-posix-capabilities.patch Serge E. Hallyn
2007-06-28  6:19                         ` implement-file-posix-capabilities.patch Andrew Morgan
2007-06-28 13:36                           ` implement-file-posix-capabilities.patch Serge E. Hallyn
2007-06-28 15:14                           ` implement-file-posix-capabilities.patch Casey Schaufler
2007-06-28 15:38                             ` implement-file-posix-capabilities.patch Serge E. Hallyn
2007-06-28 15:56                               ` implement-file-posix-capabilities.patch Casey Schaufler
2007-06-29  5:30                                 ` implement-file-posix-capabilities.patch Andrew Morgan
2007-06-29 13:24                                   ` implement-file-posix-capabilities.patch Serge E. Hallyn
2007-06-29 14:46                                   ` implement-file-posix-capabilities.patch Casey Schaufler
2007-06-28 15:50                             ` implement-file-posix-capabilities.patch Andrew Morgan
2007-07-02 14:38                   ` implement-file-posix-capabilities.patch Serge E. Hallyn
2007-07-04 21:29                     ` implement-file-posix-capabilities.patch Andrew Morgan
2007-07-04 23:00                       ` implement-file-posix-capabilities.patch Casey Schaufler

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=E83D42B8-F8B8-41D1-AA4A-C669EC3F37B1@mac.com \
    --to=mrmacman_g4@mac.com \
    --cc=agm@google.com \
    --cc=agruen@suse.de \
    --cc=akpm@google.com \
    --cc=arjan@infradead.org \
    --cc=chrisw@sous-sol.org \
    --cc=crispin@novell.com \
    --cc=eparis@redhat.com \
    --cc=greg@kroah.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=sds@tycho.nsa.gov \
    --cc=serue@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

all inboxes | Powered by JetHome®