Skip to contentSkip to conversation

Add a regression test for cve-2017-15649

PATCH Superseded Michael Moese 2 participants 3 messages Jan 29, 2020

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add a regression test for cve-2017-15649

net/packet/af_packet.c in the Linux kernel before 4.13.6 allows local users to gain privileges via crafted system calls that trigger mishandling of packet_fanout data structures, because of a race condition (involving fanout_add and packet_do_bind) that leads to a use-after-free.

See https://ssd-disclosure.com/archives/3484 for more detail.

--
Changes to v1:
- reworked the usage of fuzzy sync library so this should now be correct
- use LTP library functions for file I/O
- require KASAN to be enabled

---
 runtest/cve                    |   2 +-
 testcases/cve/.gitignore       |   1 +
 testcases/cve/Makefile         |   1 +
 testcases/cve/cve-2017-15649.c | 135 +++++++++++++++++++++++++++++++++
 4 files changed, 138 insertions(+), 1 deletion(-)
 create mode 100644 testcases/cve/cve-2017-15649.c
runtest/cve +1 -1
index 57cf66075..b76ddaaaa 100644
@@ -24,7 +24,7 @@ cve-2017-12193 add_key04
 cve-2017-15274 add_key02
 cve-2017-15299 request_key03 -b cve-2017-15299
 cve-2017-15537 ptrace07
-cve-2017-15649 fanout01
+cve-2017-15649 cve-2017-15649
 cve-2017-15951 request_key03 -b cve-2017-15951
 cve-2017-17805 af_alg02
 cve-2017-17806 af_alg01
testcases/cve/.gitignore +1 -0
index 01a3e4c8f..08154e2db 100644
@@ -8,5 +8,6 @@ cve-2017-2671
 meltdown
 stack_clash
 cve-2017-17052
+cve-2017-15649
 cve-2017-16939
 cve-2017-17053
testcases/cve/Makefile +1 -0
index da44fff60..6cf3b5af9 100644
@@ -46,5 +46,6 @@ cve-2017-17052:	CFLAGS += -pthread
 cve-2017-17053:	CFLAGS += -pthread
 
 cve-2015-3290:	CFLAGS += -pthread
+cve-2017-15649: CFLAGS += -pthread
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/cve/cve-2017-15649.c new file +135 -0

135 lines not on this page · raw message

Signature · 1 line
2.25.0
#1 lore raw

PATCH v2 1/1 Add a regression test for cve-2017-15649

Hi Michie,

Quoted 7 lines

net/packet/af_packet.c in the Linux kernel before 4.13.6 allows local users to gain privileges via crafted system calls that trigger mishandling of packet_fanout data structures, because of a race condition (involving fanout_add and packet_do_bind) that leads to a use-after-free.

See https://ssd-disclosure.com/archives/3484 for more detail.

Thanks for your work!

Fuzzy sync library changes now LGTM, but I'd Richie or somebody else to double check.

What a shame it requires Kasan for reproducing.

testcases/cve/Makefile cve-2017-17052: CFLAGS += -pthread · line 49

Quoted 6 lines

+++ b/testcases/cve/Makefile

testcases/cve/Makefile +1 -0
@@ -46,5 +46,6 @@ cve-2017-17052:	CFLAGS += -pthread
 cve-2017-17053:	CFLAGS += -pthread
 
 cve-2015-3290:	CFLAGS += -pthread
+cve-2017-15649: CFLAGS += -pthread

testcases/cve/../../include/tst_fuzzy_sync.h:342: undefined reference to `clock_gettime'

You also need link with -lrt, otherwise it fails to build on very old distros:
cve-2017-15649: LDLIBS += -lrt

Kind regards,
Petr

#2 lore raw

PATCH v2 1/1 Add a regression test for cve-2017-15649

In reply to Michael Moese

Hi,

testcases/cve/cve-2017-15649.c line 134

Quoted 6 lines
testcases/cve/cve-2017-15649.c new file +6 -0
+static struct tst_test test = {
+	.test_all = run,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_kconfigs = kconfigs,
+	.caps = caps

Also adding tags would be nice (at least CVE + consider adding 008ba2a13f2d:

    .tags = (const struct tst_tag[]) {
        {"CVE", "2017-15649"},
        {"linux-git", "008ba2a13f2d"},
        {}
    }
Quoted 1 line

+};

Kind regards,
Petr