Add tst_get_hugepage_size() to LTP library
PATCH v3 1/2 Add tst_get_hugepage_size() to LTP library
Signed-off-by Martin Doucha <[email protected]>
---
Changes since v2: Code style fixes.
include/tst_hugepage.h | 5 +++++ lib/tst_hugepage.c | 8 ++++++++ 2 files changed, 13 insertions(+)
include/tst_hugepage.h +5 -0
@@ -12,6 +12,11 @@extern char *nr_opt;/* -s num Set the number of the been allocated hugepages */ extern char *Hopt;/* -H /.. Location of hugetlbfs, i.e. -H /var/hugetlbfs */ +/* +* Get the default hugepage size. Returns 0 if hugepages are not supported. +*/ +size_t tst_get_hugepage_size (void ); +/* * Try the best to request a specified number of huge pages from system, * it will store the reserved hpage number in tst_hugepages.
lib/tst_hugepage.c +8 -0
@@ -12,6 +12,14 @@ unsigned long tst_hugepages;char *nr_opt;char *Hopt; +size_t tst_get_hugepage_size (void ) +{ +if (access (PATH_HUGEPAGES ,F_OK )) +return 0 ; + +return SAFE_READ_MEMINFO ("Hugepagesize:" ) *1024 ; +} +unsigned long tst_request_hugepages (unsigned long hpages) {unsigned long val, max_hpages;
Signature · 1 line
2.26.2
PATCH v3 2/2 Add test for CVE 2017-1000405
Fixes #316
Signed-off-by Martin Doucha <[email protected]>
---
Changes since v1:
- include lapi/mmap.h
- TCONF if madvise(MADV_HUGEPAGE) fails with EINVAL
Changes since v2:
- code style fixes
runtest/cve | 1 + runtest/mm | 1 + testcases/kernel/mem/.gitignore | 1 + testcases/kernel/mem/thp/Makefile | 1 + testcases/kernel/mem/thp/thp04.c | 159 ++++++++++++++++++++++++++++++ 5 files changed, 163 insertions(+) create mode 100644 testcases/kernel/mem/thp/thp04.c
runtest/cve +1 -0
@@ -43,6 +43,7 @@ cve-2017-18075 pcrypt_aead01 cve-2017-1000111 setsockopt07 cve-2017-1000112 setsockopt05 cve-2017-1000380 snd_timer01 +cve-2017-1000405 thp04 cve-2018-5803 sctp_big_chunk cve-2018-7566 snd_seq01 cve-2018-8897 ptrace09
runtest/mm +1 -0
@@ -86,6 +86,7 @@ swapping01 swapping01 -i 5 thp01 thp01 -I 120 thp02 thp02 thp03 thp03 +thp04 thp04 vma01 vma01 vma02 vma02
testcases/kernel/mem/.gitignore +1 -0
@@ -65,6 +65,7 @@ /thp/thp01 /thp/thp02 /thp/thp03 +/thp/thp04 /tunable/max_map_count /tunable/min_free_kbytes /tunable/overcommit_memory
testcases/kernel/mem/thp/Makefile +1 -0
@@ -18,6 +18,7 @@ # top_srcdir ?= ../../../.. +thp04: LDLIBS += -lrt include $(top_srcdir)/include/mk/testcases.mk include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
testcases/kernel/mem/thp/thp04.c new file +159 -0
159 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v3 2/2 Add test for CVE 2017-1000405
----- Original Message -----
Quoted 8 lines
Fixes #316
Signed-off-by Martin Doucha <[email protected]>---
Changes since v1:
- includelapi/mmap.h
- TCONF ifmadvise(MADV_HUGEPAGE)fails with EINVAL
Acked-by Jan Stancek <[email protected]>