public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Dissociating process from bin's filesystem
@ 2002-04-25  2:47 Eric Buddington
  2002-04-25  3:42 ` James Cassidy
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Eric Buddington @ 2002-04-25  2:47 UTC (permalink / raw)
  To: linux-kernel

Is there any way to dissociate a process from its on-disk binary?  In
other words, I want to start 'foo_daemon', then unmount the filesystem
it started from. It seems to me this would be reasonably accomplished
by loading the binary completely into memory first ro eliminate the
dependence.

Is this possible, or planned? Are there intractable problems with it
that I don't see?

Eric Buddington

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dissociating process from bin's filesystem
  2002-04-25  2:47 Dissociating process from bin's filesystem Eric Buddington
@ 2002-04-25  3:42 ` James Cassidy
  2002-04-25  8:52 ` john slee
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: James Cassidy @ 2002-04-25  3:42 UTC (permalink / raw)
  To: ebuddington; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 873 bytes --]


    You could always copy the process to a RAM filesystem like tmpfs
or a ramdisk. 

On Wed, Apr 24, 2002 at 10:47:14PM -0400, Eric Buddington wrote:
> Is there any way to dissociate a process from its on-disk binary?  In
> other words, I want to start 'foo_daemon', then unmount the filesystem
> it started from. It seems to me this would be reasonably accomplished
> by loading the binary completely into memory first ro eliminate the
> dependence.
> 
> Is this possible, or planned? Are there intractable problems with it
> that I don't see?
> 
> Eric Buddington
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
						-- James Cassidy (QFire)

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dissociating process from bin's filesystem
  2002-04-25  2:47 Dissociating process from bin's filesystem Eric Buddington
  2002-04-25  3:42 ` James Cassidy
@ 2002-04-25  8:52 ` john slee
  2002-04-25  9:22   ` johan.adolfsson
  2002-04-25 11:42 ` Padraig Brady
  2002-04-25 12:28 ` Rob Landley
  3 siblings, 1 reply; 8+ messages in thread
From: john slee @ 2002-04-25  8:52 UTC (permalink / raw)
  To: ebuddington; +Cc: linux-kernel

On Wed, Apr 24, 2002 at 10:47:14PM -0400, Eric Buddington wrote:
> Is there any way to dissociate a process from its on-disk binary?  In
> other words, I want to start 'foo_daemon', then unmount the filesystem
> it started from. It seems to me this would be reasonably accomplished
> by loading the binary completely into memory first ro eliminate the
> dependence.
> 
> Is this possible, or planned? Are there intractable problems with it
> that I don't see?

as i understand it this precludes you from using shared libs as they are
mmap()'d on startup...

other than that the running daemon will cause the fs to be
un-umountable.

j.

-- 
R N G G   "Well, there it goes again... And we just sit 
 I G G G   here without opposable thumbs." -- gary larson

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dissociating process from bin's filesystem
  2002-04-25  8:52 ` john slee
@ 2002-04-25  9:22   ` johan.adolfsson
  0 siblings, 0 replies; 8+ messages in thread
From: johan.adolfsson @ 2002-04-25  9:22 UTC (permalink / raw)
  To: john slee, ebuddington; +Cc: linux-kernel

Doesn't mlockall() do this?
man mlockall
/Johan

----- Original Message -----
From: "john slee" <indigoid@higherplane.net>
To: <ebuddington@wesleyan.edu>
Cc: <linux-kernel@vger.kernel.org>
Sent: den 25 april 2002 10:52
Subject: Re: Dissociating process from bin's filesystem


> On Wed, Apr 24, 2002 at 10:47:14PM -0400, Eric Buddington wrote:
> > Is there any way to dissociate a process from its on-disk binary?  In
> > other words, I want to start 'foo_daemon', then unmount the filesystem
> > it started from. It seems to me this would be reasonably accomplished
> > by loading the binary completely into memory first ro eliminate the
> > dependence.
> >
> > Is this possible, or planned? Are there intractable problems with it
> > that I don't see?
>
> as i understand it this precludes you from using shared libs as they are
> mmap()'d on startup...
>
> other than that the running daemon will cause the fs to be
> un-umountable.
>
> j.
>
> --
> R N G G   "Well, there it goes again... And we just sit
>  I G G G   here without opposable thumbs." -- gary larson
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dissociating process from bin's filesystem
  2002-04-25  2:47 Dissociating process from bin's filesystem Eric Buddington
  2002-04-25  3:42 ` James Cassidy
  2002-04-25  8:52 ` john slee
