Skip to contentSkip to conversation

Add test for CVE 2016-8655

PATCH New Martin Doucha 3 participants 7 messages May 5, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Add test for CVE 2016-8655

---

This test is awfully slow but it checks for local root exploit.

 runtest/cve                                   |   1 +
 runtest/syscalls                              |   1 +
 .../kernel/syscalls/setsockopt/.gitignore     |   1 +
 testcases/kernel/syscalls/setsockopt/Makefile |   2 +
 .../kernel/syscalls/setsockopt/setsockopt06.c | 125 ++++++++++++++++++
 5 files changed, 130 insertions(+)
 create mode 100644 testcases/kernel/syscalls/setsockopt/setsockopt06.c
runtest/cve +1 -0
index c2e9e8c89..786b5ee76 100644
@@ -12,6 +12,7 @@ cve-2016-4997 setsockopt03
 cve-2016-5195 dirtyc0w
 cve-2016-7042 cve-2016-7042
 cve-2016-7117 cve-2016-7117
+cve-2016-8655 setsockopt06
 cve-2016-9604 keyctl08
 cve-2016-9793 setsockopt04
 cve-2016-10044 cve-2016-10044
runtest/syscalls +1 -0
index cbab5730c..bdcd9a5b8 100644
@@ -1326,6 +1326,7 @@ setsockopt02 setsockopt02
 setsockopt03 setsockopt03
 setsockopt04 setsockopt04
 setsockopt05 setsockopt05
+setsockopt06 setsockopt06
 
 settimeofday01 settimeofday01
 settimeofday02 settimeofday02
testcases/kernel/syscalls/setsockopt/.gitignore +1 -0
index f4eabd92b..ad067c3e3 100644
@@ -3,3 +3,4 @@
 /setsockopt03
 /setsockopt04
 /setsockopt05
+/setsockopt06
testcases/kernel/syscalls/setsockopt/Makefile +2 -0
index 044619fb8..1e80facd4 100644
@@ -2,6 +2,8 @@
 # Copyright (c) International Business Machines  Corp., 2001
 
 top_srcdir		?= ../../../..
+setsockopt06:		CFLAGS += -pthread
+setsockopt06:		LDLIBS += -lrt
 
 include $(top_srcdir)/include/mk/testcases.mk
 
testcases/kernel/syscalls/setsockopt/setsockopt06.c new file +125 -0

125 lines not on this page · raw message

Signature · 1 line
2.26.2
#1 lore raw

PATCH 2/2 Add test for CVE 2017-1000111

Fixes #497

---

The tiny race iteration limit is intentional. The bug is mostly harmless and the setsockopt(PACKET_RX_RING) is really slow. Vulnerable kernels will fail the test in 15 iterations or less. The test will run for about 30 seconds on patches systems.

 runtest/cve                                   |   1 +
 runtest/syscalls                              |   1 +
 .../kernel/syscalls/setsockopt/.gitignore     |   1 +
 testcases/kernel/syscalls/setsockopt/Makefile |   4 +-
 .../kernel/syscalls/setsockopt/setsockopt07.c | 138 ++++++++++++++++++
 5 files changed, 143 insertions(+), 2 deletions(-)
 create mode 100644 testcases/kernel/syscalls/setsockopt/setsockopt07.c
runtest/cve +1 -0
index 786b5ee76..339d57f23 100644
@@ -40,6 +40,7 @@ cve-2017-16939 cve-2017-16939
 cve-2017-16995 bpf_prog03
 cve-2017-17053 cve-2017-17053
 cve-2017-18075 pcrypt_aead01
+cve-2017-1000111 setsockopt07
 cve-2017-1000112 setsockopt05
 cve-2017-1000380 snd_timer01
 cve-2018-5803 sctp_big_chunk
runtest/syscalls +1 -0
index bdcd9a5b8..3d953fd22 100644
@@ -1327,6 +1327,7 @@ setsockopt03 setsockopt03
 setsockopt04 setsockopt04
 setsockopt05 setsockopt05
 setsockopt06 setsockopt06
+setsockopt07 setsockopt07
 
 settimeofday01 settimeofday01
 settimeofday02 settimeofday02
testcases/kernel/syscalls/setsockopt/.gitignore +1 -0
index ad067c3e3..1ca5b836b 100644
@@ -4,3 +4,4 @@
 /setsockopt04
 /setsockopt05
 /setsockopt06
+/setsockopt07
testcases/kernel/syscalls/setsockopt/Makefile +2 -2
index 1e80facd4..678ada75a 100644
@@ -2,8 +2,8 @@
 # Copyright (c) International Business Machines  Corp., 2001
 
 top_srcdir		?= ../../../..
-setsockopt06:		CFLAGS += -pthread
-setsockopt06:		LDLIBS += -lrt
+setsockopt06 setsockopt07:	CFLAGS += -pthread
+setsockopt06 setsockopt07:	LDLIBS += -lrt
 
 include $(top_srcdir)/include/mk/testcases.mk
 
