Skip to contentSkip to conversation

selinux: make header files self-including

PATCH Superseded Christian Göttsche 3 participants 4 messages May 11, 2023 – May 18, 2023 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux: make header files self-including

Include all necessary headers in header files to enable third party applications, like LSP servers, to resolve all used symbols.

ibpkey.h: include "../flask.h" for SECINITSID_UNLABELED initial_sid_to_string.h: include <linux/stddef.h> for NULL

---
 security/selinux/include/ibpkey.h                | 1 +
 security/selinux/include/initial_sid_to_string.h | 3 +++
 2 files changed, 4 insertions(+)
security/selinux/include/ibpkey.h +1 -0
index c992f83b0aae..f8a791b07092 100644
@@ -15,6 +15,7 @@
 #define _SELINUX_IB_PKEY_H
 
 #include <linux/types.h>
+#include "../flask.h"
 
 #ifdef CONFIG_SECURITY_INFINIBAND
 void sel_ib_pkey_flush(void);
security/selinux/include/initial_sid_to_string.h +3 -0
index 60820517aa43..ecc6e74fa09b 100644
@@ -1,4 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+
+#include <linux/stddef.h>
+
 static const char *const initial_sid_to_string[] = {
 	NULL,
 	"kernel",
Signature · 1 line
2.40.1
#1 lore raw
kernel test robot noticed the following build errors:

Hi Christian,

kernel test robot noticed the following build errors:

[auto build test ERROR on pcmoore-selinux/next]
[also build test ERROR on linus/master v6.4-rc1 next-20230511] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Christian-G-ttsche/selinux-make-header-files-self-including/20230511-203619
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux.git next
patch link:    https://lore.kernel.org/r/20230511123236.723025-1-cgzones%40googlemail.com
patch subject: [PATCH] selinux: make header files self-including
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20230512/[email protected]/config)
compiler: mips-linux-gcc (GCC) 12.1.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/2b237d995d423baa5707fe9f59441d4744892eda
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Christian-G-ttsche/selinux-make-header-files-self-including/20230511-203619 git checkout 2b237d995d423baa5707fe9f59441d4744892eda
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from security/selinux/ibpkey.c:26:

>> security/selinux/include/ibpkey.h:18:10: fatal error: ../flask.h: No such file or directory
      18 | #include "../flask.h"
         |          ^~~~~~~~~~~~

compilation terminated.

vim +18 security/selinux/include/ibpkey.h

    16	
    17	#include <linux/types.h>
  > 18	#include "../flask.h"
    19	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#2 lore raw

PATCH v2 1/1 selinux: make header files self-including

In reply to Christian Göttsche

Include all necessary headers in header files to enable third party applications, like LSP servers, to resolve all used symbols.

ibpkey.h: include "flask.h" for SECINITSID_UNLABELED initial_sid_to_string.h: include <linux/stddef.h> for NULL

---
v2:
use raw flask.h instead of ../flask.h

---
 security/selinux/include/ibpkey.h                | 1 +
 security/selinux/include/initial_sid_to_string.h | 3 +++
 2 files changed, 4 insertions(+)
security/selinux/include/ibpkey.h +1 -0
index c992f83b0aae..875b055849e1 100644
@@ -15,6 +15,7 @@
 #define _SELINUX_IB_PKEY_H
 
 #include <linux/types.h>
+#include "flask.h"
 
 #ifdef CONFIG_SECURITY_INFINIBAND
 void sel_ib_pkey_flush(void);
security/selinux/include/initial_sid_to_string.h +3 -0
index 60820517aa43..ecc6e74fa09b 100644
@@ -1,4 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+
+#include <linux/stddef.h>
+
 static const char *const initial_sid_to_string[] = {
 	NULL,
 	"kernel",
Signature · 1 line
2.40.1
maintainer Applied
#3 lore raw
Quoted 8 lines · On May 12, 2023 =?UTF-8?q?Christian=20G=C3=B6ttsche?= <[email protected]>…

Include all necessary headers in header files to enable third party applications, like LSP servers, to resolve all used symbols.

ibpkey.h: include "flask.h" for SECINITSID_UNLABELED initial_sid_to_string.h: include <linux/stddef.h> for NULL

Quoted 8 lines

---
v2:
use raw flask.h instead of ../flask.h

---
 security/selinux/include/ibpkey.h                | 1 +
 security/selinux/include/initial_sid_to_string.h | 3 +++
 2 files changed, 4 insertions(+)

Merged into selinux/next, thanks.

Quoted 26 lines
security/selinux/include/ibpkey.h +1 -0
index c992f83b0aae..875b055849e1 100644
@@ -15,6 +15,7 @@
 #define _SELINUX_IB_PKEY_H
 
 #include <linux/types.h>
+#include "flask.h"
 
 #ifdef CONFIG_SECURITY_INFINIBAND
 void sel_ib_pkey_flush(void);
security/selinux/include/initial_sid_to_string.h +3 -0
index 60820517aa43..ecc6e74fa09b 100644
@@ -1,4 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+
+#include <linux/stddef.h>
+
 static const char *const initial_sid_to_string[] = {
 	NULL,
 	"kernel",
Signature · 1 line
2.40.1

--
paul-moore.com