44 lines
3.5 KiB
TeX
44 lines
3.5 KiB
TeX
%! TeX program = lualatex
|
|
%! TeX root = ../../thesis.tex
|
|
\documentclass[../../thesis.tex]{subfiles}
|
|
|
|
\begin{document}
|
|
|
|
\section{WAMR Modifications}\label{sec:wamrmodifications}
|
|
|
|
The experiments use a slightly modified version of \Gls{wamr} based on release 2.4.4\footnote{\url[2026-09-11]{https://github.com/wasm-micro-runtime/wasm-micro-runtime/releases/tag/WAMR-2.4.4}}.
|
|
The modifications provide a platform port for the bare-metal execution environment described in \autoref{sec:executionenvironment} and an explicit marker call during runtime exceptions.
|
|
|
|
\subsection{Bare-Metal Platform}\label{ssec:wamrbaremetal}
|
|
|
|
\Gls{wamr} implements platform-specific details separately from the runtime inside its platform abstractions.
|
|
The added \code{baremetal} platform only provides the subset of this layer that is required by the experiments.
|
|
It is selected through \code{WAMR\_BUILD\_PLATFORM=baremetal} and compiled for 32-bit x86 using a freestanding cross-compiler.
|
|
The build enables the classic interpreter and \Gls{aot} execution, while disabling the fast interpreter, the \Glspl{jit}, and WASI support.
|
|
The modifications also remove the mandatory CMake thread-library lookup and disable the compiler option \code{-mindirect-branch-register}\todo{Option was disabled because gcc 5.4 didn't support it, now I'm using a newer cross compiler}.
|
|
|
|
Since execution is single-threaded and no operating system is present, many platform functions are stubs.
|
|
Platform initialization and mutex operations report success without performing any work, console output is discarded, and time queries return zero.
|
|
The system allocation functions \code{os\_malloc} and \code{os\_realloc} return \code{NULL}.
|
|
Instead, the host initializes \Gls{wamr} with a supplied memory pool or custom allocation callbacks, as described later in \autoref{sssec:wamrmemoryallocation}.
|
|
|
|
\Gls{aot} experiment variants also require implementations of \code{os\_mmap} and \code{os\_mremap} to allocate memory for the loaded module text.
|
|
The platform provides these using a static \SI{2}{\mega\byte} buffer and a simple bump allocator (allocator with monotonically increasing offset into the reserved memory region).
|
|
Remapping allocates a new region and copies the old one, without reclaiming any memory.
|
|
Unmapping does not reclaim memory, and \code{os\_mprotect} reports success without changing access permissions.
|
|
Thus, these functions only supply storage for the loader without implementing any other virtual-memory or memory protection related functionalities.
|
|
|
|
The \code{os\_mmap} buffer can optionally be placed in the linker section \code{.text.wamr\_mmap} by defining \code{WAMR\_MMAP\_IN\_TEXT}.
|
|
The linker script fences this region with symbols so that faults can be attributed to this address range during \Gls{fail} experiment evaluation.
|
|
|
|
\subsection{Runtime Exception Marker}\label{ssec:wamrexceptionmarker}
|
|
|
|
To differentiate errors detected by the \Gls{wamr} runtime from other fault outcomes, a \code{fail\_marker\_group1} call is added to the \code{wasm\_set\_exception\_local} handler.
|
|
Clearing an exception by passing \code{NULL} does not invoke the marker.
|
|
This exception handler is utilized by both interpreted execution and \Gls{aot} execution, whose \code{aot\_set\_exception} forwards to \code{wasm\_set\_exception}.
|
|
|
|
To enable the \code{fail\_marker\_group1} outcome, the marker function symbol has to be registered with \Gls{fail}'s experiment runner.
|
|
\Gls{fail} then installs a breakpoint listener at this function's address and aborts the injection run if it fires.
|
|
|
|
\end{document}
|