Skip to content
caballa edited this page Apr 7, 2021 · 1 revision

The Manifest

The manifest for slash should be valid JSON. The following keys have meaning:

  • main : a path to the bitcode module containing the main entry point.

  • modules: a list of paths to the other bitcode modules needed.

  • binary : the name of the desired executable.

  • native_libs : a list of flags (-lm, -lc, -lpthread) or paths to native objects (.o, .a, .so, .dylib)

  • ldflags: a list of linker flags such as --static, --nostdlib

  • name: the program name

  • static_args : the list of static arguments you wish to specialize in the main() of main.

  • dynamic_args : a number that indicates the arguments the specialized program will receive at runtime. If this key is omitted then the default value is 0 which means that the specialized program does not expect any parameter.

  • lib_spec: list of library bitcode you wish to specialize with respect to main or a list of main functions given by main_spec.

  • main_spec: list of bitcode modules each containing a main function used by lib_spec.

As an example, (see examples/linux/apache), to previrtualize apache:

{ "main" : "httpd.bc"
, "binary" : "httpd_slashed"
, "modules" : ["libapr-1.so.bc", "libaprutil-1.so.bc", "libpcre.so.bc"]
, "native_libs" : ["-lcrypt", "-ldl", "-lpthread"]
, "name"    : "httpd"
, "static_args" : ["-d", "/var/www"]
}

Another example, (see examples/linux/musl_nweb), specializes nweb with musl libc.c:

{ "main" :  "nweb.o.bc"
, "binary" : "nweb_razor"
, "modules" : ["libc.a.bc"]
, "native_libs" : ["crt1.o", "libc.a"]
, "ldflags" : ["-static", "-nostdlib"]
, "name" : "nweb"
, "static_args" : ["8181", "./root"]
, "dynamic_args" : "0"
}

A third example, (see examples/linux/tree), illustrates the use of the dynamic_args field to partially specialize the arguments to the tree utility.

{ "main" : "tree.bc"
, "binary"  : "tree"
, "modules"    : []
, "native_libs" : []
, "ldflags" : [ "-O2" ]
, "name"    : "tree"
, "static_args" : ["-J", "-h"]
, "dynamic_args" : "1"
}

The specialized program will output its results in JSON notation (-J) that will include a human readable size field (-h). The specialized program expects one extra argument, either a directory or another flag to output the contents of the current working directory.

Clone this wiki locally