Skip to contentSkip to conversation

cve-2017-16939: drop linux/xfrm.h include

PATCH New Jan Stancek 3 participants 4 messages Apr 26, 2018 – May 3, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cve-2017-16939: drop linux/xfrm.h include

Mixing libc and linux headers can cause conflicts on some distros. Drop linux/xfrm.h include and add needed defines to a new lapi header.

---
 include/lapi/xfrm.h            | 29 +++++++++++++++++++++++++++++
 testcases/cve/cve-2017-16939.c |  2 +-
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 include/lapi/xfrm.h
include/lapi/xfrm.h new file +29 -0
new file mode 100644
index 000000000000..013199b1a092
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 Linux Test Project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation
+ */
+
+#ifndef __XFRM_H__
+#define __XFRM_H__
+
+#ifndef XFRMNLGRP_NONE
+# define XFRMNLGRP_NONE 0
+#endif
+
+#ifndef XFRM_MSG_GETPOLICY
+# define XFRM_MSG_GETPOLICY 21
+#endif
+
+#endif
testcases/cve/cve-2017-16939.c +1 -1
index 223ca834b8db..a4a38ba34375 100644
@@ -30,8 +30,8 @@
 #include <sys/wait.h>
 #include <netinet/in.h>
 #include <linux/netlink.h>
-#include <linux/xfrm.h>
 
+#include "lapi/xfrm.h"
 #include "tst_test.h"
 #include "tst_res_flags.h"
 #include "tst_safe_macros.h"
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 cve-2017-16939: drop linux/xfrm.h include

Hi,

Quoted 6 lines

Mixing libc and linux headers can cause conflicts on some distros. Drop linux/xfrm.h include and add needed defines to a new lapi header.

---

Tested on various distros (but not affected RHEL 7.2).

Kind regards,
Petr

#2 lore raw

PATCH 1/1 cve-2017-16939: drop linux/xfrm.h include

In reply to Jan Stancek

Hi!

include/lapi/xfrm.h line 19

Quoted 2 lines
include/lapi/xfrm.h new file +2 -0
+#ifndef __XFRM_H__
+#define __XFRM_H__

I tend to avoid double underscores in identifier names, since these are reserved for libc, so I would have named this LAPI_XFRM_H__ or something similar, but that is very minor.

Other than that acked.

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

PATCH 1/1 cve-2017-16939: drop linux/xfrm.h include

----- Original Message -----

Quoted 9 lines

Hi!

include/lapi/xfrm.h line 19

Quoted 2 lines
include/lapi/xfrm.h new file +2 -0
+#ifndef __XFRM_H__
+#define __XFRM_H__

I tend to avoid double underscores in identifier names, since these are reserved for libc, so I would have named this LAPI_XFRM_H__ or something similar, but that is very minor.

Other than that acked.

Pushed with suggested change.

Regards,
Jan

Quoted 5 lines

--
Cyril Hrubis
[email protected]