lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070807140827.GB8286@sergelap.austin.ibm.com>
Date:	Tue, 7 Aug 2007 09:08:27 -0500
From:	"Serge E. Hallyn" <serue@...ibm.com>
To:	James Morris <jmorris@...ei.org>
Cc:	Andrew Morgan <morgan@...nel.org>,
	Chris Wright <chrisw@...s-sol.org>,
	Andrew Morgan <agm@...gle.com>, casey@...aufler-ca.com,
	Andrew Morton <akpm@...gle.com>,
	Stephen Smalley <sds@...ho.nsa.gov>,
	KaiGai Kohei <kaigai@...gai.gr.jp>,
	linux-security-module@...r.kernel.org,
	lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] file capabilities: clear fcaps on inode change (v2)

Quoting James Morris (jmorris@...ei.org):
> On Mon, 6 Aug 2007, Serge E. Hallyn wrote:
> 
> > +	err = security_inode_killpriv(out->f_path.dentry, LSM_NEED_LOCK);
> > +	if (err)
> > +		return err;
> > +
> >  	err = should_remove_suid(out->f_path.dentry);
> >  	if (unlikely(err)) {
> >  		mutex_lock(&inode->i_mutex);
> 
> It seems hackish to pass a needlock arg to an API, and that that we'll end 
> up with some conceptually similar call-outs for both caps and setuid.
> 
> How about encapsulating this stuff so that there's something like:
> 
> 
> 	err = should_remove_privs();
> 	if (err)
> 		remove_privs();
> 
> with
> 
> void remove_privs()
> {
> 	mutex_lock();
> 	__remove_privs();
> 	mutex_unlock();
> }
> 
> and then __remove_privs() handles the logic for all file privileges, 
> including at this stage suid and the LSM call for file caps ?

The problem is that the suid bit is not removed in all cases
when the file caps need to be removed.  In particular, if
capable(CAP_FSETID), then the suid bit is retained.

I suppose we could change those semantics, but then we'd the code still
doesn't flow quite right for what you suggest - should_remove_suid()
just checks whether the suid bit is set (and the process is !capable(CAP_FSETID),
not whether a change has happened requiring suid change.  That is
already assumed to be the case.

If your main objection is to the LSM_NEED_LOCK argument, we could of
course just grab the mutex around security_inode_killpriv(out->f_path.dentry)
in fs/splice.c:generic_file_splice_write().

And I suppose we can in fact get rid of ATTR_KILL_PRIV.  I had just
put it there to split up the code a bit to make it clearer - which I
do think it does.

Shall I resend without the LSM_NEED_LOCK, or do you still want a more
fundamental change?

thanks,
-serge
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