Add presubmit LFI tests We want to add presubmit tests whenever the external LFI repos are updated. We define all presubmit tests in system/lfi and import them into the external/lfi repos using TEST_MAPPING's import functionality. This allows us to update the presubmit tests in one area and all repos affecting LFI will run the same presubmit tests. Bug: 494581279 Test: atest --test-mapping :presubmit Change-Id: I47de5c28e0745041a072bd6f437262aa396094c3
This program makes it easy to do library sandboxing with LFI. It generates routines to initialize the library sandbox, and trampolines for calling functions from the library.
go build
See examples for some basic examples. See ./EXAMPLE.md for a step-by-step guide to recreating the add example manually.
The process for creating a sandboxed library is the following:
libfoo.a.libfoo.a to a static PIE and linking with boxrt (startup code that runs in the sandbox). Usually this command looks like $(LFICC) -Wl,--whole-archive libfoo.a -Wl,--no-whole-archive -Wl,--export-dynamic -lboxrt -static-pie -o libfoo.lfi.lfi-bind, passing it libfoo.lfi and instructing it to generate an initialization file lib_init.c and trampoline file lib_trampolines.S.lib_init.c and lib_trampolines.S into your host application, allowing you to use the sandboxed library.See the examples directory for real examples that you can try out.
Usage of ./lfi-bind:
-gen-init string
output file for initialization functions
-gen-trampolines string
output file for trampolines
-lib string
library name for function prefixes (default "lib")
-lib-path string
path to library executable at runtime
-lib-prefix string
prefix to put on library symbols
-symbols-prefix string
prefix used to match exported symbols
-symbols string
comma-separated list of exported symbols
-symbols-file string
list of symbols in a file, one line per symbol