Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R/W Loopback #105

Open
beewoolie opened this issue Aug 19, 2021 · 3 comments
Open

R/W Loopback #105

beewoolie opened this issue Aug 19, 2021 · 3 comments

Comments

@beewoolie
Copy link

It appears that udevil doesn't allow rw mounting of loopback filesystems. I'll take a look at the code to see if I can determine where this is defined.

@beewoolie
Copy link
Author

The function mount_file in udevil.c explicitly sets the mount ro:

static int mount_file( int fd, const char* device_file, const char* fstype, 
                                        const char* options, const char* point )
{
    char* loopdev = attach_fd_to_loop( device_file, fd );
    if ( !loopdev || fd == -1 )
    {
        g_free( loopdev );
        wlog( _("udevil: error 148: unable to attach file to loop device\n"),
                                                                    NULL, 2 );
        return 1;
    }
    char* loopopts = g_strdup_printf( "%s%sro", options ? options : "",
                                                     options ? "," : "" );

Allowing this invocation to remove the ro option may not be enough, but we're looking into it.

@beewoolie
Copy link
Author

Patch attached. We check for an explicit ro/rw which we honor. Otherwise, the mount is ro.

elf_rw-loopback.patch.zip

@biopsin
Copy link

biopsin commented Oct 30, 2021

Seems incomplete as it fails to build..

udevil.c:2274:5: error: unknown type name 'bool'
 2274 |     bool is_ro_or_rw = false;
      |     ^~~~
udevil.c:2274:24: error: 'false' undeclared (first use in this function)
 2274 |     bool is_ro_or_rw = false;
      |                        ^~~~~
udevil.c:2274:24: note: each undeclared identifier is reported only once for each function it
appears in
udevil.c:2278:25: error: 'true' undeclared (first use in this function)
 2278 |           is_ro_or_rw = true;
      |                         ^~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants