Opened 2 months ago

#67 new defect

DiOS: VFS Capture does not work

Reported by: Vladimír Štill Owned by: mornfall
Priority: major Milestone: 5.0
Component: other Keywords:
Cc:

Description

Let's have a program, du.cpp:

#include <dirent.h>
#include <unistd.h>
#include <iostream>
#include <string>
#include <string_view>

using namespace std::literals;

void list( std::string entry, std::string name, std::string indent ) {
    std::cout << indent << name << "\n";

    DIR *d = opendir( entry.c_str() );
    if ( d ) {
        struct dirent *dir;
        indent += "    ";
        while ( (dir = readdir( d )) != nullptr ) {
            if ( dir->d_name == "."sv || dir->d_name == ".."sv )
                continue;
            list( entry + "/" + dir->d_name, dir->d_name, indent );
        }
        closedir( d );
    }
}

int main() {
    std::string from;
    from.resize( 256 );
    getcwd( from.data(), from.size() );
    list( from, from, "" );
}

Now, we want to run this program with a VFS capture:

$ divine exec -o nofail:malloc --virtual --capture test/dios/ -std=c++17 du.cpp
compiling du.cpp
FAULT: null pointer dereference: [global* 0 0 ddn]
DOUBLE FAULT: trying to return without a caller
E: Double fault, program terminated.
Segmentation fault

Without capture, this works better:

$ divine exec -o nofail:malloc --virtual -std=c++17 du.cpp
compiling du.cpp
[0] /
encountered an infeasible path (execution cancelled)

Although the last line seems like a bug too.

Change History (0)

Note: See TracTickets for help on using tickets.