All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Morris <jmorris@namei.org>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Josef Bacik <jbacik@redhat.com>,
	Valdis.Kletnieks@vt.edu, sct@redhat.com, jack@suse.cz,
	linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org,
	eparis@redhat.com
Subject: Re: 2.6.25-rc8-mm1 - BUG in fs/jbd/transaction.c
Date: Mon, 7 Apr 2008 09:54:27 +1000 (EST)	[thread overview]
Message-ID: <Xine.LNX.4.64.0804070953550.4346@us.intercode.com.au> (raw)
In-Reply-To: <1207313165.27710.337.camel@moss-spartans.epoch.ncsc.mil>

On Fri, 4 Apr 2008, Stephen Smalley wrote:

> 
> On Fri, 2008-04-04 at 10:02 +1100, James Morris wrote:
> > On Thu, 3 Apr 2008, Stephen Smalley wrote:
> > 
> > > > > Try this patch, it will keep us from re-entering the fs when we aren't supposed
> > > > > to.  cc'ing Eric Paris since he's the only selinux guy I know :).  I don't think
> > 
> > Please see the MAINTAINERS file.
> > 
> > > > > any of the other allocations in here need to be fixed, but I didn't look too
> > > > > carefully.
> > > > > 
> > > > > Signed-off-by: Josef Bacik <jbacik@redhat.com>
> > 
> > Thanks, I'll push this to Linus, but note that further analysis is 
> > required.
> 
> Please review.

Looks good to me.

