Compile user binary to map text without W and data without X

Use the flags in elf header to set vm permissions
Modify pgbug() so that usertests text segment is without W
Add test to check app cannot write text segment
This commit is contained in:
Frans Kaashoek 2022-08-15 19:02:19 -04:00
parent 2175c6b0b6
commit cef1b57d4a
3 changed files with 49 additions and 11 deletions

View file

@ -90,7 +90,7 @@ tags: $(OBJS) _init
ULIB = $U/ulib.o $U/usys.o $U/printf.o $U/umalloc.o
_%: %.o $(ULIB)
$(LD) $(LDFLAGS) -N -e _main -Ttext 0 -o $@ $^
$(LD) $(LDFLAGS) -verbose -e _main -Ttext 0 -o $@ $^
$(OBJDUMP) -S $@ > $*.asm
$(OBJDUMP) -t $@ | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $*.sym