Linux Container Development
 help / color / mirror / Atom feed
* Pass a fd to program in another mount namespace?
@ 2014-01-21 14:33 Rob van der Hoeven
       [not found] ` <1390314790.19789.79.camel-fUTaybRSAecurNyw8EiOWGKXln2oN1SQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Rob van der Hoeven @ 2014-01-21 14:33 UTC (permalink / raw)
  To: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Hi,

I was wondering if it is possible to send a file descriptor to a program
running in another mount namespace. Sendmsg/recvmsg can pass fd's in the
ancillary data and this works great until my program switches to another
mount namespace using:

unshare(CLONE_NEWNS)
pivot_root(".", "./us_rootfs")

If there is a way to pass descriptors across mount namespaces then it
would greatly benefit my program so I hope this is possible. 

Best regards,
Rob van der Hoeven.
http://freedomboxblog.nl

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

* Re: Pass a fd to program in another mount namespace?
       [not found] ` <1390314790.19789.79.camel-fUTaybRSAecurNyw8EiOWGKXln2oN1SQ@public.gmane.org>
@ 2014-01-21 23:07   ` Serge Hallyn
  2014-01-22 13:40     ` Rob van der Hoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Serge Hallyn @ 2014-01-21 23:07 UTC (permalink / raw)
  To: Rob van der Hoeven; +Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Quoting Rob van der Hoeven (robvanderhoeven-nv30jWqA7Mk@public.gmane.org):
> Hi,
> 
> I was wondering if it is possible to send a file descriptor to a program
> running in another mount namespace. Sendmsg/recvmsg can pass fd's in the
> ancillary data and this works great until my program switches to another
> mount namespace using:
> 
> unshare(CLONE_NEWNS)
> pivot_root(".", "./us_rootfs")
> 
> If there is a way to pass descriptors across mount namespaces then it
> would greatly benefit my program so I hope this is possible. 

Yes, it is possible.  Your email makes it sound like you've tried
and it didn't work for you, in which case a short test case showing
what fails might be useful here.

-serge

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

* Re: Pass a fd to program in another mount namespace?
  2014-01-21 23:07   ` Serge Hallyn
@ 2014-01-22 13:40     ` Rob van der Hoeven
  0 siblings, 0 replies; 3+ messages in thread
From: Rob van der Hoeven @ 2014-01-22 13:40 UTC (permalink / raw)
  To: Serge Hallyn; +Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On Tue, 2014-01-21 at 17:07 -0600, Serge Hallyn wrote:
> Quoting Rob van der Hoeven (robvanderhoeven-nv30jWqA7Mk@public.gmane.org):
> > Hi,
> > 
> > I was wondering if it is possible to send a file descriptor to a program
> > running in another mount namespace. Sendmsg/recvmsg can pass fd's in the
> > ancillary data and this works great until my program switches to another
> > mount namespace using:
> > 
> > unshare(CLONE_NEWNS)
> > pivot_root(".", "./us_rootfs")
> > 
> > If there is a way to pass descriptors across mount namespaces then it
> > would greatly benefit my program so I hope this is possible. 
> 
> Yes, it is possible.  Your email makes it sound like you've tried
> and it didn't work for you, in which case a short test case showing
> what fails might be useful here.
> 
> -serge

Hi Serge,

Problem solved. It turned out that I had not properly initialized the
ancillary header. Because the problem only showed itself after switching
to another mount namespace I wrongly assumed that this had something to
do with the error. Very happy that this works now.

Your answer made me investigate this further, thanks!
Rob van der Hoeven.
http://freedomboxblog.nl

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

end of thread, other threads:[~2014-01-22 13:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-21 14:33 Pass a fd to program in another mount namespace? Rob van der Hoeven
     [not found] ` <1390314790.19789.79.camel-fUTaybRSAecurNyw8EiOWGKXln2oN1SQ@public.gmane.org>
2014-01-21 23:07   ` Serge Hallyn
2014-01-22 13:40     ` Rob van der Hoeven

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