> 
> More cases where SELinux must not re-enter the fs code.
> Called from the d_instantiate security hook.
> 
> Signed-off-by:  Stephen Smalley <sds@tycho.nsa.gov>
> 
> ---
> 
>  security/selinux/hooks.c            |    7 ++++---
>  security/selinux/include/security.h |    3 ++-
>  security/selinux/ss/services.c      |   12 +++++++-----
>  3 files changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 41a049f..95b51b6 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -1143,7 +1143,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
>  		}
>  
>  		len = INITCONTEXTLEN;
> -		context = kmalloc(len, GFP_KERNEL);
> +		context = kmalloc(len, GFP_NOFS);
>  		if (!context) {
>  			rc = -ENOMEM;
>  			dput(dentry);
> @@ -1161,7 +1161,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
>  			}
>  			kfree(context);
>  			len = rc;
> -			context = kmalloc(len, GFP_KERNEL);
> +			context = kmalloc(len, GFP_NOFS);
>  			if (!context) {
>  				rc = -ENOMEM;
>  				dput(dentry);
> @@ -1185,7 +1185,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
>  			rc = 0;
>  		} else {
>  			rc = security_context_to_sid_default(context, rc, &sid,
> -			                                     sbsec->def_sid);
> +							     sbsec->def_sid,
> +							     GFP_NOFS);
>  			if (rc) {
>  				printk(KERN_WARNING "%s:  context_to_sid(%s) "
>  				       "returned %d for dev=%s ino=%ld\n",
> diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h
> index f7d2f03..44e12ec 100644
> --- a/security/selinux/include/security.h
> +++ b/security/selinux/include/security.h
> @@ -86,7 +86,8 @@ int security_sid_to_context(u32 sid, char **scontext,
>  int security_context_to_sid(char *scontext, u32 scontext_len,
>  	u32 *out_sid);
>  
> -int security_context_to_sid_default(char *scontext, u32 scontext_len, u32 *out_sid, u32 def_sid);
> +int security_context_to_sid_default(char *scontext, u32 scontext_len,
> +				    u32 *out_sid, u32 def_sid, gfp_t gfp_flags);
>  
>  int security_get_user_sids(u32 callsid, char *username,
>  			   u32 **sids, u32 *nel);
> diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
> index f374186..3f2bad2 100644
> --- a/security/selinux/ss/services.c
> +++ b/security/selinux/ss/services.c
> @@ -680,7 +680,8 @@ out:
>  
>  }
>  
> -static int security_context_to_sid_core(char *scontext, u32 scontext_len, u32 *sid, u32 def_sid)
> +static int security_context_to_sid_core(char *scontext, u32 scontext_len,
> +					u32 *sid, u32 def_sid, gfp_t gfp_flags)
>  {
>  	char *scontext2;
>  	struct context context;
> @@ -709,7 +710,7 @@ static int security_context_to_sid_core(char *scontext, u32 scontext_len, u32 *s
>  	   null suffix to the copy to avoid problems with the existing
>  	   attr package, which doesn't view the null terminator as part
>  	   of the attribute value. */
> -	scontext2 = kmalloc(scontext_len+1,GFP_KERNEL);
> +	scontext2 = kmalloc(scontext_len+1, gfp_flags);
>  	if (!scontext2) {
>  		rc = -ENOMEM;
>  		goto out;
> @@ -809,7 +810,7 @@ out:
>  int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid)
>  {
>  	return security_context_to_sid_core(scontext, scontext_len,
> -	                                    sid, SECSID_NULL);
> +					    sid, SECSID_NULL, GFP_KERNEL);
>  }
>  
>  /**
> @@ -829,10 +830,11 @@ int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid)
>   * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient
>   * memory is available, or 0 on success.
>   */
> -int security_context_to_sid_default(char *scontext, u32 scontext_len, u32 *sid, u32 def_sid)
> +int security_context_to_sid_default(char *scontext, u32 scontext_len, u32 *sid,
> +				    u32 def_sid, gfp_t gfp_flags)
>  {
>  	return security_context_to_sid_core(scontext, scontext_len,
> -	                                    sid, def_sid);
> +					    sid, def_sid, gfp_flags);
>  }
>  
>  static int compute_sid_handle_invalid_context(
> 
> 

-- 
James Morris
<jmorris@namei.org>

  reply	other threads:[~2008-04-06 23:56 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-02  4:32 2.6.25-rc8-mm1 Andrew Morton
2008-04-02  5:40 ` 2.6.25-rc8-mm1 Dmitri Vorobiev
2008-04-02  6:03   ` 2.6.25-rc8-mm1 Andrew Morton
2008-04-02 17:33     ` 2.6.25-rc8-mm1 (mips build failure) Christoph Lameter
2008-04-02 18:29       ` Andrew Morton
2008-04-02 18:33         ` Christoph Lameter
2008-04-02 19:06           ` Sam Ravnborg
2008-04-03 16:02             ` Ralf Baechle
2008-04-03 22:17               ` Christoph Lameter
2008-04-03 23:26                 ` Dmitri Vorobiev
2008-04-04 10:24                 ` Ralf Baechle
2008-04-04 17:36                   ` Christoph Lameter
2008-04-04 17:50                     ` Christoph Lameter
2008-04-02  6:04 ` 2.6.25-rc8-mm1 Valdis.Kletnieks
2008-04-02  6:15   ` 2.6.25-rc8-mm1 Andrew Morton
2008-04-02  6:25 ` [BUG] 2.6.25-rc8-mm1 kernel panic while bootup on powerpc Kamalesh Babulal
2008-04-02  6:25   ` Kamalesh Babulal
2008-04-02  6:39   ` Andrew Morton
2008-04-02  6:39     ` Andrew Morton
2008-04-02  7:08     ` Kamalesh Babulal
2008-04-02  7:08       ` Kamalesh Babulal
2008-04-02  7:17       ` Michael Ellerman
2008-04-02  7:17         ` Michael Ellerman
2008-04-02 17:09         ` Kamalesh Babulal
2008-04-02 17:09           ` Kamalesh Babulal
2008-04-02 18:15           ` Badari Pulavarty
2008-04-02 18:15             ` Badari Pulavarty
2008-04-02 19:22         ` Badari Pulavarty
2008-04-02 19:22           ` Badari Pulavarty
2008-04-02 21:57           ` Yinghai Lu
2008-04-02 21:57             ` Yinghai Lu
2008-04-02 22:24           ` Yinghai Lu
2008-04-02 22:24             ` Yinghai Lu
2008-04-04  9:24     ` Andy Whitcroft
2008-04-04  9:24       ` Andy Whitcroft
2008-04-02  9:02 ` [BUILD_FAILURE] 2.6.25-rc8-mm1 build failure on x86_64 with randconfig Kamalesh Babulal
2008-04-02 10:49 ` 2.6.25-rc8-mm1 Miles Lane
2008-04-02 11:08   ` 2.6.25-rc8-mm1 Valdis.Kletnieks
2008-04-02 16:58   ` 2.6.25-rc8-mm1 Chatre, Reinette
2008-04-02 19:15     ` 2.6.25-rc8-mm1 Valdis.Kletnieks
2008-04-02 16:20 ` 2.6.25-rc8-mm1 sparc64 build problem: size of array 'type name' is negative Mariusz Kozlowski
2008-04-02 16:20   ` Mariusz Kozlowski
2008-04-02 16:30   ` 2.6.25-rc8-mm1 sparc64 build problem: size of array 'type name' Andrew Morton
2008-04-02 16:30     ` 2.6.25-rc8-mm1 sparc64 build problem: size of array 'type name' is negative Andrew Morton
2008-04-02 19:12 ` 2.6.25-rc8-mm1 - BUG in fs/jbd/transaction.c Valdis.Kletnieks
2008-04-02 19:27   ` Josef Bacik
2008-04-02 19:39     ` Andrew Morton
2008-04-02 19:41       ` Josef Bacik
2008-04-03 18:18       ` Stephen Smalley
2008-04-03 23:02         ` James Morris
2008-04-04 12:46           ` Stephen Smalley
2008-04-06 23:54             ` James Morris [this message]
2008-04-04 10:15         ` Jan Kara
2008-04-04 12:53           ` 2.6.25-rc8-mm1 - BUG in fs/jbd/transaction.c' Josef Bacik
2008-04-03 18:25     ` 2.6.25-rc8-mm1 - BUG in fs/jbd/transaction.c Stephen Smalley
2008-04-02 19:30   ` Andrew Morton
2008-04-03  8:57     ` Jan Kara
2008-04-03 12:11 ` 2.6.25-rc8-mm1 Dave Airlie
2008-04-03 16:59   ` 2.6.25-rc8-mm1 Andrew Morton
2008-04-03 23:08 ` 2.6.25-rc8-mm1: Intel SATA boot failure Tilman Schmidt
2008-04-03 23:17   ` Andrew Morton
2008-04-09 14:29     ` Tilman Schmidt
2008-04-14  0:28     ` Tilman Schmidt
2008-04-14  2:05       ` Andrew Morton
2008-04-15 23:33       ` Tilman Schmidt
2008-04-04 20:16 ` usb unbind/bind => WARNING at fs/sysfs/dir.c [Was: 2.6.25-rc8-mm1] Jiri Slaby
2008-04-04 20:51   ` Greg KH
2008-04-04 21:23     ` Alan Stern
2008-04-05  3:46       ` Alan Stern
2008-04-05  4:37         ` Greg KH
2008-04-05 14:16           ` Alan Stern
2008-04-05  8:17         ` Jiri Slaby
2008-04-07  6:21 ` 2.6.25-rc8-mm1 - BUG: scheduling while atomic: swapper/0/0xffffffff Valdis.Kletnieks
2008-04-07  6:48   ` Andrew Morton

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=Xine.LNX.4.64.0804070953550.4346@us.intercode.com.au \
    --to=jmorris@namei.org \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=eparis@redhat.com \
    --cc=jack@suse.cz \
    --cc=jbacik@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sct@redhat.com \
    --cc=sds@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.