aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / native / argus / lane_e.mk
| 1 | # Lane E: ARGUS-0 hard-invariant detectors. |
| 2 | # |
| 3 | # make -f lane_e.mk test-detect build and run the detector tests, plain |
| 4 | # and under UBSan (+ bounds) |
| 5 | # make -f lane_e.mk test-detect-asan the same under -fsanitize=address,undefined |
| 6 | # make -f lane_e.mk clean-detect |
| 7 | # |
| 8 | # test-detect does not include ASan because the ASan runtime hangs during its |
| 9 | # own start-up on macOS 26.6 (even for an empty main, with Apple clang 17 and |
| 10 | # Homebrew clang 20). Run test-detect-asan on Linux or a fixed macOS. |
| 11 | # Plain GNU make (macOS make 3.81 + clang, Linux gcc/clang). |
| 12 | |
| 13 | CC ?= cc |
| 14 | CFLAGS ?= -std=gnu11 -O2 -Wall -Wextra -Werror -fstack-protector-strong |
| 15 | UBSANFLAGS = -fsanitize=undefined,bounds -fno-sanitize-recover=all -fno-omit-frame-pointer -g |
| 16 | ASANFLAGS = -fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer -g |
| 17 | OUT ?= out |
| 18 | |
| 19 | DETECT_SRC = argus_detect.c tests/stub_state.c tests/test_argus_detect.c |
| 20 | DETECT_HDR = argus_abi.h argus_detect.h tests/stub_state.h ../capability/aienos_capability.h |
| 21 | |
| 22 | $(OUT)/test_argus_detect: $(DETECT_SRC) $(DETECT_HDR) |
| 23 | mkdir -p $(OUT) |
| 24 | $(CC) $(CFLAGS) -o $@ $(DETECT_SRC) |
| 25 | |
| 26 | $(OUT)/test_argus_detect_ubsan: $(DETECT_SRC) $(DETECT_HDR) |
| 27 | mkdir -p $(OUT) |
| 28 | $(CC) $(CFLAGS) $(UBSANFLAGS) -o $@ $(DETECT_SRC) |
| 29 | |
| 30 | $(OUT)/test_argus_detect_asan: $(DETECT_SRC) $(DETECT_HDR) |
| 31 | mkdir -p $(OUT) |
| 32 | $(CC) $(CFLAGS) $(ASANFLAGS) -o $@ $(DETECT_SRC) |
| 33 | |
| 34 | test-detect: $(OUT)/test_argus_detect $(OUT)/test_argus_detect_ubsan |
| 35 | $(OUT)/test_argus_detect |
| 36 | UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 $(OUT)/test_argus_detect_ubsan |
| 37 | |
| 38 | test-detect-asan: $(OUT)/test_argus_detect_asan |
| 39 | ASAN_OPTIONS=detect_leaks=1 UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 $(OUT)/test_argus_detect_asan |
| 40 | |
| 41 | clean-detect: |
| 42 | rm -f $(OUT)/test_argus_detect $(OUT)/test_argus_detect_ubsan $(OUT)/test_argus_detect_asan |
| 43 | |
| 44 | .PHONY: test-detect test-detect-asan clean-detect |