Skip to contentSkip to conversation

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

PATCH Superseded Richard Palethorpe 2 participants 4 messages Nov 2, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v8 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.

---

I renamed the wrong test in V7...

 configure.ac                                       |   3 +
 m4/ltp-tpacket-v3.m4                               |  22 ++++
 runtest/cve                                        |   1 +
 runtest/syscalls                                   |   2 +-
 testcases/kernel/syscalls/.gitignore               |   1 +
 .../kernel/syscalls/setsockopt/setsockopt02.c      | 145 +++++++++++++++++++++
 6 files changed, 173 insertions(+), 1 deletion(-)
 create mode 100644 m4/ltp-tpacket-v3.m4
 create mode 100644 testcases/kernel/syscalls/setsockopt/setsockopt02.c
configure.ac +3 -0
index 5f1cd3bfb..ffcbf57c5 100644
@@ -36,6 +36,8 @@ AC_CHECK_HEADERS([ \
     linux/can.h \
     linux/genetlink.h \
     linux/keyctl.h \
+    linux/if_packet.h \
+    linux/if_ether.h \
     linux/mempolicy.h \
     linux/module.h \
     linux/netlink.h \
@@ -199,5 +201,6 @@ LTP_CHECK_MMSGHDR
 LTP_CHECK_UNAME_DOMAINNAME
 LTP_CHECK_X_TABLES
 LTP_CHECK_ATOMIC_MEMORY_MODEL
+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 bea7b3b5b..f137fb3db 100644
@@ -17,6 +17,7 @@ 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 setsockopt02
 cve-2017-7472 keyctl04
 cve-2017-12192 keyctl07
 cve-2017-15274 add_key02
runtest/syscalls +1 -1
index 5688aebae..ed30c0f86 100644
@@ -1159,7 +1159,7 @@ set_tid_address01 set_tid_address01
 setsid01 setsid01
 
 setsockopt01 setsockopt01
-cve-2016-4997 cve-2016-4997
+setsockopt02 setsockopt02
 
 settimeofday01 settimeofday01
 settimeofday02 settimeofday02
testcases/kernel/syscalls/.gitignore +1 -0
index e725c804d..0ba38465f 100644
@@ -940,6 +940,7 @@
 /setrlimit/setrlimit05
 /setsid/setsid01
 /setsockopt/setsockopt01
+/setsockopt/setsockopt02
 /settimeofday/settimeofday01
 /settimeofday/settimeofday02
 /setuid/setuid01
testcases/kernel/syscalls/setsockopt/setsockopt02.c new file +145 -0

145 lines not on this page · raw message

Signature · 1 line
2.14.3
#1 lore raw

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

Hi!

runtest/syscalls set_tid_address01 set_tid_address01 · line 1162

Quoted 3 lines

setsockopt01 setsockopt01

runtest/syscalls +1 -1
-cve-2016-4997 cve-2016-4997
+setsockopt02 setsockopt02

Huh, even in a case that we want to remove the cve-2016-4997 from the runtest file here it should be done in a separate patch.

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

PATCH v9 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.

---

Sorry Metan, it seems I never added cve-2017-7308 to syscalls, then renamed the wrong thing and somehow overlooked it while checking the patch.

 configure.ac                                       |   3 +
 m4/ltp-tpacket-v3.m4                               |  22 ++++
 runtest/cve                                        |   1 +
 runtest/syscalls                                   |   1 +
 testcases/kernel/syscalls/.gitignore               |   1 +
 .../kernel/syscalls/setsockopt/setsockopt02.c      | 145 +++++++++++++++++++++
 6 files changed, 173 insertions(+)
 create mode 100644 m4/ltp-tpacket-v3.m4
 create mode 100644 testcases/kernel/syscalls/setsockopt/setsockopt02.c
configure.ac +3 -0
index 5f1cd3bfb..ffcbf57c5 100644
@@ -36,6 +36,8 @@ AC_CHECK_HEADERS([ \
     linux/can.h \
     linux/genetlink.h \
     linux/keyctl.h \
+    linux/if_packet.h \
+    linux/if_ether.h \
     linux/mempolicy.h \
     linux/module.h \
     linux/netlink.h \
@@ -199,5 +201,6 @@ LTP_CHECK_MMSGHDR
 LTP_CHECK_UNAME_DOMAINNAME
 LTP_CHECK_X_TABLES
 LTP_CHECK_ATOMIC_MEMORY_MODEL
+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 bea7b3b5b..f137fb3db 100644
@@ -17,6 +17,7 @@ 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 setsockopt02
 cve-2017-7472 keyctl04
 cve-2017-12192 keyctl07
 cve-2017-15274 add_key02
runtest/syscalls +1 -0
index 5688aebae..626853669 100644
@@ -1159,6 +1159,7 @@ set_tid_address01 set_tid_address01
 setsid01 setsid01
 
 setsockopt01 setsockopt01
+setsockopt02 setsockopt02
 cve-2016-4997 cve-2016-4997
 
 settimeofday01 settimeofday01
testcases/kernel/syscalls/.gitignore +1 -0
index e725c804d..0ba38465f 100644
@@ -940,6 +940,7 @@
 /setrlimit/setrlimit05
 /setsid/setsid01
 /setsockopt/setsockopt01
+/setsockopt/setsockopt02
 /settimeofday/settimeofday01
 /settimeofday/settimeofday02
 /setuid/setuid01
testcases/kernel/syscalls/setsockopt/setsockopt02.c new file +145 -0

145 lines not on this page · raw message

Signature · 1 line
2.14.3