handle execveat systemcall on McKernel

Refs: #1366
Change-Id: I921e04a0df8d0d798fc94f675e5112dd2fec190a
This commit is contained in:
Ken Sato
2019-11-14 10:56:28 +09:00
parent d052acab1d
commit 7fc4272b89
10 changed files with 356 additions and 10 deletions

29
test/issues/1366/C1366.sh Executable file
View File

@@ -0,0 +1,29 @@
#/bin/sh
USELTP=1
USEOSTEST=0
. ../../common.sh
issue=1366
tid=01
cp ${LTPBIN}/execve_* ./
cp ${LTPBIN}/execveat_* ./
for tp in execveat01 execveat02 execveat03 execve01 execve02 execve03 execve05
do
tname=`printf "C${issue}T%02d" ${tid}`
echo "*** ${tname} start *******************************"
sudo PATH=${LTPBIN}:${PATH} $MCEXEC $LTPBIN/$tp 2>&1 | tee $tp.txt
ok=`grep PASS $tp.txt | wc -l`
ng=`grep FAIL $tp.txt | wc -l`
if [ $ng = 0 ]; then
echo "*** ${tname} PASSED ($ok)"
else
echo "*** ${tname} FAILED (ok=$ok ng=%ng)"
fi
let tid++
echo ""
done

11
test/issues/1366/Makefile Normal file
View File

@@ -0,0 +1,11 @@
CFLAGS=-g
LDFLAGS=
TARGET=
all: $(TARGET)
test: all
./C1366.sh
clean:
rm -f $(TARGET) *.o *.txt execve_* execveat_*

24
test/issues/1366/README Normal file
View File

@@ -0,0 +1,24 @@
【Issue#1366 動作確認】
□ テスト内容
1. 以下のLTPを用いてexecveat機能がMckernelで動作することを確認
- execveat01
- execveat02
- execveat03
2. 以下のLTPを用いて既存のexecve機能に影響が無いことを確認
- execve01
- execve02
- execve03
- execve05
□ 実行手順
$ make test
McKernelのインストール先や、OSTEST, LTPの配置場所は、
$HOME/.mck_test_config を参照している
.mck_test_config は、McKernelをビルドした際に生成されるmck_test_config.sample ファイルを
$HOMEにコピーし、適宜編集する
□ 実行結果
x86_64_result.log aarch64_result.log 参照。
すべての項目をPASSしていることを確認。

View File

@@ -0,0 +1,95 @@
*** C1366T01 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execveat_child.c:36: PASS: execveat_child run as expected
execveat_child.c:36: PASS: execveat_child run as expected
execveat_child.c:36: PASS: execveat_child run as expected
execveat_child.c:36: PASS: execveat_child run as expected
Summary:
passed 4
failed 0
skipped 0
warnings 0
*** C1366T01 PASSED (4)
*** C1366T02 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execveat02.c:64: PASS: execveat() fails as expected: EBADF
execveat02.c:64: PASS: execveat() fails as expected: EINVAL
execveat02.c:64: PASS: execveat() fails as expected: ELOOP
execveat02.c:64: PASS: execveat() fails as expected: ENOTDIR
Summary:
passed 4
failed 0
skipped 0
warnings 0
*** C1366T02 PASSED (4)
*** C1366T03 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execveat_child.c:36: PASS: execveat_child run as expected
Summary:
passed 1
failed 0
skipped 0
warnings 0
*** C1366T03 PASSED (1)
*** C1366T04 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execve01_child.c:46: PASS: execve01_child executed
Summary:
passed 1
failed 0
skipped 0
warnings 0
*** C1366T04 PASSED (1)
*** C1366T05 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execve02.c:66: PASS: execve() failed expectedly: EACCES
Summary:
passed 1
failed 0
skipped 0
warnings 0
*** C1366T05 PASSED (1)
*** C1366T06 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execve03.c:144: PASS: execve failed as expected: ENAMETOOLONG
execve03.c:144: PASS: execve failed as expected: ENOENT
execve03.c:144: PASS: execve failed as expected: ENOTDIR
execve03.c:144: PASS: execve failed as expected: EFAULT
execve03.c:144: PASS: execve failed as expected: EACCES
execve03.c:144: PASS: execve failed as expected: ENOEXEC
Summary:
passed 6
failed 0
skipped 0
warnings 0
*** C1366T06 PASSED (6)
*** C1366T07 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
Summary:
passed 8
failed 0
skipped 0
warnings 0
*** C1366T07 PASSED (8)

View File

@@ -0,0 +1,95 @@
*** C1366T01 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execveat_child.c:36: PASS: execveat_child run as expected
execveat_child.c:36: PASS: execveat_child run as expected
execveat_child.c:36: PASS: execveat_child run as expected
execveat_child.c:36: PASS: execveat_child run as expected
Summary:
passed 4
failed 0
skipped 0
warnings 0
*** C1366T01 PASSED (4)
*** C1366T02 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execveat02.c:64: PASS: execveat() fails as expected: EBADF
execveat02.c:64: PASS: execveat() fails as expected: EINVAL
execveat02.c:64: PASS: execveat() fails as expected: ELOOP
execveat02.c:64: PASS: execveat() fails as expected: ENOTDIR
Summary:
passed 4
failed 0
skipped 0
warnings 0
*** C1366T02 PASSED (4)
*** C1366T03 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execveat_child.c:36: PASS: execveat_child run as expected
Summary:
passed 1
failed 0
skipped 0
warnings 0
*** C1366T03 PASSED (1)
*** C1366T04 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execve01_child.c:46: PASS: execve01_child executed
Summary:
passed 1
failed 0
skipped 0
warnings 0
*** C1366T04 PASSED (1)
*** C1366T05 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execve02.c:66: PASS: execve() failed expectedly: EACCES
Summary:
passed 1
failed 0
skipped 0
warnings 0
*** C1366T05 PASSED (1)
*** C1366T06 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execve03.c:144: PASS: execve failed as expected: ENAMETOOLONG
execve03.c:144: PASS: execve failed as expected: ENOENT
execve03.c:144: PASS: execve failed as expected: ENOTDIR
execve03.c:144: PASS: execve failed as expected: EFAULT
execve03.c:144: PASS: execve failed as expected: EACCES
execve03.c:144: PASS: execve failed as expected: ENOEXEC
Summary:
passed 6
failed 0
skipped 0
warnings 0
*** C1366T06 PASSED (6)
*** C1366T07 start *******************************
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
execve_child.c:34: PASS: argv[1] is canary, expected 'canary'
Summary:
passed 8
failed 0
skipped 0
warnings 0
*** C1366T07 PASSED (8)