Is it possible to implement something like /proc/self in a FUSE filesystem?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to implement something like /proc/self in a FUSE filesystem?

Casey Rodarmor
Heyo,

/proc/self is a symlink that points to the PID of the process that is
reading it, so if the process's PID is 5, /proc/self will behave like
a symlink to '/proc/5'.

Is it possible to implement something with this behavior in FUSE?

The implementation of /proc/self is here, in proc_self_readlink:

https://github.com/torvalds/linux/blob/v4.3/fs/proc/self.c

I suspect that the mechanisms that it uses to get the correct PID will
not be available to a FUSE filesystem, so I'm wondering if there is
anything else I can use.

Thanks!

Best,
Casey

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to implement something like /proc/self in a FUSE filesystem?

Stef Bon-2
I'm not sure why you want such a thing, but there is information
available in the lowlevel interface:

https://github.com/libfuse/libfuse/blob/master/include/fuse_lowlevel.h#L109

You get this ctx using:

https://github.com/libfuse/libfuse/blob/master/include/fuse_lowlevel.h#L1518

Not only pid, but also uid and gid.

Stef

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to implement something like /proc/self in a FUSE filesystem?

David Sheets
On Thu, May 19, 2016 at 2:03 PM, Stef Bon <[hidden email]> wrote:

> I'm not sure why you want such a thing, but there is information
> available in the lowlevel interface:
>
> https://github.com/libfuse/libfuse/blob/master/include/fuse_lowlevel.h#L109
>
> You get this ctx using:
>
> https://github.com/libfuse/libfuse/blob/master/include/fuse_lowlevel.h#L1518
>
> Not only pid, but also uid and gid.

Keep in mind the pid is actually the kernel thread id of the thread
invoking the syscall and not the primary process id.

David

> Stef
>
> ------------------------------------------------------------------------------
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
> --
> fuse-devel mailing list
> To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to implement something like /proc/self in a FUSE filesystem?

Casey Rodarmor
On Thu, May 19, 2016 at 6:34 AM, David Sheets <[hidden email]> wrote:
> On Thu, May 19, 2016 at 2:03 PM, Stef Bon <[hidden email]> wrote:
>> I'm not sure why you want such a thing, but there is information
>> available in the lowlevel interface:

Perfect, that looks like exactly what I want. Thank you!

> Keep in mind the pid is actually the kernel thread id of the thread
> invoking the syscall and not the primary process id.

Noted, thanks for pointing that out.

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to implement something like /proc/self in a FUSE filesystem?

Stef Bon-2
2016-05-19 23:43 GMT+02:00 Casey Rodarmor <[hidden email]>:
> On Thu, May 19, 2016 at 6:34 AM, David Sheets <[hidden email]> wrote:

>> Keep in mind the pid is actually the kernel thread id of the thread
>> invoking the syscall and not the primary process id.

Yes indeed. Note that this threadid does not showup in the /proc
directory, but does exist!

ls -al /proc/<threadid>

gives you info. Procfs is a particular fs.

Howto go from there (get the process id from the thread id) I do not
know anymore.


Stef

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel