Revert "shmobj: Support large page"
This reverts commit 9a60997ea0.
Change-Id: Id60959b4e03451987239faa0bbc2e780b72fafaa
This commit is contained in:
committed by
Masamichi Takagi
parent
40f8091fab
commit
d7cf39883f
@ -1,44 +0,0 @@
|
||||
#/bin/sh
|
||||
|
||||
USELTP=1
|
||||
USEOSTEST=0
|
||||
|
||||
. ../../common.sh
|
||||
|
||||
issue="1381"
|
||||
tid=01
|
||||
|
||||
arch=`uname -p`
|
||||
if [ "$arch" == "x86_64" ]; then
|
||||
pgshift=21
|
||||
elif [ "$arch" == "aarch64" ]; then
|
||||
pgshift=29
|
||||
fi
|
||||
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
${MCEXEC} ./C1381T01 ${pgshift}
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "*** ${tname} PASSED ******************************"
|
||||
else
|
||||
echo "*** ${tname} FAILED ******************************"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
|
||||
for tp in futex_wake04 shmat01 shmat02 shmat03 shmctl01 shmctl02 shmctl03 shmctl04 shmdt01 shmdt02 shmget01 shmget02 shmget03 shmget04 shmget05
|
||||
do
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
sudo $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
|
||||
@ -1,106 +0,0 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define PAGES 3
|
||||
#define MAP_HUGE_SHIFT 26
|
||||
|
||||
static unsigned long ps, hps;
|
||||
|
||||
void *test_mmap(unsigned long size, int pgshift)
|
||||
{
|
||||
int lp_flags = 0;
|
||||
|
||||
if (pgshift != 0) {
|
||||
lp_flags = MAP_HUGETLB | (pgshift << MAP_HUGE_SHIFT);
|
||||
}
|
||||
|
||||
return mmap(NULL, size, PROT_WRITE | PROT_READ,
|
||||
MAP_ANONYMOUS | MAP_SHARED |
|
||||
lp_flags,
|
||||
-1, 0);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
void *addr;
|
||||
int i, pgshift, err, ret = 0;
|
||||
size_t size;
|
||||
|
||||
if (argc < 2) {
|
||||
printf("error: too few arguments\n");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
pgshift = atoi(argv[1]);
|
||||
hps = (1 << pgshift);
|
||||
ps = getpagesize();
|
||||
|
||||
printf("** Case 1: specified MAP_HUGETLB\n");
|
||||
size = hps * PAGES;
|
||||
addr = test_mmap(size, pgshift);
|
||||
if (addr == MAP_FAILED) {
|
||||
perror("mmap fail: ");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
memset(addr, 'a', size);
|
||||
errno = 0;
|
||||
err = munmap(addr + size - ps, ps);
|
||||
if (err == -1 && errno == EINVAL) {
|
||||
printf("[OK] munmap returned %d and errno: EINVAL\n", err);
|
||||
}
|
||||
else {
|
||||
printf("[NG] munamp succceeded\n");
|
||||
ret = -1;
|
||||
// goto out;
|
||||
}
|
||||
|
||||
printf("** Case 2: size is aligned on large page\n");
|
||||
size = hps * PAGES;
|
||||
addr = test_mmap(size, 0);
|
||||
if (addr == MAP_FAILED) {
|
||||
perror("mmap fail: ");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
memset(addr, 'a', size);
|
||||
errno = 0;
|
||||
err = munmap(addr + size - ps, ps);
|
||||
if (err == -1 && errno == EINVAL) {
|
||||
printf("[OK] munmap returned %d and errno: EINVAL\n", err);
|
||||
}
|
||||
else {
|
||||
printf("[NG] munamp succceeded\n");
|
||||
ret = -1;
|
||||
// goto out;
|
||||
}
|
||||
|
||||
printf("** Case 3: size is NOT aligned on large page\n");
|
||||
size = hps * PAGES - ps;
|
||||
addr = test_mmap(size, 0);
|
||||
if (addr == MAP_FAILED) {
|
||||
perror("mmap fail: ");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
memset(addr, 'a', size);
|
||||
errno = 0;
|
||||
err = munmap(addr + size - ps, ps);
|
||||
if (err == 0 && errno == 0) {
|
||||
printf("[OK] munamp succceeded\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] munmap returned %d and errno: EINVAL\n", err);
|
||||
ret = -1;
|
||||
// goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
CFLAGS=-g
|
||||
LDFLAGS=
|
||||
|
||||
TARGET= C1381T01
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
test: all
|
||||
sh ./C1381.sh
|
||||
clean:
|
||||
rm -f $(TARGET) *.o *.txt
|
||||
@ -1,38 +0,0 @@
|
||||
【Issue#1381 動作確認】
|
||||
□ テスト内容
|
||||
1. 以下のケースでMAP_SHARED指定のmmapをした領域の、
|
||||
最後のスモールページ1ページ分をmunmapし、期待通りの動作となることを確認する
|
||||
- MAP_HUGETLB指定 : munmapが-1を返し、errnoにEINVALがセットされる
|
||||
- ラージページサイズの倍数のサイズ : munampが-1を返し、errnoにEINVALがセットされる
|
||||
- ラージページサイズの倍数ではないサイズ :munmapが成功する
|
||||
|
||||
2. Issueで報告された以下のLTPを実行し、症状が発生しないことを確認する
|
||||
- futex_wake04
|
||||
|
||||
3. 以下のLTPを用いて既存のshm機能に影響が無いことを確認
|
||||
- shmat01
|
||||
- shmat02
|
||||
- shmat03
|
||||
- shmctl01
|
||||
- shmctl02
|
||||
- shmctl03
|
||||
- shmctl04
|
||||
- shmdt01
|
||||
- shmdt02
|
||||
- shmget01
|
||||
- shmget02
|
||||
- shmget03
|
||||
- shmget04
|
||||
- shmget05
|
||||
|
||||
□ 実行手順
|
||||
$ 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していることを確認。
|
||||
@ -1,116 +0,0 @@
|
||||
*** C1381T01 start *******************************
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munmap returned -1 and errno: EINVAL
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munmap returned -1 and errno: EINVAL
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
*** C1381T01 PASSED ******************************
|
||||
|
||||
*** C1381T02 start *******************************
|
||||
futex_wake04 0 TINFO : Hugepagesize 536870912
|
||||
futex_wake04 1 TPASS : Hi hydra, thread2 awake!
|
||||
*** C1381T02 PASSED (1)
|
||||
|
||||
*** C1381T03 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach NULL address
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach aligned address
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach unaligned address with SHM_RND
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach aligned address with SHM_READONLY, and got S IGSEGV on write
|
||||
|
||||
Summary:
|
||||
passed 4
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1381T03 PASSED (4)
|
||||
|
||||
*** C1381T04 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
shmat02.c:68: PASS: shmat() failed as expected: EINVAL
|
||||
shmat02.c:68: PASS: shmat() failed as expected: EINVAL
|
||||
shmat02.c:68: PASS: shmat() failed as expected: EACCES
|
||||
|
||||
Summary:
|
||||
passed 3
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1381T04 PASSED (3)
|
||||
|
||||
*** C1381T05 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
shmat03.c:75: INFO: Attempting to attach shared memory to null page
|
||||
shmat03.c:91: INFO: Mapped shared memory to 0x1000001e0000
|
||||
shmat03.c:98: PASS: The kernel assigned a different VM address
|
||||
shmat03.c:101: INFO: Touching shared memory to see if anything strange happens
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1381T05 PASSED (1)
|
||||
|
||||
*** C1381T06 start *******************************
|
||||
shmctl01 1 TPASS : pid, size, # of attaches and mode are correct - pass #1
|
||||
shmctl01 2 TPASS : pid, size, # of attaches and mode are correct - pass #2
|
||||
shmctl01 3 TPASS : new mode and change time are correct
|
||||
shmctl01 4 TPASS : get correct shared memory limits
|
||||
shmctl01 5 TPASS : get correct shared memory id
|
||||
shmctl01 6 TPASS : SHM_LOCK is set
|
||||
shmctl01 7 TPASS : SHM_LOCK is cleared
|
||||
shmctl01 8 TPASS : shared memory appears to be removed
|
||||
*** C1381T06 PASSED (8)
|
||||
|
||||
*** C1381T07 start *******************************
|
||||
shmctl02 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
shmctl02 2 TPASS : expected failure - errno = 14 : Bad address
|
||||
shmctl02 3 TPASS : expected failure - errno = 14 : Bad address
|
||||
shmctl02 4 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmctl02 5 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmctl02 6 TCONF : shmctl02.c:138: shmctl() did not fail for non-root user.This may be okay for your distribution.
|
||||
shmctl02 7 TCONF : shmctl02.c:138: shmctl() did not fail for non-root user.This may be okay for your distribution.
|
||||
*** C1381T07 PASSED (5)
|
||||
|
||||
*** C1381T08 start *******************************
|
||||
shmctl03 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
shmctl03 2 TPASS : expected failure - errno = 1 : Operation not permitted
|
||||
shmctl03 3 TPASS : expected failure - errno = 1 : Operation not permitted
|
||||
*** C1381T08 PASSED (3)
|
||||
|
||||
*** C1381T09 start *******************************
|
||||
shmctl04 1 TPASS : SHM_INFO call succeeded
|
||||
*** C1381T09 PASSED (1)
|
||||
|
||||
*** C1381T10 start *******************************
|
||||
shmdt01 1 TPASS : shared memory detached correctly
|
||||
*** C1381T10 PASSED (1)
|
||||
|
||||
*** C1381T11 start *******************************
|
||||
shmdt02 1 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
*** C1381T11 PASSED (1)
|
||||
|
||||
*** C1381T12 start *******************************
|
||||
shmget01 1 TPASS : size, pid & mode are correct
|
||||
*** C1381T12 PASSED (1)
|
||||
|
||||
*** C1381T13 start *******************************
|
||||
shmget02 1 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmget02 2 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmget02 3 TPASS : expected failure - errno = 17 : File exists
|
||||
shmget02 4 TPASS : expected failure - errno = 2 : No such file or directory
|
||||
*** C1381T13 PASSED (4)
|
||||
|
||||
*** C1381T14 start *******************************
|
||||
shmget03 1 TPASS : expected failure - errno = 28 : No space left on device
|
||||
*** C1381T14 PASSED (1)
|
||||
|
||||
*** C1381T15 start *******************************
|
||||
shmget04 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
*** C1381T15 PASSED (1)
|
||||
|
||||
*** C1381T16 start *******************************
|
||||
shmget05 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
*** C1381T16 PASSED (1)
|
||||
@ -1,116 +0,0 @@
|
||||
*** C1381T01 start *******************************
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munmap returned -1 and errno: EINVAL
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munmap returned -1 and errno: EINVAL
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
*** C1381T01 PASSED ******************************
|
||||
|
||||
*** C1381T02 start *******************************
|
||||
futex_wake04 0 TINFO : Hugepagesize 2097152
|
||||
futex_wake04 1 TPASS : Hi hydra, thread2 awake!
|
||||
*** C1381T02 PASSED (1)
|
||||
|
||||
*** C1381T03 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach NULL address
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach aligned address
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach unaligned address with SHM_RND
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach aligned address with SHM_READONLY, and got SIGSEGV on write
|
||||
|
||||
Summary:
|
||||
passed 4
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1381T03 PASSED (4)
|
||||
|
||||
*** C1381T04 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
shmat02.c:68: PASS: shmat() failed as expected: EINVAL
|
||||
shmat02.c:68: PASS: shmat() failed as expected: EINVAL
|
||||
shmat02.c:68: PASS: shmat() failed as expected: EACCES
|
||||
|
||||
Summary:
|
||||
passed 3
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1381T04 PASSED (3)
|
||||
|
||||
*** C1381T05 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
shmat03.c:75: INFO: Attempting to attach shared memory to null page
|
||||
shmat03.c:91: INFO: Mapped shared memory to 0x2aaaaadea000
|
||||
shmat03.c:98: PASS: The kernel assigned a different VM address
|
||||
shmat03.c:101: INFO: Touching shared memory to see if anything strange happens
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1381T05 PASSED (1)
|
||||
|
||||
*** C1381T06 start *******************************
|
||||
shmctl01 1 TPASS : pid, size, # of attaches and mode are correct - pass #1
|
||||
shmctl01 2 TPASS : pid, size, # of attaches and mode are correct - pass #2
|
||||
shmctl01 3 TPASS : new mode and change time are correct
|
||||
shmctl01 4 TPASS : get correct shared memory limits
|
||||
shmctl01 5 TPASS : get correct shared memory id
|
||||
shmctl01 6 TPASS : SHM_LOCK is set
|
||||
shmctl01 7 TPASS : SHM_LOCK is cleared
|
||||
shmctl01 8 TPASS : shared memory appears to be removed
|
||||
*** C1381T06 PASSED (8)
|
||||
|
||||
*** C1381T07 start *******************************
|
||||
shmctl02 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
shmctl02 2 TPASS : expected failure - errno = 14 : Bad address
|
||||
shmctl02 3 TPASS : expected failure - errno = 14 : Bad address
|
||||
shmctl02 4 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmctl02 5 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmctl02 6 TCONF : shmctl02.c:138: shmctl() did not fail for non-root user.This may be okay for your distribution.
|
||||
shmctl02 7 TCONF : shmctl02.c:138: shmctl() did not fail for non-root user.This may be okay for your distribution.
|
||||
*** C1381T07 PASSED (5)
|
||||
|
||||
*** C1381T08 start *******************************
|
||||
shmctl03 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
shmctl03 2 TPASS : expected failure - errno = 1 : Operation not permitted
|
||||
shmctl03 3 TPASS : expected failure - errno = 1 : Operation not permitted
|
||||
*** C1381T08 PASSED (3)
|
||||
|
||||
*** C1381T09 start *******************************
|
||||
shmctl04 1 TPASS : SHM_INFO call succeeded
|
||||
*** C1381T09 PASSED (1)
|
||||
|
||||
*** C1381T10 start *******************************
|
||||
shmdt01 1 TPASS : shared memory detached correctly
|
||||
*** C1381T10 PASSED (1)
|
||||
|
||||
*** C1381T11 start *******************************
|
||||
shmdt02 1 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
*** C1381T11 PASSED (1)
|
||||
|
||||
*** C1381T12 start *******************************
|
||||
shmget01 1 TPASS : size, pid & mode are correct
|
||||
*** C1381T12 PASSED (1)
|
||||
|
||||
*** C1381T13 start *******************************
|
||||
shmget02 1 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmget02 2 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmget02 3 TPASS : expected failure - errno = 17 : File exists
|
||||
shmget02 4 TPASS : expected failure - errno = 2 : No such file or directory
|
||||
*** C1381T13 PASSED (4)
|
||||
|
||||
*** C1381T14 start *******************************
|
||||
shmget03 1 TPASS : expected failure - errno = 28 : No space left on device
|
||||
*** C1381T14 PASSED (1)
|
||||
|
||||
*** C1381T15 start *******************************
|
||||
shmget04 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
*** C1381T15 PASSED (1)
|
||||
|
||||
*** C1381T16 start *******************************
|
||||
shmget05 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
*** C1381T16 PASSED (1)
|
||||
@ -1,267 +0,0 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define PAGES 3
|
||||
#define MAP_HUGE_SHIFT 26
|
||||
|
||||
static unsigned long ps, hps;
|
||||
|
||||
void *test_mmap(unsigned long size, int pgshift)
|
||||
{
|
||||
int lp_flags = 0;
|
||||
|
||||
if (pgshift != 0) {
|
||||
lp_flags = MAP_HUGETLB | (pgshift << MAP_HUGE_SHIFT);
|
||||
}
|
||||
|
||||
return mmap(NULL, size, PROT_WRITE | PROT_READ,
|
||||
MAP_ANONYMOUS | MAP_SHARED |
|
||||
lp_flags,
|
||||
-1, 0);
|
||||
}
|
||||
|
||||
int check_data(char *data_head, char chk_data, unsigned long off1,
|
||||
unsigned long off2, unsigned long off3)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if (*(data_head + off1) == chk_data &&
|
||||
*(data_head + off2) == chk_data &&
|
||||
*(data_head + off3) == chk_data) {
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
void *addr;
|
||||
int map_pgshift, unmap_pgshift, pid, status, err, ret = 0;
|
||||
size_t size, unmap_off;
|
||||
|
||||
if (argc < 3) {
|
||||
printf("error: too few arguments\n");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
map_pgshift = atoi(argv[1]);
|
||||
unmap_pgshift = atoi(argv[2]);
|
||||
hps = (1 << map_pgshift);
|
||||
ps = (1 << unmap_pgshift);
|
||||
unmap_off = hps * (PAGES - 1) - ps;
|
||||
|
||||
printf("** Case 1: specified MAP_HUGETLB\n");
|
||||
size = hps * PAGES;
|
||||
addr = test_mmap(size, map_pgshift);
|
||||
if (addr == MAP_FAILED) {
|
||||
perror("mmap fail: ");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
memset(addr, 'a', size);
|
||||
err = munmap(addr + unmap_off, ps);
|
||||
if (err == 0) {
|
||||
printf("[OK] munamp succceeded\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] munmap returned %d and errno: EINVAL\n", err);
|
||||
ret = -1;
|
||||
// goto out;
|
||||
}
|
||||
|
||||
if (check_data((char *)addr, 'a',
|
||||
0, unmap_off - 1, unmap_off + ps) == 0) {
|
||||
printf("[OK] data is correct\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] data is NOT correct\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
/* Child */
|
||||
memset(addr, 'b', unmap_off);
|
||||
memset(addr + unmap_off + ps, 'b', hps);
|
||||
memset(addr + unmap_off, '0', ps); /* expect SEGV */
|
||||
return 0;
|
||||
}
|
||||
else if (pid > 0) {
|
||||
/* Parent */
|
||||
if (waitpid(pid, &status, 0) == pid) {
|
||||
if (WIFSIGNALED(status) &&
|
||||
WTERMSIG(status) == SIGSEGV) {
|
||||
printf("[OK] Occurred SEGV on unmap area\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] Didn't occur SEGV\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] waitpid failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] fork failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if (check_data((char *)addr, 'b',
|
||||
0, unmap_off - 1, unmap_off + ps) == 0) {
|
||||
printf("[OK] data is correct\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] data is NOT correct\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
printf("** Case 2: size is aligned on large page\n");
|
||||
size = hps * PAGES;
|
||||
addr = test_mmap(size, 0);
|
||||
if (addr == MAP_FAILED) {
|
||||
perror("mmap fail: ");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
memset(addr, 'a', size);
|
||||
err = munmap(addr + unmap_off, ps);
|
||||
if (err == 0) {
|
||||
printf("[OK] munamp succceeded\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] munmap returned %d and errno: EINVAL\n", err);
|
||||
ret = -1;
|
||||
// goto out;
|
||||
}
|
||||
|
||||
if (check_data((char *)addr, 'a',
|
||||
0, unmap_off - 1, unmap_off + ps) == 0) {
|
||||
printf("[OK] data is correct\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] data is NOT correct\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
/* Child */
|
||||
memset(addr, 'b', unmap_off);
|
||||
memset(addr + unmap_off + ps, 'b', hps);
|
||||
memset(addr + unmap_off, '0', ps); /* expect SEGV */
|
||||
return 0;
|
||||
}
|
||||
else if (pid > 0) {
|
||||
/* Parent */
|
||||
if (waitpid(pid, &status, 0) == pid) {
|
||||
if (WIFSIGNALED(status) &&
|
||||
WTERMSIG(status) == SIGSEGV) {
|
||||
printf("[OK] Occurred SEGV on unmap area\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] Didn't occur SEGV\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] waitpid failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] fork failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if (check_data((char *)addr, 'b',
|
||||
0, unmap_off - 1, unmap_off + ps) == 0) {
|
||||
printf("[OK] data is correct\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] data is NOT correct\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
printf("** Case 3: size is NOT aligned on large page\n");
|
||||
size = hps * PAGES - ps;
|
||||
addr = test_mmap(size, 0);
|
||||
if (addr == MAP_FAILED) {
|
||||
perror("mmap fail: ");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
memset(addr, 'a', size);
|
||||
err = munmap(addr + unmap_off, ps);
|
||||
if (err == 0) {
|
||||
printf("[OK] munamp succceeded\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] munmap returned %d and errno: EINVAL\n", err);
|
||||
ret = -1;
|
||||
// goto out;
|
||||
}
|
||||
|
||||
if (check_data((char *)addr, 'a',
|
||||
0, unmap_off - 1, unmap_off + ps) == 0) {
|
||||
printf("[OK] data is correct\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] data is NOT correct\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
/* Child */
|
||||
memset(addr, 'b', unmap_off);
|
||||
memset(addr + unmap_off + ps, 'b', hps);
|
||||
memset(addr + unmap_off, '0', ps); /* expect SEGV */
|
||||
return 0;
|
||||
}
|
||||
else if (pid > 0) {
|
||||
/* Parent */
|
||||
if (waitpid(pid, &status, 0) == pid) {
|
||||
if (WIFSIGNALED(status) &&
|
||||
WTERMSIG(status) == SIGSEGV) {
|
||||
printf("[OK] Occurred SEGV on unmap area\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] Didn't occur SEGV\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] waitpid failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] fork failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if (check_data((char *)addr, 'b',
|
||||
0, unmap_off - 1, unmap_off + ps) == 0) {
|
||||
printf("[OK] data is correct\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] data is NOT correct\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
SCRIPT_PATH=$(readlink -m "${BASH_SOURCE[0]}")
|
||||
SCRIPT_NAME="${SCRIPT_PATH##*/}"
|
||||
|
||||
# prepare recorddir
|
||||
. @CMAKE_INSTALL_PREFIX@/bin/common.sh
|
||||
recorddir=$WORKDIR/output/$SCRIPT_NAME
|
||||
[[ ! -d $recorddir ]] && mkdir -p $recorddir
|
||||
|
||||
issue="1458"
|
||||
tid=01
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
|
||||
echo "*** ${tname} start *******************************"
|
||||
ng=0
|
||||
for mapps in ${PS_LIST}
|
||||
do
|
||||
for unmapps in ${PS_LIST}
|
||||
do
|
||||
if [ $unmapps -ge $mapps ]; then
|
||||
continue
|
||||
fi
|
||||
log_file=$recorddir/${SCRIPT_NAME}.log
|
||||
echo "** Map pgshift:${mapps} Unmap pgshift:${unmapps}" | tee $log_file
|
||||
sudo @WITH_MCK@/bin/mcexec @CMAKE_INSTALL_PREFIX@/bin/${tname} ${mapps} ${unmapps} | tee $log_file
|
||||
if [ $? -ne 0 ]; then
|
||||
$((++ng))
|
||||
fi
|
||||
done
|
||||
done
|
||||
if [ $ng -eq 0 ]; then
|
||||
echo "*** ${tname} PASSED ******************************"
|
||||
else
|
||||
echo "*** ${tname} FAILED ******************************"
|
||||
fi
|
||||
exit $ng
|
||||
|
||||
@ -1,238 +0,0 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define PAGES 3
|
||||
#define MAP_HUGE_SHIFT 26
|
||||
|
||||
static unsigned long ps, hps;
|
||||
|
||||
void *test_mmap(unsigned long size, int pgshift)
|
||||
{
|
||||
int lp_flags = 0;
|
||||
|
||||
if (pgshift != 0) {
|
||||
lp_flags = MAP_HUGETLB | (pgshift << MAP_HUGE_SHIFT);
|
||||
}
|
||||
|
||||
return mmap(NULL, size, PROT_WRITE | PROT_READ,
|
||||
MAP_ANONYMOUS | MAP_SHARED |
|
||||
lp_flags,
|
||||
-1, 0);
|
||||
}
|
||||
|
||||
int check_data(char *data_head, char chk_data, unsigned long off1,
|
||||
unsigned long off2, unsigned long off3)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if (*(data_head + off1) == chk_data &&
|
||||
*(data_head + off2) == chk_data &&
|
||||
*(data_head + off3) == chk_data) {
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
void *addr;
|
||||
int map_pgshift, unmap_pgshift, pid, status, err, ret = 0;
|
||||
size_t size, unmap_off;
|
||||
|
||||
if (argc < 3) {
|
||||
printf("error: too few arguments\n");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
map_pgshift = atoi(argv[1]);
|
||||
unmap_pgshift = atoi(argv[2]);
|
||||
hps = (1 << map_pgshift);
|
||||
ps = (1 << unmap_pgshift);
|
||||
unmap_off = hps * (PAGES - 1) - ps;
|
||||
|
||||
printf("** Case 1: specified MAP_HUGETLB\n");
|
||||
size = hps * PAGES;
|
||||
unmap_off = hps * (PAGES - 1) - ps;
|
||||
addr = test_mmap(size, map_pgshift);
|
||||
if (addr == MAP_FAILED) {
|
||||
perror("mmap fail: ");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
err = munmap(addr + unmap_off, ps);
|
||||
if (err == 0 && errno == 0) {
|
||||
printf("[OK] munamp succceeded\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] munmap returned %d and errno: EINVAL\n", err);
|
||||
ret = -1;
|
||||
// goto out;
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
/* Child */
|
||||
memset(addr, 'b', unmap_off);
|
||||
memset(addr + unmap_off + ps, 'b', hps);
|
||||
memset(addr + unmap_off, '0', ps); /* expect SEGV */
|
||||
return 0;
|
||||
}
|
||||
else if (pid > 0) {
|
||||
/* Parent */
|
||||
if (waitpid(pid, &status, 0) == pid) {
|
||||
if (WIFSIGNALED(status) &&
|
||||
WTERMSIG(status) == SIGSEGV) {
|
||||
printf("[OK] Occurred SEGV on unmap area\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] Didn't occur SEGV\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] waitpid failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] fork failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if (check_data((char *)addr, 'b',
|
||||
0, unmap_off - 1, unmap_off + ps) == 0) {
|
||||
printf("[OK] data is correct\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] data is NOT correct\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
printf("** Case 2: size is aligned on large page\n");
|
||||
size = hps * PAGES;
|
||||
addr = test_mmap(size, 0);
|
||||
if (addr == MAP_FAILED) {
|
||||
perror("mmap fail: ");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
err = munmap(addr + unmap_off, ps);
|
||||
if (err == 0 && errno == 0) {
|
||||
printf("[OK] munamp succceeded\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] munmap returned %d and errno: EINVAL\n", err);
|
||||
ret = -1;
|
||||
// goto out;
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
/* Child */
|
||||
memset(addr, 'b', unmap_off);
|
||||
memset(addr + unmap_off + ps, 'b', hps);
|
||||
memset(addr + unmap_off, '0', ps); /* expect SEGV */
|
||||
return 0;
|
||||
}
|
||||
else if (pid > 0) {
|
||||
/* Parent */
|
||||
if (waitpid(pid, &status, 0) == pid) {
|
||||
if (WIFSIGNALED(status) &&
|
||||
WTERMSIG(status) == SIGSEGV) {
|
||||
printf("[OK] Occurred SEGV on unmap area\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] Didn't occur SEGV\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] waitpid failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] fork failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if (check_data((char *)addr, 'b',
|
||||
0, unmap_off - 1, unmap_off + ps) == 0) {
|
||||
printf("[OK] data is correct\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] data is NOT correct\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
printf("** Case 3: size is NOT aligned on large page\n");
|
||||
size = hps * PAGES - ps;
|
||||
addr = test_mmap(size, 0);
|
||||
if (addr == MAP_FAILED) {
|
||||
perror("mmap fail: ");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
err = munmap(addr + unmap_off, ps);
|
||||
if (err == 0 && errno == 0) {
|
||||
printf("[OK] munamp succceeded\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] munmap returned %d and errno: EINVAL\n", err);
|
||||
ret = -1;
|
||||
// goto out;
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
/* Child */
|
||||
memset(addr, 'b', unmap_off);
|
||||
memset(addr + unmap_off + ps, 'b', hps);
|
||||
memset(addr + unmap_off, '0', ps); /* expect SEGV */
|
||||
return 0;
|
||||
}
|
||||
else if (pid > 0) {
|
||||
/* Parent */
|
||||
if (waitpid(pid, &status, 0) == pid) {
|
||||
if (WIFSIGNALED(status) &&
|
||||
WTERMSIG(status) == SIGSEGV) {
|
||||
printf("[OK] Occurred SEGV on unmap area\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] Didn't occur SEGV\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] waitpid failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] fork failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if (check_data((char *)addr, 'b',
|
||||
0, unmap_off - 1, unmap_off + ps) == 0) {
|
||||
printf("[OK] data is correct\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] data is NOT correct\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
SCRIPT_PATH=$(readlink -m "${BASH_SOURCE[0]}")
|
||||
SCRIPT_NAME="${SCRIPT_PATH##*/}"
|
||||
|
||||
# prepare recorddir
|
||||
. @CMAKE_INSTALL_PREFIX@/bin/common.sh
|
||||
recorddir=$WORKDIR/output/$SCRIPT_NAME
|
||||
[[ ! -d $recorddir ]] && mkdir -p $recorddir
|
||||
|
||||
issue="1458"
|
||||
tid=02
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
|
||||
echo "*** ${tname} start *******************************"
|
||||
ng=0
|
||||
for mapps in ${PS_LIST}
|
||||
do
|
||||
for unmapps in ${PS_LIST}
|
||||
do
|
||||
if [ $unmapps -ge $mapps ]; then
|
||||
continue
|
||||
fi
|
||||
log_file=$recorddir/${SCRIPT_NAME}.log
|
||||
echo "** Map pgshift:${mapps} Unmap pgshift:${unmapps}" | tee $log_file
|
||||
sudo @WITH_MCK@/bin/mcexec @CMAKE_INSTALL_PREFIX@/bin/${tname} ${mapps} ${unmapps} | tee $log_file
|
||||
if [ $? -ne 0 ]; then
|
||||
$((++ng))
|
||||
fi
|
||||
done
|
||||
done
|
||||
if [ $ng -eq 0 ]; then
|
||||
echo "*** ${tname} PASSED ******************************"
|
||||
else
|
||||
echo "*** ${tname} FAILED ******************************"
|
||||
fi
|
||||
exit $ng
|
||||
|
||||
@ -1,263 +0,0 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
#define PAGES 3
|
||||
#define MAP_HUGE_SHIFT 26
|
||||
|
||||
static unsigned long ps, hps;
|
||||
static int shmid = -1;
|
||||
|
||||
void *test_shmget(key_t key, unsigned long size, int pgshift)
|
||||
{
|
||||
int shm_flags = 0;
|
||||
|
||||
if (pgshift != 0) {
|
||||
shm_flags |= SHM_HUGETLB;
|
||||
}
|
||||
|
||||
shmid = shmget(key, size, IPC_CREAT | 0660 | shm_flags);
|
||||
if (shmid == -1) {
|
||||
perror("shmget fail:");
|
||||
return NULL;
|
||||
}
|
||||
printf("shmid: %d\n", shmid);
|
||||
return shmat(shmid, NULL, 0);
|
||||
}
|
||||
|
||||
int check_data(char *data_head, char chk_data, unsigned long off1,
|
||||
unsigned long off2, unsigned long off3)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if (*(data_head + off1) == chk_data &&
|
||||
*(data_head + off2) == chk_data &&
|
||||
*(data_head + off3) == chk_data) {
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
void *addr;
|
||||
int map_pgshift, unmap_pgshift, pid, status, err, ret = 0;
|
||||
size_t size, unmap_off;
|
||||
key_t key = ftok(argv[0], 0);
|
||||
|
||||
if (argc < 3) {
|
||||
printf("error: too few arguments\n");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
map_pgshift = atoi(argv[1]);
|
||||
unmap_pgshift = atoi(argv[2]);
|
||||
hps = (1 << map_pgshift);
|
||||
ps = (1 << unmap_pgshift);
|
||||
unmap_off = hps * (PAGES - 1) - ps;
|
||||
|
||||
printf("** Case 1: specified MAP_HUGETLB\n");
|
||||
size = hps * PAGES;
|
||||
addr = test_shmget(key, size, map_pgshift);
|
||||
if (addr == MAP_FAILED) {
|
||||
perror("mmap fail: ");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
err = munmap(addr + unmap_off, ps);
|
||||
if (err == 0) {
|
||||
printf("[OK] munamp succceeded\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] munmap returned %d and errno: EINVAL\n", err);
|
||||
ret = -1;
|
||||
// goto out;
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
/* Child */
|
||||
memset(addr, 'b', unmap_off);
|
||||
memset(addr + unmap_off + ps, 'b', hps);
|
||||
memset(addr + unmap_off, '0', ps); /* expect SEGV */
|
||||
return 0;
|
||||
}
|
||||
else if (pid > 0) {
|
||||
/* Parent */
|
||||
if (waitpid(pid, &status, 0) == pid) {
|
||||
if (WIFSIGNALED(status) &&
|
||||
WTERMSIG(status) == SIGSEGV) {
|
||||
printf("[OK] Occurred SEGV on unmap area\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] Didn't occur SEGV\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] waitpid failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] fork failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if (check_data((char *)addr, 'b',
|
||||
0, unmap_off - 1, unmap_off + ps) == 0) {
|
||||
printf("[OK] data is correct\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] data is NOT correct\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if (shmctl(shmid, IPC_RMID, NULL) == -1) {
|
||||
printf("[NG] shmctl(IPC_RMID) failed\n");
|
||||
}
|
||||
else {
|
||||
printf("[OK] shmctl(IPC_RMID) succeeded\n");
|
||||
}
|
||||
|
||||
printf("** Case 2: size is aligned on large page\n");
|
||||
size = hps * PAGES;
|
||||
addr = test_shmget(key, size, 0);
|
||||
if (addr == MAP_FAILED) {
|
||||
perror("mmap fail: ");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
err = munmap(addr + unmap_off, ps);
|
||||
if (err == 0) {
|
||||
printf("[OK] munamp succceeded\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] munmap returned %d and errno: EINVAL\n", err);
|
||||
ret = -1;
|
||||
// goto out;
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
/* Child */
|
||||
memset(addr, 'b', unmap_off);
|
||||
memset(addr + unmap_off + ps, 'b', hps);
|
||||
memset(addr + unmap_off, '0', ps); /* expect SEGV */
|
||||
return 0;
|
||||
}
|
||||
else if (pid > 0) {
|
||||
/* Parent */
|
||||
if (waitpid(pid, &status, 0) == pid) {
|
||||
if (WIFSIGNALED(status) &&
|
||||
WTERMSIG(status) == SIGSEGV) {
|
||||
printf("[OK] Occurred SEGV on unmap area\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] Didn't occur SEGV\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] waitpid failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] fork failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if (check_data((char *)addr, 'b',
|
||||
0, unmap_off - 1, unmap_off + ps) == 0) {
|
||||
printf("[OK] data is correct\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] data is NOT correct\n");
|
||||
ret = -1;
|
||||
}
|
||||
if (shmctl(shmid, IPC_RMID, NULL) == -1) {
|
||||
printf("[NG] shmctl(IPC_RMID) failed\n");
|
||||
}
|
||||
else {
|
||||
printf("[OK] shmctl(IPC_RMID) succeeded\n");
|
||||
}
|
||||
|
||||
printf("** Case 3: size is NOT aligned on large page\n");
|
||||
size = hps * PAGES - ps;
|
||||
addr = test_shmget(key, size, 0);
|
||||
if (addr == MAP_FAILED) {
|
||||
perror("mmap fail: ");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
err = munmap(addr + unmap_off, ps);
|
||||
if (err == 0) {
|
||||
printf("[OK] munamp succceeded\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] munmap returned %d and errno: EINVAL\n", err);
|
||||
ret = -1;
|
||||
// goto out;
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
/* Child */
|
||||
memset(addr, 'b', unmap_off);
|
||||
memset(addr + unmap_off + ps, 'b', hps);
|
||||
memset(addr + unmap_off, '0', ps); /* expect SEGV */
|
||||
return 0;
|
||||
}
|
||||
else if (pid > 0) {
|
||||
/* Parent */
|
||||
if (waitpid(pid, &status, 0) == pid) {
|
||||
if (WIFSIGNALED(status) &&
|
||||
WTERMSIG(status) == SIGSEGV) {
|
||||
printf("[OK] Occurred SEGV on unmap area\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] Didn't occur SEGV\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] waitpid failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[NG] fork failed\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if (check_data((char *)addr, 'b',
|
||||
0, unmap_off - 1, unmap_off + ps) == 0) {
|
||||
printf("[OK] data is correct\n");
|
||||
}
|
||||
else {
|
||||
printf("[NG] data is NOT correct\n");
|
||||
ret = -1;
|
||||
}
|
||||
if (shmctl(shmid, IPC_RMID, NULL) == -1) {
|
||||
printf("[NG] shmctl(IPC_RMID) failed\n");
|
||||
}
|
||||
else {
|
||||
printf("[OK] shmctl(IPC_RMID) succeeded\n");
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
SCRIPT_PATH=$(readlink -m "${BASH_SOURCE[0]}")
|
||||
SCRIPT_NAME="${SCRIPT_PATH##*/}"
|
||||
|
||||
# prepare recorddir
|
||||
. @CMAKE_INSTALL_PREFIX@/bin/common.sh
|
||||
recorddir=$WORKDIR/output/$SCRIPT_NAME
|
||||
[[ ! -d $recorddir ]] && mkdir -p $recorddir
|
||||
|
||||
issue="1458"
|
||||
tid=03
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
|
||||
echo "*** ${tname} start *******************************"
|
||||
ng=0
|
||||
for mapps in ${PS_LIST}
|
||||
do
|
||||
for unmapps in ${PS_LIST}
|
||||
do
|
||||
if [ $unmapps -ge $mapps ]; then
|
||||
continue
|
||||
fi
|
||||
log_file=$recorddir/${SCRIPT_NAME}.log
|
||||
echo "** Map pgshift:${mapps} Unmap pgshift:${unmapps}" | tee $log_file
|
||||
sudo @WITH_MCK@/bin/mcexec @CMAKE_INSTALL_PREFIX@/bin/${tname} ${mapps} ${unmapps} | tee $log_file
|
||||
if [ $? -ne 0 ]; then
|
||||
$((++ng))
|
||||
fi
|
||||
done
|
||||
done
|
||||
if [ $ng -eq 0 ]; then
|
||||
echo "*** ${tname} PASSED ******************************"
|
||||
else
|
||||
echo "*** ${tname} FAILED ******************************"
|
||||
fi
|
||||
exit $ng
|
||||
|
||||
@ -1,69 +0,0 @@
|
||||
cmake_policy(SET CMP0005 NEW)
|
||||
|
||||
# Options: -DWITH_MCK=<McKernel install directory>
|
||||
add_definitions(-DWITH_MCK=${WITH_MCK})
|
||||
|
||||
# Options: -DWITH_MCK_SRC=<McKernel source directory>
|
||||
add_definitions(-DWITH_MCK_SRC=${WITH_MCK_SRC})
|
||||
|
||||
# not used when integrated with autotest
|
||||
# Options: -DWITH_MCK_BUILD=<McKernel build directory>
|
||||
add_definitions(-DWITH_MCK_BUILD=${WITH_MCK_BUILD})
|
||||
|
||||
# for autotest
|
||||
if(NOT DEFINED CMAKE_INSTALL_PREFIX_SCRIPTS)
|
||||
set(CMAKE_INSTALL_PREFIX_SCRIPTS ${CMAKE_INSTALL_PREFIX}/scripts)
|
||||
endif()
|
||||
|
||||
cmake_minimum_required(VERSION 2.0)
|
||||
|
||||
project(myautotest C)
|
||||
|
||||
# CPPFLAGS
|
||||
|
||||
# CFLAGS
|
||||
set(CFLAGS_WARNING "-Wall" "-Wextra" "-Wno-unused-parameter" "-Wno-sign-compare" "-Wno-unused-function" ${EXTRA_WARNINGS} CACHE STRING "Warning flags")
|
||||
add_compile_options(-O2 -g ${CFLAGS_WARNING})
|
||||
|
||||
# -L, this must be done before adding dependants
|
||||
|
||||
# -Wl,--rpath=, this must be done before adding dependants
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
foreach(target IN ITEMS
|
||||
C1458T01
|
||||
C1458T02
|
||||
C1458T03
|
||||
)
|
||||
|
||||
# Add target
|
||||
add_executable(${target} ${target}.c)
|
||||
|
||||
# -D
|
||||
|
||||
# -I
|
||||
|
||||
# -l
|
||||
|
||||
# String replacement and install
|
||||
configure_file(${target}.sh.in shmobj-${target} @ONLY)
|
||||
|
||||
# Install
|
||||
install(TARGETS ${target} DESTINATION bin)
|
||||
install(PROGRAMS ${CMAKE_BINARY_DIR}/shmobj-${target} DESTINATION ${CMAKE_INSTALL_PREFIX_SCRIPTS})
|
||||
endforeach()
|
||||
|
||||
foreach(target IN ITEMS
|
||||
common.sh
|
||||
)
|
||||
configure_file(${target}.in ${target} @ONLY)
|
||||
install(PROGRAMS ${CMAKE_BINARY_DIR}/${target} DESTINATION bin)
|
||||
endforeach()
|
||||
|
||||
foreach(target IN ITEMS
|
||||
x86_64.conf
|
||||
aarch64.conf
|
||||
)
|
||||
install(FILES ${target} DESTINATION etc)
|
||||
endforeach()
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
【Issue#1458 動作確認】
|
||||
□ テスト内容
|
||||
1. C1458T01
|
||||
以下のケースでMAP_SHARED指定のmmapをした領域についてページインした後、
|
||||
最後から2番めのラージページの最後の部分をより小さいページサイズ1ページ分でunmapし、
|
||||
期待通りの動作となることを確認する
|
||||
また、当該領域への読み書き操作が正常に行えることを確認する
|
||||
- MAP_HUGETLB指定 : munmapが成功する
|
||||
- ラージページサイズの倍数のサイズ : munmapが成功する
|
||||
- ラージページサイズの倍数ではないサイズ :munmapが成功する
|
||||
|
||||
2. C1458T02
|
||||
以下のケースでMAP_SHARED指定のmmapをした領域についてページインする前に、
|
||||
最後から2番めのラージページの最後の部分をより小さいページサイズ1ページ分でunmapし、
|
||||
期待通りの動作となることを確認する
|
||||
また、当該領域への読み書き操作が正常に行えることを確認する
|
||||
- MAP_HUGETLB指定 : munmapが成功する
|
||||
- ラージページサイズの倍数のサイズ : munmapが成功する
|
||||
- ラージページサイズの倍数ではないサイズ :munmapが成功する
|
||||
|
||||
3. C1458T03
|
||||
以下のケースでshmget()で作成した共有メモリ領域の、
|
||||
最後から2番めのラージページの最後の部分をより小さいページサイズ1ページ分でunmapし、
|
||||
期待通りの動作となることを確認する
|
||||
また、当該領域への読み書き操作が正常に行えることを確認する
|
||||
- MAP_HUGETLB指定 : munmapが成功する
|
||||
- ラージページサイズの倍数のサイズ : munmapが成功する
|
||||
- ラージページサイズの倍数ではないサイズ :munmapが成功する
|
||||
|
||||
4. 以下のLTPを用いて既存のshm機能に影響が無いことを確認する
|
||||
- shmat01
|
||||
- shmat02
|
||||
- shmat03
|
||||
- shmctl01
|
||||
- shmctl02
|
||||
- shmctl03
|
||||
- shmctl04
|
||||
- shmdt01
|
||||
- shmdt02
|
||||
- shmget01
|
||||
- shmget02
|
||||
- shmget03
|
||||
- shmget04
|
||||
- shmget05
|
||||
|
||||
□ 実行手順
|
||||
1. McKernelをビルドした際に生成されるmck_test_config.sample ファイルを
|
||||
$HOME/.mck_test_configとしてコピーし、パスを編集する。
|
||||
|
||||
2. 以下の手順でビルドと実行を行う
|
||||
$ (build mckernel)
|
||||
$ cd <mckernel>/test/issues/1458
|
||||
$ mkdir build && cd build
|
||||
$ cmake ../ -DWITH_MCK=<mck_install_dir> -DWITH_MCK_SRC=<mck_src_dir> -DWITH_MCK_BUILD=<mck_build_dir> -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_INSTALL_PREFIX_SCRIPTS=./install/data/scripts
|
||||
$ make install
|
||||
$ ./install/scripts/issue-C1458T01
|
||||
$ ./install/scripts/issue-C1458T02
|
||||
$ ./install/scripts/issue-C1458T03
|
||||
|
||||
$ cd <mckernel>/test/issues/1458
|
||||
$ ./regression_test.sh
|
||||
|
||||
□ 実行結果
|
||||
x86_64_result.log aarch64_result.log 参照。
|
||||
すべての項目をPASSしていることを確認。
|
||||
@ -1 +0,0 @@
|
||||
PS_LIST="16 21 29"
|
||||
@ -1,248 +0,0 @@
|
||||
*** C1458T01 start *******************************
|
||||
** Map pgshift:21 Unmap pgshift:16
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Map pgshift:29 Unmap pgshift:16
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Map pgshift:29 Unmap pgshift:21
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
*** C1458T01 PASSED ******************************
|
||||
*** C1458T02 start *******************************
|
||||
** Map pgshift:21 Unmap pgshift:16
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Map pgshift:29 Unmap pgshift:16
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Map pgshift:29 Unmap pgshift:21
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
*** C1458T02 PASSED ******************************
|
||||
*** C1458T03 start *******************************
|
||||
** Map pgshift:21 Unmap pgshift:16
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
shmid: 18
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Case 2: size is aligned on large page
|
||||
shmid: 65555
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Case 3: size is NOT aligned on large page
|
||||
shmid: 131092
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Map pgshift:29 Unmap pgshift:16
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
shmid: 21
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Case 2: size is aligned on large page
|
||||
shmid: 65558
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Case 3: size is NOT aligned on large page
|
||||
shmid: 131095
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Map pgshift:29 Unmap pgshift:21
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
shmid: 24
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Case 2: size is aligned on large page
|
||||
shmid: 65561
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Case 3: size is NOT aligned on large page
|
||||
shmid: 131098
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
*** C1458T03 PASSED ******************************
|
||||
|
||||
*** LTP-shmat01 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach NULL address
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach aligned address
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach unaligned address with SHM_RND
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach aligned address with SHM_READONLY, and got SIGSEGV on write
|
||||
|
||||
Summary:
|
||||
passed 4
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** PASSED (4)
|
||||
|
||||
*** LTP-shmat02 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
shmat02.c:68: PASS: shmat() failed as expected: EINVAL
|
||||
shmat02.c:68: PASS: shmat() failed as expected: EINVAL
|
||||
shmat02.c:68: PASS: shmat() failed as expected: EACCES
|
||||
|
||||
Summary:
|
||||
passed 3
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** PASSED (3)
|
||||
|
||||
*** LTP-shmat03 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
shmat03.c:75: INFO: Attempting to attach shared memory to null page
|
||||
shmat03.c:91: INFO: Mapped shared memory to 0x1000001e0000
|
||||
shmat03.c:98: PASS: The kernel assigned a different VM address
|
||||
shmat03.c:101: INFO: Touching shared memory to see if anything strange happens
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmctl01 start *******************************
|
||||
shmctl01 1 TBROK : safe_macros.c:635: shmctl01.c:351: waitpid(52554,(nil),0) failed: errno=EINTR(4): Interrupted system call
|
||||
shmctl01 2 TBROK : safe_macros.c:635: Remaining cases broken
|
||||
*** PASSED (0)
|
||||
|
||||
*** LTP-shmctl02 start *******************************
|
||||
shmctl02 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
shmctl02 2 TPASS : expected failure - errno = 14 : Bad address
|
||||
shmctl02 3 TPASS : expected failure - errno = 14 : Bad address
|
||||
shmctl02 4 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmctl02 5 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmctl02 6 TCONF : shmctl02.c:138: shmctl() did not fail for non-root user.This may be okay for your distribution.
|
||||
shmctl02 7 TCONF : shmctl02.c:138: shmctl() did not fail for non-root user.This may be okay for your distribution.
|
||||
*** PASSED (5)
|
||||
|
||||
*** LTP-shmctl03 start *******************************
|
||||
shmctl03 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
shmctl03 2 TPASS : expected failure - errno = 1 : Operation not permitted
|
||||
shmctl03 3 TPASS : expected failure - errno = 1 : Operation not permitted
|
||||
*** PASSED (3)
|
||||
|
||||
*** LTP-shmctl04 start *******************************
|
||||
shmctl04 1 TPASS : SHM_INFO call succeeded
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmdt01 start *******************************
|
||||
shmdt01 1 TPASS : shared memory detached correctly
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmdt02 start *******************************
|
||||
shmdt02 1 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmget01 start *******************************
|
||||
shmget01 1 TPASS : size, pid & mode are correct
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmget02 start *******************************
|
||||
shmget02 1 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmget02 2 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmget02 3 TPASS : expected failure - errno = 17 : File exists
|
||||
shmget02 4 TPASS : expected failure - errno = 2 : No such file or directory
|
||||
*** PASSED (4)
|
||||
|
||||
*** LTP-shmget03 start *******************************
|
||||
shmget03 1 TPASS : expected failure - errno = 28 : No space left on device
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmget04 start *******************************
|
||||
shmget04 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmget05 start *******************************
|
||||
shmget05 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
*** PASSED (1)
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
# expecting this script is on <autotest>/shmobj/install/bin
|
||||
SCRIPT_PATH=$(readlink -m "${BASH_SOURCE[0]}")
|
||||
AUTOTEST_HOME="${SCRIPT_PATH%/*/*/*/*}"
|
||||
if [[ -e ${AUTOTEST_HOME}/bin/config.sh ]]; then
|
||||
. ${AUTOTEST_HOME}/bin/config.sh
|
||||
else
|
||||
WORKDIR=$(pwd)
|
||||
fi
|
||||
|
||||
arch=`uname -p`
|
||||
if [ -f @CMAKE_INSTALL_PREFIX@/etc/${arch}.conf ]; then
|
||||
. @CMAKE_INSTALL_PREFIX@/etc/${arch}.conf
|
||||
else
|
||||
echo "unknown arch: $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
#/bin/sh
|
||||
|
||||
USELTP=1
|
||||
USEOSTEST=0
|
||||
|
||||
. ../../common.sh
|
||||
|
||||
for tp in shmat01 shmat02 shmat03 shmctl01 shmctl02 shmctl03 shmctl04 shmdt01 shmdt02 shmget01 shmget02 shmget03 shmget04 shmget05
|
||||
do
|
||||
tname=`printf "" ${tid}`
|
||||
echo "*** LTP-${tp} start *******************************"
|
||||
sudo $MCEXEC $LTPBIN/$tp 2>&1 | tee $tp.ltplog
|
||||
ok=`grep PASS $tp.ltplog | wc -l`
|
||||
ng=`grep FAIL $tp.ltplog | wc -l`
|
||||
if [ $ng = 0 ]; then
|
||||
echo "*** ${tname} PASSED ($ok)"
|
||||
else
|
||||
echo "*** ${tname} FAILED (ok=$ok ng=$ng)"
|
||||
fi
|
||||
echo ""
|
||||
done
|
||||
@ -1 +0,0 @@
|
||||
PS_LIST="12 21 30"
|
||||
@ -1,253 +0,0 @@
|
||||
*** C1458T01 start *******************************
|
||||
** Map pgshift:21 Unmap pgshift:12
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Map pgshift:30 Unmap pgshift:12
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Map pgshift:30 Unmap pgshift:21
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] data is correct
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
*** C1458T01 PASSED ******************************
|
||||
*** C1458T02 start *******************************
|
||||
** Map pgshift:21 Unmap pgshift:12
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Map pgshift:30 Unmap pgshift:12
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Map pgshift:30 Unmap pgshift:21
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 2: size is aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
** Case 3: size is NOT aligned on large page
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
*** C1458T02 PASSED ******************************
|
||||
*** C1458T03 start *******************************
|
||||
** Map pgshift:21 Unmap pgshift:12
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
shmid: 4182
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Case 2: size is aligned on large page
|
||||
shmid: 69719
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Case 3: size is NOT aligned on large page
|
||||
shmid: 135256
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Map pgshift:30 Unmap pgshift:12
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
shmid: 4185
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Case 2: size is aligned on large page
|
||||
shmid: 69722
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Case 3: size is NOT aligned on large page
|
||||
shmid: 135259
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Map pgshift:30 Unmap pgshift:21
|
||||
** Case 1: specified MAP_HUGETLB
|
||||
shmid: 4188
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Case 2: size is aligned on large page
|
||||
shmid: 69725
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
** Case 3: size is NOT aligned on large page
|
||||
shmid: 135262
|
||||
[OK] munamp succceeded
|
||||
[OK] Occurred SEGV on unmap area
|
||||
[OK] data is correct
|
||||
[OK] shmctl(IPC_RMID) succeeded
|
||||
*** C1458T03 PASSED ******************************
|
||||
*** LTP-shmat01 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach NULL address
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach aligned address
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach unaligned address with SHM_RND
|
||||
shmat01.c:147: PASS: shmat() succeeded to attach aligned address with SHM_READONLY, and got SIGSEGV on write
|
||||
|
||||
Summary:
|
||||
passed 4
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** PASSED (4)
|
||||
|
||||
*** LTP-shmat02 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
shmat02.c:68: PASS: shmat() failed as expected: EINVAL
|
||||
shmat02.c:68: PASS: shmat() failed as expected: EINVAL
|
||||
shmat02.c:68: PASS: shmat() failed as expected: EACCES
|
||||
|
||||
Summary:
|
||||
passed 3
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** PASSED (3)
|
||||
|
||||
*** LTP-shmat03 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
shmat03.c:75: INFO: Attempting to attach shared memory to null page
|
||||
shmat03.c:91: INFO: Mapped shared memory to 0x2aaaaadea000
|
||||
shmat03.c:98: PASS: The kernel assigned a different VM address
|
||||
shmat03.c:101: INFO: Touching shared memory to see if anything strange happens
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmctl01 start *******************************
|
||||
shmctl01 1 TPASS : pid, size, # of attaches and mode are correct - pass #1
|
||||
shmctl01 2 TPASS : pid, size, # of attaches and mode are correct - pass #2
|
||||
shmctl01 3 TPASS : new mode and change time are correct
|
||||
shmctl01 4 TPASS : get correct shared memory limits
|
||||
shmctl01 5 TPASS : get correct shared memory id
|
||||
shmctl01 6 TPASS : SHM_LOCK is set
|
||||
shmctl01 7 TPASS : SHM_LOCK is cleared
|
||||
shmctl01 8 TPASS : shared memory appears to be removed
|
||||
*** PASSED (8)
|
||||
|
||||
*** LTP-shmctl02 start *******************************
|
||||
shmctl02 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
shmctl02 2 TPASS : expected failure - errno = 14 : Bad address
|
||||
shmctl02 3 TPASS : expected failure - errno = 14 : Bad address
|
||||
shmctl02 4 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmctl02 5 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmctl02 6 TCONF : shmctl02.c:138: shmctl() did not fail for non-root user.This may be okay for your distribution.
|
||||
shmctl02 7 TCONF : shmctl02.c:138: shmctl() did not fail for non-root user.This may be okay for your distribution.
|
||||
*** PASSED (5)
|
||||
|
||||
*** LTP-shmctl03 start *******************************
|
||||
shmctl03 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
shmctl03 2 TPASS : expected failure - errno = 1 : Operation not permitted
|
||||
shmctl03 3 TPASS : expected failure - errno = 1 : Operation not permitted
|
||||
*** PASSED (3)
|
||||
|
||||
*** LTP-shmctl04 start *******************************
|
||||
shmctl04 1 TPASS : SHM_INFO call succeeded
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmdt01 start *******************************
|
||||
shmdt01 1 TPASS : shared memory detached correctly
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmdt02 start *******************************
|
||||
shmdt02 1 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmget01 start *******************************
|
||||
shmget01 1 TPASS : size, pid & mode are correct
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmget02 start *******************************
|
||||
shmget02 1 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmget02 2 TPASS : expected failure - errno = 22 : Invalid argument
|
||||
shmget02 3 TPASS : expected failure - errno = 17 : File exists
|
||||
shmget02 4 TPASS : expected failure - errno = 2 : No such file or directory
|
||||
*** PASSED (4)
|
||||
|
||||
*** LTP-shmget03 start *******************************
|
||||
shmget03 1 TPASS : expected failure - errno = 28 : No space left on device
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmget04 start *******************************
|
||||
shmget04 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
*** PASSED (1)
|
||||
|
||||
*** LTP-shmget05 start *******************************
|
||||
shmget05 1 TPASS : expected failure - errno = 13 : Permission denied
|
||||
*** PASSED (1)
|
||||
|
||||
Reference in New Issue
Block a user