diff options
author | Dengke Du <dengke.du@windriver.com> | 2018-09-12 16:55:56 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-09-13 07:42:28 +0100 |
commit | 37be2ed7a94363b94cde413341a3795c9754994a (patch) | |
tree | f657f138bca22acceadd4a8429952b447f491926 /meta/recipes-extended/ltp/ltp | |
parent | 821711bf2edc3d2eb5a695653ff5d439f43520be (diff) | |
download | poky-37be2ed7a94363b94cde413341a3795c9754994a.tar.gz |
ltp: fix mmap15 failed on qemumips64
Actually, this is not a bug, mmap15 only run on 64bit system.
On qemumips64, mmap15 return EINVAL, x86-64 and arm64 return
ENOMEM. This is because mips system check the addr that passed
to the syscall mmap15:
https://github.com/torvalds/linux/blob/master/arch/mips/mm/mmap.c#L71
If the addr larger than (TASK_SIZE - page_size), mips think it is invalid.
(From OE-Core rev: cbc026227fb9bafe71665a673104272e191bdef9)
Signed-off-by: Dengke Du <dengke.du@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/ltp/ltp')
-rw-r--r-- | meta/recipes-extended/ltp/ltp/0001-mmap15-mips64-return-EINVAL.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-mmap15-mips64-return-EINVAL.patch b/meta/recipes-extended/ltp/ltp/0001-mmap15-mips64-return-EINVAL.patch new file mode 100644 index 0000000000..18eba27c2d --- /dev/null +++ b/meta/recipes-extended/ltp/ltp/0001-mmap15-mips64-return-EINVAL.patch | |||
@@ -0,0 +1,41 @@ | |||
1 | From b909805b4fc1b72e0ce299afb4abc02720ee81da Mon Sep 17 00:00:00 2001 | ||
2 | From: Dengke Du <dengke.du@windriver.com> | ||
3 | Date: Wed, 12 Sep 2018 14:24:35 +0800 | ||
4 | Subject: [PATCH] mmap15: mips64 return EINVAL | ||
5 | |||
6 | In mips64 kernel, system check the addr that passed to mmap: | ||
7 | |||
8 | if (TASK_SIZE - len < addr) | ||
9 | return -EINVAL; | ||
10 | |||
11 | Link: https://github.com/torvalds/linux/blob/master/arch/mips/mm/mmap.c#L71 | ||
12 | |||
13 | Upstream-Status: Submitted [https://github.com/linux-test-project/ltp/pull/394] | ||
14 | |||
15 | Signed-off-by: Dengke Du <dengke.du@windriver.com> | ||
16 | --- | ||
17 | testcases/kernel/syscalls/mmap/mmap15.c | 5 +++++ | ||
18 | 1 file changed, 5 insertions(+) | ||
19 | |||
20 | diff --git a/testcases/kernel/syscalls/mmap/mmap15.c b/testcases/kernel/syscalls/mmap/mmap15.c | ||
21 | index eff27d6..a10b5c7 100644 | ||
22 | --- a/testcases/kernel/syscalls/mmap/mmap15.c | ||
23 | +++ b/testcases/kernel/syscalls/mmap/mmap15.c | ||
24 | @@ -81,9 +81,14 @@ int main(int ac, char **av) | ||
25 | } | ||
26 | |||
27 | if (errno != ENOMEM) { | ||
28 | +#ifdef __mips__ | ||
29 | + tst_resm(TPASS | TERRNO, "mmap into high region " | ||
30 | + "failed as expected"); | ||
31 | +#else | ||
32 | tst_resm(TFAIL | TERRNO, "mmap into high region " | ||
33 | "failed unexpectedly - expect " | ||
34 | "errno=ENOMEM, got"); | ||
35 | +#endif | ||
36 | } else { | ||
37 | tst_resm(TPASS | TERRNO, "mmap into high region " | ||
38 | "failed as expected"); | ||
39 | -- | ||
40 | 2.7.4 | ||
41 | |||