-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (35 loc) · 1.34 KB
/
Makefile
File metadata and controls
50 lines (35 loc) · 1.34 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
# page_inject -- CVE-2026-31431 page-cache injector
#
# make Build page_inject (generates asm_bytecode.c if missing)
# make shellcode Assemble .asm -> .bin flat binaries
# make clean Remove all build artifacts including asm_bytecode.c
CC := gcc
CFLAGS := -O2 -Wall -Wextra -Wno-unused-result
LDFLAGS := -static
NASM := nasm
SRCS := page_inject.c asm_bytecode.c
OBJS := $(SRCS:.c=.o)
# -- Main target ------------------------------------------------------
page_inject: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
# Generate asm_bytecode.c from .asm sources (requires nasm)
asm_bytecode.c: zone_c.asm write_cache.asm zone_c_ld.asm trampoline.asm gen_arrays.sh
./gen_arrays.sh
# -- Shellcode flat binaries (optional, for inspection) ---------------
zone_c.bin: zone_c.asm
$(NASM) -f bin -o $@ $<
write_cache.bin: write_cache.asm
$(NASM) -f bin -o $@ $<
zone_c_ld.bin: zone_c_ld.asm
$(NASM) -f bin -o $@ $<
trampoline.bin: trampoline.asm
$(NASM) -f bin -o $@ $<
shellcode: zone_c.bin write_cache.bin zone_c_ld.bin trampoline.bin
# -- Clean ------------------------------------------------------------
clean:
rm -f page_inject $(OBJS) asm_bytecode.c \
zone_c.bin write_cache.bin zone_c_ld.bin trampoline.bin
.PHONY: shellcode clean
.DEFAULT_GOAL := page_inject