testcases/kernel/syscalls/setsockopt/setsockopt07.c new file +138 -0

138 lines not on this page · raw message

Signature · 1 line
2.26.2
#2 lore raw

PATCH 1/2 Add test for CVE 2016-8655

In reply to Martin Doucha

Hi Martin,

Quoted 1 line

Both patches LGTM.

gcc 4 from CentOS 6 strikes again:

https://travis-ci.org/github/pevik/ltp/jobs/683350147
setsockopt06.c: In function 'thread_run':
setsockopt06.c:55: error: variable 'req' has initializer but incomplete type setsockopt06.c:56: error: unknown field 'tp_block_size' specified in initializer setsockopt06.c:56: warning: excess elements in struct initializer setsockopt06.c:56: warning: (near initialization for 'req') setsockopt06.c:57: error: unknown field 'tp_block_nr' specified in initializer setsockopt06.c:57: warning: excess elements in struct initializer setsockopt06.c:57: warning: (near initialization for 'req') setsockopt06.c:58: error: unknown field 'tp_frame_size' specified in initializer setsockopt06.c:58: warning: excess elements in struct initializer setsockopt06.c:58: warning: (near initialization for 'req') setsockopt06.c:59: error: unknown field 'tp_frame_nr' specified in initializer setsockopt06.c:59: warning: excess elements in struct initializer setsockopt06.c:59: warning: (near initialization for 'req') setsockopt06.c:60: error: unknown field 'tp_retire_blk_tov' specified in initializer setsockopt06.c:61: warning: excess elements in struct initializer setsockopt06.c:61: warning: (near initialization for 'req') setsockopt06.c:55: error: storage size of 'req' isn't known setsockopt06.c:55: warning: unused variable 'req'
setsockopt06.c: In function 'run':
setsockopt06.c:84: error: 'TPACKET_V3' undeclared (first use in this function) setsockopt06.c:84: error: (Each undeclared identifier is reported only once setsockopt06.c:84: error: for each function it appears in.)

both tests need this definition, which is already in setsockopt02.c.

#ifndef HAVE_STRUCT_TPACKET_REQ3

# define TPACKET_V3 2
struct tpacket_req3 {
	unsigned int	tp_block_size;
	unsigned int	tp_block_nr;
	unsigned int	tp_frame_size;
	unsigned int	tp_frame_nr;
	unsigned int	tp_retire_blk_tov;
	unsigned int	tp_sizeof_priv;
	unsigned int	tp_feature_req_word;
};

#endif

I wanted to propose after release dropping gcc 4 support by deleting CentOS 6 from Travis (but maybe we should drop it even now). To keep the support, it'd be good to add lapi/if_packet.h with this definition.

Kind regards,
Petr

#3 lore raw

PATCH 1/2 Add test for CVE 2016-8655

Hi!

Quoted 3 lines

I wanted to propose after release dropping gcc 4 support by deleting CentOS 6 from Travis (but maybe we should drop it even now). To keep the support, it'd be good to add lapi/if_packet.h with this definition.

That mainly depends on if someone wants to still carry on supporting it.

Does someone out there still need CentOS 6?

Signature · 2 lines
Cyril Hrubis
[email protected]
#4 lore raw

PATCH 1/2 Add test for CVE 2016-8655

Hi,

Quoted 7 lines
Quoted 3 lines

I wanted to propose after release dropping gcc 4 support by deleting CentOS 6 from Travis (but maybe we should drop it even now). To keep the support, it'd be good to add lapi/if_packet.h with this definition.

That mainly depends on if someone wants to still carry on supporting it.

Does someone out there still need CentOS 6?

Should we send separate RFC about dropping support for this oldest distro in Travis? If nobody interested and unless it requires too much effort I'd keep it for this release.

Kind regards,
Petr

#5 lore raw

PATCH 1/2 Add test for CVE 2016-8655

In reply to Petr Vorel
Quoted 3 lines · Petr Vorel

I wanted to propose after release dropping gcc 4 support by deleting CentOS 6 from Travis (but maybe we should drop it even now). To keep the support, it'd be good to add lapi/if_packet.h with this definition.

I don't really care about CentOS 6 either way but I'll add the new LAPI header and resubmit.

Signature · 7 lines
Martin Doucha   [email protected]
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic
#6 lore raw

PATCH 1/2 Add test for CVE 2016-8655

Hi Martin,

Quoted 7 lines · Petr Vorel
Quoted 3 lines

I wanted to propose after release dropping gcc 4 support by deleting CentOS 6 from Travis (but maybe we should drop it even now). To keep the support, it'd be good to add lapi/if_packet.h with this definition.

I don't really care about CentOS 6 either way but I'll add the new LAPI header and resubmit.

Thanks a lot!

And we should really decide when drop it.

Kind regards,
Petr