All of lore.kernel.org
 help / color / mirror / Atom feed
* RFC: allow recording and passing of open file descriptors
@ 2021-06-29 14:43 Enrico Weigelt, metux IT consult
  2021-06-29 14:43 ` [RFC PATCH 1/2] fs: allow filesystems to directly pass an existing struct file Enrico Weigelt, metux IT consult
  2021-06-29 14:43 ` [RFC PATCH 2/2] fs: srvfs: new pseudo-fs for publishing opened fd's in the filesystem Enrico Weigelt, metux IT consult
  0 siblings, 2 replies; 4+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2021-06-29 14:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: viro, info, keescook, anton, ccross, tony.luck, linux-fsdevel

Hello folks,


here's an attempt to make it to record open file descriptors (struct file*)
and make them available to other processes via file system. The semantics
are similar to dup() or passing via Unix socket in regard that the 
receiving process will get reference to the same struct file instance into
its fdtable. But the big difference here is we're doing it directly via
file system (ie. retrieving is done by a simple open()). It works pretty
much like like Plan9's /srv file system:

    http://man.cat-v.org/plan_9/3/srv

To archive that, the first patch introduces the concept of "file boxing",
which means an open file operation can put a reference to another file
into the struct file, which will then be returned to the caller, instead
of the newly created one. The reason for doing it this strange way is that
the new struct file instance is allocated and prepared very early, before
we're calling into the actual file operation - refactoring this so that
the open() file op directly returns a struct file* pointer would be a
massively intrusive change, that I just don't dare to do here.

The second patch introduces a new file system "srvfs" that works like
Plan9's /srv file systems.


Another use case for the first patch could be direct fd passing in FUSE,
like Peng Tao and Alessio Balsini are currently working on, via other means.

    https://www.spinics.net/lists/linux-fsdevel/msg196163.html


I believe the patch 1 should be pretty straightforward and not doing any harm.
(it's not even compiled in unless explicitly enabled by something else)


have run,

--mtx

---
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287


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

end of thread, other threads:[~2021-06-29 23:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29 14:43 RFC: allow recording and passing of open file descriptors Enrico Weigelt, metux IT consult
2021-06-29 14:43 ` [RFC PATCH 1/2] fs: allow filesystems to directly pass an existing struct file Enrico Weigelt, metux IT consult
2021-06-29 14:43 ` [RFC PATCH 2/2] fs: srvfs: new pseudo-fs for publishing opened fd's in the filesystem Enrico Weigelt, metux IT consult
2021-06-29 23:39   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.