* [uml-devel] hostfs permissions
@ 2005-06-10 5:34 Karl Chen
2005-06-10 16:03 ` Blaisorblade
0 siblings, 1 reply; 6+ messages in thread
From: Karl Chen @ 2005-06-10 5:34 UTC (permalink / raw)
To: user-mode-linux-devel
Hi, I'm doing some large-scale security experiments on Debian
security. I'm using UML to do the whole thing on a cluster.
Hostfs seems to make everything owned by root -- even files
created by non-root users. I'm currently using 2.4.26-3 (Debian
package). I found a few posts via Google mentioning a patch to
fix this, but no other information. What is the modified behavior
of hostfs permissions? Has this been integrated into a newer
version, or is it in cvs, or if not, are there plans to?
[I think the ideal behavior, if UML is running as non-root, would
be if there were a temporary mapping of ownership (e.g. so chown
works) -- but that would be a lot of work to implement.]
I would be happy if there were uid and gid mount options as many
other fs types have -- to treat all files in the entire mount as
owned by a particular user/group.
--
Karl 2005-06-09 22:10
-------------------------------------------------------
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] hostfs permissions
2005-06-10 5:34 [uml-devel] hostfs permissions Karl Chen
@ 2005-06-10 16:03 ` Blaisorblade
2005-06-10 20:14 ` Karl Chen
0 siblings, 1 reply; 6+ messages in thread
From: Blaisorblade @ 2005-06-10 16:03 UTC (permalink / raw)
To: user-mode-linux-devel; +Cc: Karl Chen
On Friday 10 June 2005 07:34, Karl Chen wrote:
> Hi, I'm doing some large-scale security experiments on Debian
> security. I'm using UML to do the whole thing on a cluster.
> Hostfs seems to make everything owned by root -- even files
> created by non-root users.
So you are running uml as root?
Or you are running UML as non-root but with hostfs as root filesystem? In this
case you're possibly seeing the result of a trick made to make it work
well... but I don't know if that trick is present in the UML version you're
using.
> I'm currently using 2.4.26-3 (Debian
> package).
Hmm, in that case
> I found a few posts via Google mentioning a patch to
> fix this, but no other information. What is the modified behavior
> of hostfs permissions? Has this been integrated into a newer
> version, or is it in cvs, or if not, are there plans to?
Well, there are:
1) HUMFS, implementing the ideal behaviour below
2) a patch posted by somebody for when UML is run by root, to allow created
files to get the UID of the process creating it inside UML.
> [I think the ideal behavior, if UML is running as non-root, would
> be if there were a temporary mapping of ownership (e.g. so chown
> works) -- but that would be a lot of work to implement.]
Well, this work has been started but is currently stalled because of other
ongoing work, however I hope we'll resurrect that shortly.
> I would be happy if there were uid and gid mount options as many
> other fs types have -- to treat all files in the entire mount as
> owned by a particular user/group.
Well, I'm going to add those options to UML 2.6 but I'll be able to work on
this only next week... However this should not be too much work.
--
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] hostfs permissions
2005-06-10 16:03 ` Blaisorblade
@ 2005-06-10 20:14 ` Karl Chen
2005-06-10 22:26 ` Blaisorblade
0 siblings, 1 reply; 6+ messages in thread
From: Karl Chen @ 2005-06-10 20:14 UTC (permalink / raw)
To: Blaisorblade; +Cc: user-mode-linux-devel
>>>>> On 2005-06-10 09:03 PDT, Blaisorblade writes:
>> Hostfs seems to make everything owned by root -- even files
>> created by non-root users.
Blaisorblade> So you are running uml as root?
Blaisorblade> Or you are running UML as non-root but with
Blaisorblade> hostfs as root filesystem?
I'm running uml as non-root (that's part of the reason for using
UML, so I can do everything as non-root), and not using hostfs as
the root file system. I just need to share one directory tree,
and some processes inside the uml need to run as non-root.
Blaisorblade> 1) HUMFS, implementing the ideal behaviour below
Humfs looks promising; I'm investigating - thanks.
>> I would be happy if there were uid and gid mount options as
>> many other fs types have -- to treat all files in the
>> entire mount as owned by a particular user/group.
Blaisorblade> Well, I'm going to add those options to UML 2.6
Blaisorblade> but I'll be able to work on this only next
Blaisorblade> week... However this should not be too much
Blaisorblade> work.
Great! Thanks! Let me know if I can help with anything.
--
Karl 2005-06-10 13:06
-------------------------------------------------------
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] hostfs permissions
2005-06-10 20:14 ` Karl Chen
@ 2005-06-10 22:26 ` Blaisorblade
2005-06-11 0:48 ` Karl Chen
0 siblings, 1 reply; 6+ messages in thread
From: Blaisorblade @ 2005-06-10 22:26 UTC (permalink / raw)
To: user-mode-linux-devel; +Cc: Karl Chen
On Friday 10 June 2005 22:14, Karl Chen wrote:
> >>>>> On 2005-06-10 09:03 PDT, Blaisorblade writes:
> >> Hostfs seems to make everything owned by root -- even files
> >> created by non-root users.
>
> Blaisorblade> So you are running uml as root?
>
> Blaisorblade> Or you are running UML as non-root but with
> Blaisorblade> hostfs as root filesystem?
>
> I'm running uml as non-root (that's part of the reason for using
> UML, so I can do everything as non-root), and not using hostfs as
> the root file system. I just need to share one directory tree,
> and some processes inside the uml need to run as non-root.
Ok, in this case there's probably a simpler road: simply use a 2.4.27-1bs
kernel. The implemented behaviour is that all created files will have the ID
they have on the host, i.e. the ID of the user running UML.
> Blaisorblade> 1) HUMFS, implementing the ideal behaviour below
>
> Humfs looks promising; I'm investigating - thanks.
> >> I would be happy if there were uid and gid mount options as
> >> many other fs types have -- to treat all files in the
> >> entire mount as owned by a particular user/group.
>
> Blaisorblade> Well, I'm going to add those options to UML 2.6
> Blaisorblade> but I'll be able to work on this only next
> Blaisorblade> week... However this should not be too much
> Blaisorblade> work.
>
> Great! Thanks! Let me know if I can help with anything.
--
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] hostfs permissions
2005-06-10 22:26 ` Blaisorblade
@ 2005-06-11 0:48 ` Karl Chen
2005-06-11 2:33 ` Blaisorblade
0 siblings, 1 reply; 6+ messages in thread
From: Karl Chen @ 2005-06-11 0:48 UTC (permalink / raw)
To: Blaisorblade; +Cc: user-mode-linux-devel
>>>>> 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...
diff -u /home/quarl/proj/uml/linux/linux-2.4.27/arch/um/fs/hostfs/.backup/hostfs_kern.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_kern.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 2005-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;
}
--
Karl 2005-06-10 17:44
-------------------------------------------------------
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] hostfs permissions
2005-06-11 0:48 ` Karl Chen
@ 2005-06-11 2:33 ` Blaisorblade
0 siblings, 0 replies; 6+ messages in thread
From: Blaisorblade @ 2005-06-11 2:33 UTC (permalink / raw)
To: user-mode-linux-devel; +Cc: Karl Chen
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-06-11 2:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).