linux-um archives
 help / color / mirror / Atom feed
From: Blaisorblade <blaisorblade@yahoo.it>
To: user-mode-linux-devel@lists.sourceforge.net
Cc: Karl Chen <quarl@cs.berkeley.edu>
Subject: Re: [uml-devel] hostfs permissions
Date: Sat, 11 Jun 2005 04:33:56 +0200	[thread overview]
Message-ID: <200506110434.03051.blaisorblade@yahoo.it> (raw)
In-Reply-To: <quack.20050610T1748.87psutn2gh@quack.cs.berkeley.edu>

On Saturday 11 June 2005 02:48, Karl Chen wrote:
> >>>>> On 2005-06-10 15:26 PDT, Blaisorblade  writes:
>
>     Blaisorblade> Ok, in this case there's probably a simpler
>     Blaisorblade> road: simply use a 2.4.27-1bs kernel. The
>     Blaisorblade> implemented behaviour is that all created files
>     Blaisorblade> will have the ID they have on the host, i.e. the
>     Blaisorblade> ID of the user running UML.
>
> Thanks for the tip!  I will be running UML under different user
> IDs but I'd rather it always be the same uid inside the UML.  I
> used this micropatch to get exactly the behavior I want. It's
> obviously for this particular experiment only; I still think
> uid,gid mount options would be better in general.  I guess that's
> only 5 or 10 more lines of code...
Yes, I just need a bit of time to implement all cases and especially option 
parsing. And I can confirm your micropatch does exactly the work you need.

> diff -u
> /home/quarl/proj/uml/linux/linux-2.4.27/arch/um/fs/hostfs/.backup/hostfs_ke
>rn.c.\~1\~
> /home/quarl/proj/uml/linux/linux-2.4.27/arch/um/fs/hostfs/hostfs_kern.c ---
> /home/quarl/proj/uml/linux/linux-2.4.27/arch/um/fs/hostfs/.backup/hostfs_ke
>rn.c.~1~	2005-06-10 16:58:51.000000000 -0700 +++
> /home/quarl/proj/uml/linux/linux-2.4.27/arch/um/fs/hostfs/hostfs_kern.c	200
>5-06-10 17:35:01.829485585 -0700 @@ -1,3 +1,6 @@
> +#define KLUDGE_FS_UID 7777
> +#define KLUDGE_FS_GID 7777
> +
>  /*
>   * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
>   * Licensed under the GPL
> @@ -142,6 +145,10 @@
>  	ino->i_blocks = i_blocks;
>  	if(kdev_same(ino->i_sb->s_dev, ROOT_DEV) && (ino->i_uid == getuid()))
>  		ino->i_uid = 0;
> +        else if (ino->i_uid == getuid()) {          /* KC KLUDGE */
> +                ino->i_uid = KLUDGE_FS_UID;         /* KC KLUDGE */
> +                ino->i_gid = KLUDGE_FS_GID;         /* KC KLUDGE */
> +        }                                           /* KC KLUDGE */
>  	return(0);
>  }
>
> @@ -760,13 +767,17 @@
>  		if(kdev_same(dentry->d_inode->i_sb->s_dev, ROOT_DEV) &&
>  		   (attr->ia_uid == 0))
>  			attr->ia_uid = getuid();
> +                else if (attr->ia_uid == KLUDGE_FS_UID) { /* KC KLUDGE */
> +                        attr->ia_uid = getuid();          /* KC KLUDGE */
> +                        attr->ia_gid = getgid();          /* KC KLUDGE */
> +                }                                         /* KC KLUDGE */
>  		attrs.ia_valid |= HOSTFS_ATTR_UID;
>  		attrs.ia_uid = attr->ia_uid;
>  	}
>  	if(attr->ia_valid & ATTR_GID){
>  		if(kdev_same(dentry->d_inode->i_sb->s_dev, ROOT_DEV) &&
>  		   (attr->ia_gid == 0))
> -			attr->ia_gid = getuid();
> +			attr->ia_gid = getgid();
>  		attrs.ia_valid |= HOSTFS_ATTR_GID;
>  		attrs.ia_gid = attr->ia_gid;
>  	}

-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
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-06-11  2:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-10  5:34 [uml-devel] hostfs permissions Karl Chen
2005-06-10 16:03 ` Blaisorblade
2005-06-10 20:14   ` Karl Chen
2005-06-10 22:26     ` Blaisorblade
2005-06-11  0:48       ` Karl Chen
2005-06-11  2:33         ` Blaisorblade [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=200506110434.03051.blaisorblade@yahoo.it \
    --to=blaisorblade@yahoo.it \
    --cc=quarl@cs.berkeley.edu \
    --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