Skip to contentSkip to conversation

Add test for CVE-2017-7308 on a raw socket's ring buffer

PATCH New Richard Palethorpe 1 participant 3 messages Oct 3, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add test for CVE-2017-7308 on a raw socket's ring buffer

This test uses a Linux only interface which has not been fully integrated into glibc and it is not clear if it ever will be. So I have kept the fallback logic relatively simple and use only the Linux headers if they are present or just define what is needed in the test.

---

 configure.ac                  |   3 +
 m4/ltp-tpacket-v3.m4          |  22 +++++++
 runtest/cve                   |   1 +
 testcases/cve/.gitignore      |   1 +
 testcases/cve/cve-2017-7308.c | 138 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 165 insertions(+)
 create mode 100644 m4/ltp-tpacket-v3.m4
 create mode 100644 testcases/cve/cve-2017-7308.c
configure.ac +3 -0
index 458a5b13f..4a0cf204b 100644
@@ -37,6 +37,8 @@ AC_CHECK_HEADERS([ \
     pthread.h \
     sys/xattr.h \
     linux/genetlink.h \
+    linux/if_packet.h \
+    linux/if_ether.h \
     linux/mempolicy.h \
     linux/module.h \
     linux/netlink.h \
@@ -192,5 +194,6 @@ LTP_CHECK_BUILTIN_CLEAR_CACHE
 LTP_CHECK_MMSGHDR
 LTP_CHECK_UNAME_DOMAINNAME
 LTP_CHECK_X_TABLES
+LTP_CHECK_TPACKET_V3
 
 AC_OUTPUT
m4/ltp-tpacket-v3.m4 new file +22 -0
new file mode 100644
index 000000000..fce2e0ebf
@@ -0,0 +1,22 @@
+dnl Copyright (c) 2017 Richard Palethorpe <[email protected]>
+dnl
+dnl This program is free software;  you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+dnl the GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AC_DEFUN([LTP_CHECK_TPACKET_V3],[
+AC_CHECK_TYPES([struct tpacket_req3],,,[
+#ifdef HAVE_LINUX_IF_PACKET_H
+# include <linux/if_packet.h>
+#endif
+])
+])
runtest/cve +1 -0
index 8c140b5cb..999e34e62 100644
@@ -16,5 +16,6 @@ cve-2017-2618 cve-2017-2618
 cve-2017-2671 cve-2017-2671
 cve-2017-5669 cve-2017-5669
 cve-2017-6951 cve-2017-6951
+cve-2017-7308 cve-2017-7308
 cve-2017-7472 keyctl04
 cve-2017-1000364 stack_clash
testcases/cve/.gitignore +1 -0
index f76c39826..c04d1c9a1 100644
@@ -8,4 +8,5 @@ cve-2017-2618
 cve-2017-2671
 cve-2017-6951
 cve-2017-5669
+cve-2017-7308
 stack_clash
testcases/cve/cve-2017-7308.c new file +138 -0

138 lines not on this page · raw message

Signature · 1 line
2.14.1
#1 lore raw

PATCH v4 1/1 Add test for CVE-2017-7308 on a raw socket's ring buffer

This test uses a Linux only interface which has not been fully integrated into glibc and it is not clear if it ever will be. So I have kept the fallback logic relatively simple and use only the Linux headers if they are present or just define what is needed in the test.

---
 configure.ac                  |   3 +
 m4/ltp-tpacket-v3.m4          |  22 +++++++
 runtest/cve                   |   1 +
 testcases/cve/.gitignore      |   1 +
 testcases/cve/cve-2017-7308.c | 138 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 165 insertions(+)
 create mode 100644 m4/ltp-tpacket-v3.m4
 create mode 100644 testcases/cve/cve-2017-7308.c
configure.ac +3 -0
index 458a5b13f..4a0cf204b 100644
@@ -37,6 +37,8 @@ AC_CHECK_HEADERS([ \
     pthread.h \
     sys/xattr.h \
     linux/genetlink.h \
+    linux/if_packet.h \
+    linux/if_ether.h \
     linux/mempolicy.h \
     linux/module.h \
     linux/netlink.h \
@@ -192,5 +194,6 @@ LTP_CHECK_BUILTIN_CLEAR_CACHE
 LTP_CHECK_MMSGHDR
 LTP_CHECK_UNAME_DOMAINNAME
 LTP_CHECK_X_TABLES
+LTP_CHECK_TPACKET_V3
 
 AC_OUTPUT
m4/ltp-tpacket-v3.m4 new file +22 -0
new file mode 100644
index 000000000..fce2e0ebf
@@ -0,0 +1,22 @@
+dnl Copyright (c) 2017 Richard Palethorpe <[email protected]>
+dnl
+dnl This program is free software;  you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+dnl the GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AC_DEFUN([LTP_CHECK_TPACKET_V3],[
+AC_CHECK_TYPES([struct tpacket_req3],,,[
+#ifdef HAVE_LINUX_IF_PACKET_H
+# include <linux/if_packet.h>
+#endif
+])
+])
runtest/cve +1 -0
index 8c140b5cb..999e34e62 100644
@@ -16,5 +16,6 @@ cve-2017-2618 cve-2017-2618
 cve-2017-2671 cve-2017-2671
 cve-2017-5669 cve-2017-5669
 cve-2017-6951 cve-2017-6951
+cve-2017-7308 cve-2017-7308
 cve-2017-7472 keyctl04
 cve-2017-1000364 stack_clash
testcases/cve/.gitignore +1 -0
index f76c39826..c04d1c9a1 100644
@@ -8,4 +8,5 @@ cve-2017-2618
 cve-2017-2671
 cve-2017-6951
 cve-2017-5669
+cve-2017-7308
 stack_clash
testcases/cve/cve-2017-7308.c new file +138 -0

138 lines not on this page · raw message

Signature · 1 line
2.14.1
#2 lore raw

PATCH v5 1/1 Add test for CVE-2017-7308 on a raw socket's ring buffer

In reply to Richard Palethorpe

This test uses a Linux only interface which has not been fully integrated into glibc and it is not clear if it ever will be. So I have kept the fallback logic relatively simple and use only the Linux headers if they are present or just define what is needed in the test.

---

V5 - Split test variations into different functions

 configure.ac                  |   3 +
 m4/ltp-tpacket-v3.m4          |  22 +++++++
 runtest/cve                   |   1 +
 testcases/cve/.gitignore      |   1 +
 testcases/cve/cve-2017-7308.c | 138 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 165 insertions(+)
 create mode 100644 m4/ltp-tpacket-v3.m4
 create mode 100644 testcases/cve/cve-2017-7308.c
configure.ac +3 -0
index 458a5b13f..4a0cf204b 100644
@@ -37,6 +37,8 @@ AC_CHECK_HEADERS([ \
     pthread.h \
     sys/xattr.h \
     linux/genetlink.h \
+    linux/if_packet.h \
+    linux/if_ether.h \
     linux/mempolicy.h \
     linux/module.h \
     linux/netlink.h \
@@ -192,5 +194,6 @@ LTP_CHECK_BUILTIN_CLEAR_CACHE
 LTP_CHECK_MMSGHDR
 LTP_CHECK_UNAME_DOMAINNAME
 LTP_CHECK_X_TABLES
+LTP_CHECK_TPACKET_V3
 
 AC_OUTPUT
m4/ltp-tpacket-v3.m4 new file +22 -0
new file mode 100644
index 000000000..fce2e0ebf
@@ -0,0 +1,22 @@
+dnl Copyright (c) 2017 Richard Palethorpe <[email protected]>
+dnl
+dnl This program is free software;  you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+dnl the GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AC_DEFUN([LTP_CHECK_TPACKET_V3],[
+AC_CHECK_TYPES([struct tpacket_req3],,,[
+#ifdef HAVE_LINUX_IF_PACKET_H
+# include <linux/if_packet.h>
+#endif
+])
+])
runtest/cve +1 -0
index 8c140b5cb..999e34e62 100644
@@ -16,5 +16,6 @@ cve-2017-2618 cve-2017-2618
 cve-2017-2671 cve-2017-2671
 cve-2017-5669 cve-2017-5669
 cve-2017-6951 cve-2017-6951
+cve-2017-7308 cve-2017-7308
 cve-2017-7472 keyctl04
 cve-2017-1000364 stack_clash
testcases/cve/.gitignore +1 -0
index f76c39826..c04d1c9a1 100644
@@ -8,4 +8,5 @@ cve-2017-2618
 cve-2017-2671
 cve-2017-6951
 cve-2017-5669
+cve-2017-7308
 stack_clash
testcases/cve/cve-2017-7308.c new file +138 -0

138 lines not on this page · raw message

Signature · 1 line
2.14.1