* [uml-devel] [PATCH] correct gid in hostfs_kern.c
@ 2003-09-23 17:20 Hannes Schulz
2005-02-07 18:19 ` Blaisorblade
0 siblings, 1 reply; 2+ messages in thread
From: Hannes Schulz @ 2003-09-23 17:20 UTC (permalink / raw)
To: user-mode-linux-devel; +Cc: jdike
I was reading hostfs_* because I wanted hostfs as rootfs (when
launched by root).
Regards
Hannes
--- 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;
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [uml-devel] [PATCH] correct gid in hostfs_kern.c
2003-09-23 17:20 [uml-devel] [PATCH] correct gid in hostfs_kern.c Hannes Schulz
@ 2005-02-07 18:19 ` Blaisorblade
0 siblings, 0 replies; 2+ messages in thread
From: Blaisorblade @ 2005-02-07 18:19 UTC (permalink / raw)
To: Jeff Dike, user-mode-linux-devel; +Cc: Hannes Schulz
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-02-07 18:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-23 17:20 [uml-devel] [PATCH] correct gid in hostfs_kern.c Hannes Schulz
2005-02-07 18:19 ` Blaisorblade
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox