Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
David Drysdale | c9b26b8 | 2014-12-12 16:57:36 -0800 | [diff] [blame] | 2 | CFLAGS = -Wall |
Alexey Dobriyan | 4e7301e | 2019-05-14 15:44:43 -0700 | [diff] [blame] | 3 | CFLAGS += -Wno-nonnull |
| 4 | CFLAGS += -D_GNU_SOURCE |
David Drysdale | c9b26b8 | 2014-12-12 16:57:36 -0800 | [diff] [blame] | 5 | |
Kees Cook | 0f71241 | 2020-08-14 17:30:17 -0700 | [diff] [blame] | 6 | TEST_PROGS := binfmt_script non-regular |
Chris Kennelly | 206e22f | 2020-10-15 20:12:36 -0700 | [diff] [blame] | 7 | TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 |
Kees Cook | 61016db | 2020-05-17 21:47:43 -0700 | [diff] [blame] | 8 | TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir pipe |
bamvor.zhangjian@huawei.com | 80d443e8 | 2016-11-29 19:55:51 +0800 | [diff] [blame] | 9 | # Makefile is a run-time dependency, since it's accessed by the execveat test |
| 10 | TEST_FILES := Makefile |
| 11 | |
Alexey Dobriyan | 4e7301e | 2019-05-14 15:44:43 -0700 | [diff] [blame] | 12 | TEST_GEN_PROGS += recursion-depth |
| 13 | |
Kees Cook | 0f71241 | 2020-08-14 17:30:17 -0700 | [diff] [blame] | 14 | EXTRA_CLEAN := $(OUTPUT)/subdir.moved $(OUTPUT)/execveat.moved $(OUTPUT)/xxxxx* \ |
| 15 | $(OUTPUT)/S_I*.test |
bamvor.zhangjian@huawei.com | 80d443e8 | 2016-11-29 19:55:51 +0800 | [diff] [blame] | 16 | |
| 17 | include ../lib.mk |
| 18 | |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 19 | $(OUTPUT)/subdir: |
David Drysdale | c9b26b8 | 2014-12-12 16:57:36 -0800 | [diff] [blame] | 20 | mkdir -p $@ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 21 | $(OUTPUT)/script: |
David Drysdale | c9b26b8 | 2014-12-12 16:57:36 -0800 | [diff] [blame] | 22 | echo '#!/bin/sh' > $@ |
| 23 | echo 'exit $$*' >> $@ |
| 24 | chmod +x $@ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 25 | $(OUTPUT)/execveat.symlink: $(OUTPUT)/execveat |
| 26 | cd $(OUTPUT) && ln -s -f $(shell basename $<) $(shell basename $@) |
| 27 | $(OUTPUT)/execveat.denatured: $(OUTPUT)/execveat |
David Drysdale | c9b26b8 | 2014-12-12 16:57:36 -0800 | [diff] [blame] | 28 | cp $< $@ |
| 29 | chmod -x $@ |
Chris Kennelly | 206e22f | 2020-10-15 20:12:36 -0700 | [diff] [blame] | 30 | $(OUTPUT)/load_address_4096: load_address.c |
Yang Yingliang | 4d1cd3b | 2021-05-22 17:41:53 -0700 | [diff] [blame] | 31 | $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000 -pie -static $< -o $@ |
Chris Kennelly | 206e22f | 2020-10-15 20:12:36 -0700 | [diff] [blame] | 32 | $(OUTPUT)/load_address_2097152: load_address.c |
Yang Yingliang | 4d1cd3b | 2021-05-22 17:41:53 -0700 | [diff] [blame] | 33 | $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x200000 -pie -static $< -o $@ |
Chris Kennelly | 206e22f | 2020-10-15 20:12:36 -0700 | [diff] [blame] | 34 | $(OUTPUT)/load_address_16777216: load_address.c |
Yang Yingliang | 4d1cd3b | 2021-05-22 17:41:53 -0700 | [diff] [blame] | 35 | $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000000 -pie -static $< -o $@ |