@ 2002-04-25 11:42 ` Padraig Brady
  2002-04-27 19:03   ` Eric W. Biederman
  2002-04-25 12:28 ` Rob Landley
  3 siblings, 1 reply; 8+ messages in thread
From: Padraig Brady @ 2002-04-25 11:42 UTC (permalink / raw)
  To: ebuddington; +Cc: linux-kernel

I'm think this is not possible at the moment.

The file of the executing process is in use as the backing store for
one or more live virtual memory areas, so changing it could
corrupt the processes using those areas. Hence you can't umount.

Now the Mach kernel has a MAP_COPY flag to the mmap system call
which would do what you want, but this is mucho complex/messy,
so don't hold your breath for a linux implementation.

A related note on shared libraries is you don't get the
"text file busy" message if you  update them while they're in use,
like you do for executable files. The reason is MAP_DENYWRITE
is ignored for security reasons. I think Eric Biederman has
a workaround though?

So in summary if you want a process to run independently of
a filesystem, make it static and run it from a ramdisk.

Padraig.

Eric Buddington wrote:
> Is there any way to dissociate a process from its on-disk binary?  In
> other words, I want to start 'foo_daemon', then unmount the filesystem
> it started from. It seems to me this would be reasonably accomplished
> by loading the binary completely into memory first ro eliminate the
> dependence.
> 
> Is this possible, or planned? Are there intractable problems with it
> that I don't see?
> 
> Eric Buddington


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dissociating process from bin's filesystem
  2002-04-25  2:47 Dissociating process from bin's filesystem Eric Buddington
                   ` (2 preceding siblings ...)
  2002-04-25 11:42 ` Padraig Brady
@ 2002-04-25 12:28 ` Rob Landley
  2002-04-25 17:52   ` Chris Friesen
  3 siblings, 1 reply; 8+ messages in thread
From: Rob Landley @ 2002-04-25 12:28 UTC (permalink / raw)
  To: ebuddington, Eric Buddington, linux-kernel

On Wednesday 24 April 2002 10:47 pm, Eric Buddington wrote:
> Is there any way to dissociate a process from its on-disk binary?

Sure.  Fire up an instance of ramfs, copy the file there (and its associated 
libraries), chroot and exec the copy on ramfs.  Sort of like initrd in 
reverse. :)

You could also try to extensively rewrite the kernel to completely disable 
paging, but I wouldn't recommend it.

Rob

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dissociating process from bin's filesystem
  2002-04-25 12:28 ` Rob Landley
@ 2002-04-25 17:52   ` Chris Friesen
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Friesen @ 2002-04-25 17:52 UTC (permalink / raw)
  To: Rob Landley; +Cc: ebuddington, Eric Buddington, linux-kernel

Rob Landley wrote:
> 
> On Wednesday 24 April 2002 10:47 pm, Eric Buddington wrote:
> > Is there any way to dissociate a process from its on-disk binary?
> 
> Sure.  Fire up an instance of ramfs, copy the file there (and its associated
> libraries), chroot and exec the copy on ramfs.  Sort of like initrd in
> reverse. :)

If you're writing the binary in question, you could use mlockall() which ensures
that you won't need to page in bits of the binary from disk.  I don't know if
the filesystem considers this totally dissociated though, but it might be good
enough for what you want.

Chris

-- 
Chris Friesen                    | MailStop: 043/33/F10  
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dissociating process from bin's filesystem
  2002-04-25 11:42 ` Padraig Brady
@ 2002-04-27 19:03   ` Eric W. Biederman
  0 siblings, 0 replies; 8+ messages in thread
From: Eric W. Biederman @ 2002-04-27 19:03 UTC (permalink / raw)
  To: Padraig Brady; +Cc: ebuddington, linux-kernel

Padraig Brady <padraig@antefacto.com> writes:

> I'm think this is not possible at the moment.
> 
> The file of the executing process is in use as the backing store for
> one or more live virtual memory areas, so changing it could
> corrupt the processes using those areas. Hence you can't umount.
> 
> Now the Mach kernel has a MAP_COPY flag to the mmap system call
> which would do what you want, but this is mucho complex/messy,
> so don't hold your breath for a linux implementation.
> 
> A related note on shared libraries is you don't get the
> "text file busy" message if you  update them while they're in use,
> like you do for executable files. The reason is MAP_DENYWRITE
> is ignored for security reasons. I think Eric Biederman has
> a workaround though?

I played with it but could find nothing better than.
chmod a-w file
And it wasn't terribly important personally so I dropped it.

Eric


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-04-27 19:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-25  2:47 Dissociating process from bin's filesystem Eric Buddington
2002-04-25  3:42 ` James Cassidy
2002-04-25  8:52 ` john slee
2002-04-25  9:22   ` johan.adolfsson
2002-04-25 11:42 ` Padraig Brady
2002-04-27 19:03   ` Eric W. Biederman
2002-04-25 12:28 ` Rob Landley
2002-04-25 17:52   ` Chris Friesen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox