From: Blaisorblade <blaisorblade@yahoo.it>
To: Jeff Dike <jdike@addtoit.com>,
user-mode-linux-devel@lists.sourceforge.net
Cc: Hannes Schulz <schulz@schwaar.com>
Subject: Re: [uml-devel] [PATCH] correct gid in hostfs_kern.c
Date: Mon, 7 Feb 2005 19:19:30 +0100 [thread overview]
Message-ID: <200502071919.30545.blaisorblade@yahoo.it> (raw)
In-Reply-To: <p05111b01bb962e502881@[10.96.96.13]>
On Tuesday 23 September 2003 19:20, Hannes Schulz wrote:
> I was reading hostfs_* because I wanted hostfs as rootfs (when
> launched by root).
> --- uml-2.4.22um5-orig/arch/um/fs/hostfs/hostfs_kern.c 2003-09-23
> 15:21:33.000000000 +0200
> +++ uml-2.4.22um5-hwh1/arch/um/fs/hostfs/hostfs_kern.c 2003-09-23
> 15:24:42.000000000 +0200
> @@ -766,7 +766,7 @@
> 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;
> }
I've verified that this patch has not yet been applied, neither in 2.4 nor in
2.6. I'm going to merge it into 2.6.11.
The original code does not make sense (since a given UID could not exist as a
GID) so it *must* be a typo, and not done on purpose.
I don't understand the purpose of the patched branch, however... it means that
chgrp 0 "fileName" will be executed as chgrp <group as UML is running>
fileName.
And only when running hostfs as rootfs.... well, it makes sense since when
stat()'ing a file this code is used:
if((ino->i_sb->s_dev == ROOT_DEV) && (ino->i_uid == getuid()))
ino->i_uid = 0;
i.e. if UML runs as uid 500, the host uid 500 is mapped to the guest uid 0.
This does not happen for the gids, which is to fix.
Also, these two threads deserve a look, too:
[uml-devel] [PATCH] hostfs as root (when lauched by root)
[uml-devel] [BUG 2.4.22-um5 + hostfs] file not updated upon munmap
--
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
prev parent reply other threads:[~2005-02-07 18:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-23 17:20 [uml-devel] [PATCH] correct gid in hostfs_kern.c Hannes Schulz
2005-02-07 18:19 ` 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=200502071919.30545.blaisorblade@yahoo.it \
--to=blaisorblade@yahoo.it \
--cc=jdike@addtoit.com \
--cc=schulz@schwaar.com \
--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