linux-um archives
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: Blaisorblade <blaisorblade@yahoo.it>
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] The source to that firmware-uml thing is now up...
Date: Thu, 28 Apr 2005 19:38:44 -0400	[thread overview]
Message-ID: <200504281938.45043.rob@landley.net> (raw)
In-Reply-To: <200504292116.30483.blaisorblade@yahoo.it>

On Friday 29 April 2005 03:16 pm, Blaisorblade wrote:

> > Hmmm...  I suppose I could always have a wrapper script
>
> which can't be setuid if in bash, could if in Perl and perlsuid is
> installed.

Actually you can run bash setuid with the -p option.  From bash's "flags.c":

/* Non-zero means that this shell is running in `privileged' mode.  This
   is required if the shell is to run setuid.  If the `-p' option is
   not supplied at startup, and the real and effective uids or gids
   differ, disable_priv_mode is called to relinquish setuid status. */
int privileged_mode = 0;

(That said, if you do use -p to get get a setuid bash, there's several other 
things you should do to make this marginally less dangerous.  And I wouldn't 
trust myself to remember them all off the top of my head...)

That said, I wasn't thinking of using bash for the wrapper but either python 
or C.  It's just easier to secure them...

> > that runs UML as a
> > non-root process in the chroot environment and opens a named pipe that we
> > can write into via hostfs when we want the chroot environment
> > depopulated.
>
> No, that must be a regular file... Linux does not pass requests to work on
> device nodes, named pipes, sockets down to the filesystem, so none of them
> can pass datas between the machines. You'd need a real IP socket
> (TCP/UDP),, or maybe something mconsole-based.

Okay, the disgusting way to do this:

Mount a ramfs somewhere.  CD into it, make subdirectories and bind mount in 
enough of the parent environment to run UML and open the memory file.  Run 
UML.  Have UML create a new file in the ramfs to signal when it's up enough 
that the host filesystem can go away.  The parent program detects the file's 
creation, unmounts all the directories, deletes the empty directories, 
remounts the ramfs read-only, and then does a lazy unmount of the ramfs.

I can come up with a _more_ disgusting way to do this if necessary. :)

> You can pass the location through a normal assignment on the cmd.line
> (which will become a env.var, or you might parse /proc/cmdline).

Creating a temporary file in the ramfs is good enough...

> > (I vaguely recall there's a way to tell UML where to drop its memory
> > file...)
>
> Setting TMPDIR.

Cool.

Rob


-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
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-04-29  0:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-20 10:06 [uml-devel] The source to that firmware-uml thing is now up Rob Landley
2005-04-23 12:57 ` Blaisorblade
2005-04-27  1:23   ` Rob Landley
2005-04-29 19:16     ` Blaisorblade
2005-04-28 23:38       ` Rob Landley [this message]
2005-05-01 11:06         ` Blaisorblade
2005-05-02  5:14           ` Rob Landley
2005-05-02 19:38             ` Blaisorblade
2005-04-24 23:20 ` Henrik Nordstrom

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=200504281938.45043.rob@landley.net \
    --to=rob@landley.net \
    --cc=blaisorblade@yahoo.it \
    --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