I am developing FS to do some nasty tasks. It would restrict file access. It will asks user about he/she allows file open/create/move/removal/etc.
I create executable with set group id. Because user must mount FS, I mount as user and next change group id to access protected directory.
Problem is I cannot protect from unmount operation. Some bad guy could unmount FS and perform normal file operations, so if user mount some protected directory to ~/bin (for example), someone could unmount from ~/bin and write custom executable to ~/bin. The same about config files.
What I trying to do is to remove this piece of code:
if (fuse_set_signal_handlers(session) != 0) {
goto end1;
}
And write something like this:
do {
(void) fuse_session_loop_mt(session, &config);
} while (!grant_access(OP_UNMOUNT, NULL, NULL));
fuse_session_unmount(session);
fuse_session_destroy(session);
But this do not work. I use libfuse in version 3 and low-level libfuse API.