Skip to content

Commit

Permalink
x86: loader/monitor: mark stack as non-exec
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu Mirmont <[email protected]>
  • Loading branch information
matneutrality committed Nov 15, 2024
1 parent 4836909 commit aece431
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion loader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ else ifeq ($(ARCH),x86_64)
CFLAGS_ARCH := $(CFLAGS_X86_64)
ASM_CPP_FLAGS_ARCH := $(CFLAGS_X86_64)
ASM_FLAGS_ARCH := --32
LD_FLAGS_ARCH := -m elf_i386
LD_FLAGS_ARCH := -m elf_i386 -z noexecstack
ARCH_DIR := x86_64
endif

Expand Down
4 changes: 3 additions & 1 deletion monitor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ else ifeq ($(ARCH),x86_64)
CFLAGS_ARCH := -march=$(GCC_MARCH) -DARCH_x86_64
ASM_CPP_FLAGS := -x assembler-with-cpp -c -g -march=$(GCC_MARCH)
ASM_FLAGS := -march=generic64
LDFLAGS_ARCH := -z noexecstack

ARCH_DIR := x86_64
else
$(error ARCH is unsupported)
endif

CFLAGS := -std=gnu11 -g -O3 -nostdlib -ffreestanding -Wall -Wno-maybe-uninitialized -Werror -I$(SEL4_SDK)/include $(CFLAGS_ARCH) -DARCH_$(ARCH)
LDFLAGS := $(LDFLAGS_ARCH)

PROGS := monitor.elf
OBJECTS := main.o crt0.o debug.o util.o
Expand All @@ -57,4 +59,4 @@ OBJPROG = $(addprefix $(BUILD_DIR)/, $(PROGS))
all: $(OBJPROG)

$(OBJPROG): $(addprefix $(BUILD_DIR)/, $(OBJECTS)) $(LINKSCRIPT)
$(TOOLCHAIN)ld -T$(LINKSCRIPT) $(addprefix $(BUILD_DIR)/, $(OBJECTS)) -o $@
$(TOOLCHAIN)ld -T$(LINKSCRIPT) $(LDFLAGS) $(addprefix $(BUILD_DIR)/, $(OBJECTS)) -o $@

0 comments on commit aece431

Please sign in to comment.