1- # Shiva JIT micropatching engine README
1+ # Shiva JIT micropatching engine
22
33
44## Description
55
6- Shiva is a programmable runtime linker (Program interpreter) for ELF
7- x64/aarch64 Linux -- ELF-microprograms (Shiva modules) are linked into the
8- process address space and given intricate control over program instrumentation
9- via ShivaTrace API. ShivaTrace is an in-process debugging and instrumentation
10- API with innovative debugging and hooking features.
6+ Shiva is an ELF dynamic linker that is specialized for patching native Linux
7+ software. Shiva has been custom tailored towards the requirements of the DARPA
8+ AMP project and currently supports the AArch64 architecture.
119
12- Shiva has been custom tailored towards the requirements of the DARPA AMP project and
13- with support for the AArch64 architecture. This fork of the project has created
14- an abundant set of new microcode patching capabilities, including symbol interposition
15- on functions (i.e. .text), as well as on global data (i.e. .rodata, .data, .bss).
16-
17- The original Shiva project can be found at https://github.com/elfmaster/shiva
18- and is specific to x86_64.
19-
20- This README will only cover Shiva as it relates to the DARPA AMP project, and only as
21- it pertains to AArch64 (Current support).
22-
23- Please see ./documentation/shiva_preliminary_design.pdf for a technical description
24- of Shiva.
10+ Patches are written in C and compiled into ELF relocatable objects. Shiva loads,
11+ links, and patches the new code into memory.
2512
2613## Support
2714
28- Support is limited to ELF AArch64 ET_DYN binaries. Future support for ET_EXEC will
29- be added as needed. The cFS software and the patch challenge-10 binaries are
30- ELF AArch64 ET_DYN binaries, so currently we are meeting the requirements.
15+ OS: Linux
16+ Architectures: AArch64
17+ ELF binary support: AArch64 ELF PIE executables (aka. ET_DYN)
18+
19+ Support for ET_EXEC binaries and other architectures are on the way.
3120
3221## Build
3322
@@ -46,7 +35,7 @@ git --fetch all
4635git checkout aarch64_support
4736```
4837
49- The original build for libelfmaster seems broken and I haven't yet fixed it.
38+ The original build for libelfmaster is broken and I haven't yet fixed it.
5039Meanwhile just use the simple build shellscript I made.
5140
5241```
@@ -79,17 +68,21 @@ make patches
7968sudo make install
8069```
8170
82- Shiva is copied to ` "/lib/shiva" ` and can be executed directly, but more commonly
83- indirectly as an interpreter.
71+ Shiva is copied to ` "/lib/shiva" ` and can be executed directly or indirectly as
72+ an interpreter.
8473
85- The shiva-ld utility is used to modify binaries with the path to the new
86- program interpreter ` "/lib/shiva" ` , and the path to the patch module (i.e.
87- ` "/opt/modules/shiva/patch1.o" ` ).
74+ The shiva-ld utility is known as the "Shiva Prelinker" and is used to modify
75+ binaries with the path to the new program interpreter ` "/lib/shiva" ` , and the
76+ path to the patch module (i.e. ` "/opt/modules/shiva/patch1.o" ` ).
8877
8978## Patch testing
9079
91- We have already compiled and prelinked the example patches. Shiva prelinking
92- refers specifically to the Shiva prelinking applied by the shiva-ld tool.
80+
81+ $ cd modules/aarch64/cfs_patch1
82+
83+ We have already compiled and prelinked the example patches in the previous
84+ steps. Shiva prelinking refers specifically to the prelinking applied by
85+ the shiva-ld tool.
9386
9487Take a look at the Makefile for each patch, and you will see how shiva-ld is
9588used to apply the pre-patch meta-data.
@@ -98,7 +91,7 @@ used to apply the pre-patch meta-data.
9891shiva-ld -e core-cpu1 -p cfs_patch1.o -i /lib/shiva -s /opt/shiva/modules -o core-cpu1.patched
9992```
10093
101- The Shiva make install script installs all of the patch modules into ` /opt/shiva/modules `
94+ The Shiva install script installs all of the patch modules into ` /opt/shiva/modules `
10295
10396The patch build environments are stored in ` modules/aarch64_patches/ ` and are as follows:
10497
0 commit comments