From: Kylene Jo Hall <kjhall@us.ibm.com>
To: Seth Arnold <seth.arnold@suse.de>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
LSM ML <linux-security-module@vger.kernel.org>,
Dave Safford <safford@us.ibm.com>, Mimi Zohar <zohar@us.ibm.com>,
Serge Hallyn <sergeh@us.ibm.com>
Subject: Re: [RFC][PATCH 4/8] SLIM main patch
Date: Tue, 22 Aug 2006 12:59:28 -0700 [thread overview]
Message-ID: <1156276769.6720.14.camel@localhost.localdomain> (raw)
In-Reply-To: <20060818182510.GS2584@suse.de>
On Fri, 2006-08-18 at 11:25 -0700, Seth Arnold wrote:
> On Fri, Aug 18, 2006 at 10:24:02AM -0700, Kylene Jo Hall wrote:
> > Thanks for your detailed review. Responses inline below.
>
> My pleasure; thanks for considering my comments.
>
> > throughout (iac vs. sac). However, on closer look I think you mean the
> > ones which are actually defined with "#define" and those will not be a
> > problem to move.
>
> Yes, sorry for the confusion; I meant the #defines. :)
>
> > > All of these booleans could be re-written to simply return the value of
> > > the boolean check. I don't know if those are actually easier to read,
> > > but someone should see them once and decide. :)
> > >
> > Let me make sure I understand. You think "return (isec && isec-
> > >level.iacl_level != SLM_IAC_NOTDEFINED);" would be easier?
>
> Yeah, I'm not a fan of if (foo) return 1 else return 0; perhaps I'm in
> the minority, but I'd feel better if the choice of these two styles were
> made consciously:
>
> static int is_isec_defined(struct slm_isec_data *isec)
> {
> if (isec && isec->level.iac_level != SLM_IAC_NOTDEFINED)
> return 1;
> return 0;
> }
>
> static int is_isec_defined(struct slm_isec_data *isec)
> {
> return isec && (isec->level.iac_level != SLM_IAC_NOTDEFINED);
> }
>
> If you find the first easier to work with, then feel free to keep it.
>
> > > > +static void revoke_mmap_wperm(struct slm_file_xattr *cur_level)
> > > > +{
> > > > + struct vm_area_struct *mpnt;
> > > > + struct file *file;
> > > > + struct dentry *dentry;
> > > > + struct slm_isec_data *isec;
> > > > +
> > > > + flush_cache_mm(current->mm);
> > >
> > > Is it a good idea to flush the cache before making the modifications?
> > > Feels like the wrong order to me.
> >
> > Our thought was that we are going to revoke write access to the file at
> > this point, bu all pending writes are still valid. So we flush to make
> > sure they can still be written (since we are revoking permission to that
> > operation).
>
> Is there any danger of another task sharing the mm structure to
> repopulate the cache before your changes are incorporated?
This isn't a problem since we are only revoking the current processes
ability to write to the mmap so we don't care if another process
continues to write. The flush is there to make sure any previous writes
by the current process (who's write access is being revoked) do actually
get written.
>
> > > slm_get_xattr() seems remarkably subtle given its name: *status can be
> > > updated at two points in the function, a positive 'rc' from
> > > integrity_verify_data() is left to return at the end, but negative 'rc'
> > > values (that aren't -EOPNOTSUPP) get returned immediately, and if an
> > > error variable is negative, a specific value is returned..
> > >
> > Yes that does look fishy. I'll try to straighten it out better.
>
> > > The complicated set of decision making in get_level() (which sets
> > > levels, heh) might be simplified if slm_get_xattr() internals were
> > > less complicated.
> >
> > Yes I'll try to straighten out too. The last review it was requested
> > that INTEGRITY status be returned from the hooks in a *int and regular
> > kernel errors returned from the function to get error propogation
> > correct but seems like we still have it over complicated.
>
> Ah, yes, separating integrity status from error returns makes sense; I
> hope the functions can be made to read as clearly as your description.
>
get_level couldn't really be changed other than the name but
slm_get_xattr has been cleaned up.
> > > > + /* Derived from include/linux/sched.h:capable. */
> > > > + if (cap_raised(tsk->cap_effective, cap)) {
> > > > + spin_lock(&tsec->lock);
> > > > + if (tsec->iac_wx == SLM_IAC_UNTRUSTED &&
> > > > + cap == CAP_SYS_ADMIN)
> > > > + rc = -EACCES;
> > >
> > > Why is CAP_SYS_ADMIN handled specially?
> > This function is here to add the ability to remove capabilities.
> > CAP_SYS_ADMIN should definitely be removed even if you are running as
> > root but have been demoted to UNTRUSTED. We are testing others but some
> > tend to break existing applications.
>
> CAP_SYS_MODULE, CAP_SYS_PTRACE, CAP_SYS_RAWIO, come to mind immediately. :)
>
All others seemed to cause problems. We'll continue testing this and
try to add to the list.
> > > > +static int slm_ptrace(struct task_struct *parent, struct task_struct *child)
> > > > +{
> > > > + struct slm_tsec_data *parent_tsec = parent->security,
> > > > + *child_tsec = child->security;
> > > > + int rc = 0;
> > > > +
> > > > + if (is_kernel_thread(parent) || is_kernel_thread(child))
> > > > + return 0;
> > >
> > > Why was this added?
> > >
> > Kernel threads are never demoted or restricted by SLIM
>
> Makes sense; but should an UNTRUSTED process really have the ability to
> ptrace a kernel thread? (Ok, on my tests I wasn't able to strace attach
> to kernel threads, but I'm not positive that it can't be done.)
Good catch only the first half of the if should be there. So that the
kernel thread can ptrace but can't be ptraced by just anyone.
>
>
> Thanks Kylene
prev parent reply other threads:[~2006-08-22 19:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-17 19:53 [RFC][PATCH 4/8] SLIM main patch Kylene Jo Hall
2006-08-18 1:15 ` Seth Arnold
2006-08-18 17:24 ` Kylene Jo Hall
2006-08-18 18:25 ` Seth Arnold
2006-08-22 19:59 ` Kylene Jo Hall [this message]
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=1156276769.6720.14.camel@localhost.localdomain \
--to=kjhall@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=safford@us.ibm.com \
--cc=sergeh@us.ibm.com \
--cc=seth.arnold@suse.de \
--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