Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
83 lines (72 loc) · 2.64 KB
/
Copy pathDockerfile
File metadata and controls
83 lines (72 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
FROM ubuntu:24.04
LABEL description="FUSE Reentrancy Deadlock (AB-BA)"
ENV DEBIAN_FRONTEND=noninteractive
ENV RUSTUP_HOME=/opt/rust
ENV CARGO_HOME=/opt/cargo
ENV PATH=/opt/cargo/bin:$PATH
# -----------------------------------------------------------------------------
# System Dependencies
# -----------------------------------------------------------------------------
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
fuse3 \
libfuse3-dev \
liburing-dev \
pkg-config \
strace \
trace-cmd \
linux-tools-common \
linux-tools-generic \
git \
sudo \
vim-tiny \
&& rm -rf /var/lib/apt/lists/*
# -----------------------------------------------------------------------------
# Rust Toolchain
# -----------------------------------------------------------------------------
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --default-toolchain stable --profile minimal
# -----------------------------------------------------------------------------
# FUSE Configuration and User Setup
# -----------------------------------------------------------------------------
RUN echo "user_allow_other" >> /etc/fuse.conf && \
useradd -m -s /bin/bash fuseuser && \
echo "fuseuser ALL=(root) NOPASSWD: ALL" >> /etc/sudoers && \
chown -R fuseuser:fuseuser /opt/cargo /opt/rust
USER fuseuser
WORKDIR /home/fuseuser/poc
# -----------------------------------------------------------------------------
# Source and Build Steps
# -----------------------------------------------------------------------------
COPY --chown=fuseuser:fuseuser . .
# Rust FUSE daemon
RUN cargo build --release
# C exploit binary
RUN gcc -O2 -o client ./exploit/client.c -luring
# Ensure harness is runnable
RUN chmod +x ./evaluation/run_trials.sh
# -----------------------------------------------------------------------------
# Default Shell
# -----------------------------------------------------------------------------
CMD ["/bin/bash"]
# =============================================================================
# Usage
# =============================================================================
# Build:
# docker build -t reentryfs .
#
# Run (requires --privileged for FUSE):
# docker run --rm -it --privileged --cap-add SYS_ADMIN \
# -v /dev/fuse:/dev/fuse \
# reentryfs
#
# Inside container:
# mkdir -p mnt
# sudo BLOCK_FAULT=1 ./target/release/reentryfs mnt & sleep 1 &&
# ./client mnt/target_file
#
# Automated runs:
# ./evaluation/run_trials.sh 100 2
# =============================================================================