linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: blaisorblade@yahoo.it
Cc: torvalds@osdl.org, akpm@osdl.org, jdike@addtoit.com,
	linux-kernel@vger.kernel.org,
	user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] Re: [patch 6/8] uml: fix hostfs special perm handling [for 2.6.12]
Date: Wed, 30 Mar 2005 15:59:34 -0500	[thread overview]
Message-ID: <200503301559.34350.rob@landley.net> (raw)
In-Reply-To: <20050330173400.36A5FEFEFF@zion>

On Wednesday 30 March 2005 12:34 pm, blaisorblade@yahoo.it wrote:
> From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
> CC: Rob Landley <rob@landley.net>
> When opening devices nodes on hostfs, it does not make sense to call
> access(), since we are not going to open the file on the host.
>
> If the device node is owned by root, the root user in UML should succeed in
> opening it, even if UML won't be able to open the file.
>
> As reported by Rob Landley, UML currently does not follow this, so here's
> an (untested) fix.
>
> Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

Not untested, it Worked For Me (tm).

Signed-off-by: Rob Landley <rob@landley.net>

> ---
>
>  linux-2.6.11-paolo/fs/hostfs/hostfs_kern.c |   20 +++++++++++++-------
>  1 files changed, 13 insertions(+), 7 deletions(-)
>
> diff -puN fs/hostfs/hostfs_kern.c~uml-fix-hostfs-special-perm-handling
> fs/hostfs/hostfs_kern.c ---
> linux-2.6.11/fs/hostfs/hostfs_kern.c~uml-fix-hostfs-special-perm-handling	2
>005-03-22 20:10:07.000000000 +0100 +++
> linux-2.6.11-paolo/fs/hostfs/hostfs_kern.c	2005-03-22 20:12:45.000000000
> +0100 @@ -806,15 +806,21 @@ int hostfs_permission(struct inode *ino,
>  	char *name;
>  	int r = 0, w = 0, x = 0, err;
>
> -	if(desired & MAY_READ) r = 1;
> -	if(desired & MAY_WRITE) w = 1;
> -	if(desired & MAY_EXEC) x = 1;
> +	if (desired & MAY_READ) r = 1;
> +	if (desired & MAY_WRITE) w = 1;
> +	if (desired & MAY_EXEC) x = 1;
>  	name = inode_name(ino, 0);
> -	if(name == NULL) return(-ENOMEM);
> -	err = access_file(name, r, w, x);
> +	if (name == NULL) return(-ENOMEM);
> +
> +	if (S_ISCHR(ino->i_mode) || S_ISBLK(ino->i_mode) ||
> +			S_ISFIFO(ino->i_mode) || S_ISSOCK(ino->i_mode))
> +		err = 0;
> +	else
> +		err = access_file(name, r, w, x);
>  	kfree(name);
> -	if(!err) err = generic_permission(ino, desired, NULL);
> -	return(err);
> +	if(!err)
> +		err = generic_permission(ino, desired, NULL);
> +	return err;
>  }
>
>  int hostfs_setattr(struct dentry *dentry, struct iattr *attr)
> _


-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/info/Sentarus/hamr30
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

      reply	other threads:[~2005-03-30 22:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-30 17:34 [uml-devel] [patch 6/8] uml: fix hostfs special perm handling [for 2.6.12] blaisorblade
2005-03-30 20:59 ` Rob Landley [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=200503301559.34350.rob@landley.net \
    --to=rob@landley.net \
    --cc=akpm@osdl.org \
    --cc=blaisorblade@yahoo.it \
    --cc=jdike@addtoit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).