Skip to contentSkip to conversation

Add test for CVE 2018-18559

PATCH New Martin Doucha 2 participants 2 messages Apr 6, 2020 – Apr 8, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add test for CVE 2018-18559

Fixes #411

---

Changes since v1: added needs_kconfigs to metadata

This is a rather slow test. The bind() thread can take on average 15ms due to kernel locks on the socket or netdevice and the kernel crash is only triggered on process exit. So the test takes about 2 to 3 minutes even with really low number of race loops. But it reliably crashes SLE-12SP3 GM kernel.

 runtest/cve                               |   1 +
 runtest/syscalls                          |   1 +
 testcases/kernel/syscalls/bind/.gitignore |   1 +
 testcases/kernel/syscalls/bind/Makefile   |   1 +
 testcases/kernel/syscalls/bind/bind06.c   | 133 ++++++++++++++++++++++
 5 files changed, 137 insertions(+)
 create mode 100644 testcases/kernel/syscalls/bind/bind06.c
runtest/cve +1 -0
index dbd065fd1..da42c4ede 100644
@@ -43,4 +43,5 @@ cve-2018-5803 sctp_big_chunk
 cve-2018-1000001 realpath01
 cve-2018-1000199 ptrace08
 cve-2018-1000204 ioctl_sg01
+cve-2018-18559 bind06
 cve-2018-19854 crypto_user01
runtest/syscalls +1 -0
index 777f0ac6a..44254d7da 100644
@@ -34,6 +34,7 @@ bind02 bind02
 bind03 bind03
 bind04 bind04
 bind05 bind05
+bind06 bind06
 
 bpf_map01 bpf_map01
 bpf_prog01 bpf_prog01
testcases/kernel/syscalls/bind/.gitignore +1 -0
index e18ceea56..c85774441 100644
@@ -3,3 +3,4 @@
 /bind03
 /bind04
 /bind05
+/bind06
testcases/kernel/syscalls/bind/Makefile +1 -0
index fffa146ad..3de725143 100644
@@ -6,5 +6,6 @@ top_srcdir		?= ../../../..
 include $(top_srcdir)/include/mk/testcases.mk
 
 bind04 bind05:	CFLAGS		+= -pthread
+bind06:		LDFLAGS		+= -pthread -lrt
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/bind/bind06.c new file +133 -0

133 lines not on this page · raw message

Signature · 1 line
2.26.0
#1 lore raw

PATCH v2 1/1 Add test for CVE 2018-18559

Hi!

Quoted 2 lines

bind04 bind05: CFLAGS += -pthread
+bind06: LDFLAGS += -pthread -lrt

I've fixed this part.

The -lfoo has to go to LDLIBS and the -pthread should go to CFLAGS. Having -lfoo in LDFLAGS tends to cause compilation failures in some cases because the order of these matters.

Pushed, thanks.

Signature · 2 lines
Cyril Hrubis
[email protected]