2023-05-11 12:36:39

by Christian Göttsche

[permalink] [raw]
Subject: [PATCH] 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

Signed-off-by: Christian Göttsche <[email protected]>
---
security/selinux/include/ibpkey.h | 1 +
security/selinux/include/initial_sid_to_string.h | 3 +++
2 files changed, 4 insertions(+)

diff --git a/security/selinux/include/ibpkey.h b/security/selinux/include/ibpkey.h
index c992f83b0aae..f8a791b07092 100644
--- a/security/selinux/include/ibpkey.h
+++ b/security/selinux/include/ibpkey.h
@@ -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);
diff --git a/security/selinux/include/initial_sid_to_string.h b/security/selinux/include/initial_sid_to_string.h
index 60820517aa43..ecc6e74fa09b 100644
--- a/security/selinux/include/initial_sid_to_string.h
+++ b/security/selinux/include/initial_sid_to_string.h
@@ -1,4 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <linux/stddef.h>
+
static const char *const initial_sid_to_string[] = {
NULL,
"kernel",
--
2.40.1



2023-05-12 02:26:10

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] selinux: make header files self-including

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

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

2023-05-12 09:29:28

by Christian Göttsche

[permalink] [raw]
Subject: [PATCH v2] 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

Signed-off-by: Christian Göttsche <[email protected]>
---
v2:
use raw flask.h instead of ../flask.h
Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
---
security/selinux/include/ibpkey.h | 1 +
security/selinux/include/initial_sid_to_string.h | 3 +++
2 files changed, 4 insertions(+)

diff --git a/security/selinux/include/ibpkey.h b/security/selinux/include/ibpkey.h
index c992f83b0aae..875b055849e1 100644
--- a/security/selinux/include/ibpkey.h
+++ b/security/selinux/include/ibpkey.h
@@ -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);
diff --git a/security/selinux/include/initial_sid_to_string.h b/security/selinux/include/initial_sid_to_string.h
index 60820517aa43..ecc6e74fa09b 100644
--- a/security/selinux/include/initial_sid_to_string.h
+++ b/security/selinux/include/initial_sid_to_string.h
@@ -1,4 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <linux/stddef.h>
+
static const char *const initial_sid_to_string[] = {
NULL,
"kernel",
--
2.40.1


2023-05-18 18:31:23

by Paul Moore

[permalink] [raw]
Subject: Re: [PATCH v2] selinux: make header files self-including

On May 12, 2023 =?UTF-8?q?Christian=20G=C3=B6ttsche?= <[email protected]> wrote:
>
> 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
>
> Signed-off-by: Christian Göttsche <[email protected]>
> ---
> v2:
> use raw flask.h instead of ../flask.h
> Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> ---
> 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.

> diff --git a/security/selinux/include/ibpkey.h b/security/selinux/include/ibpkey.h
> index c992f83b0aae..875b055849e1 100644
> --- a/security/selinux/include/ibpkey.h
> +++ b/security/selinux/include/ibpkey.h
> @@ -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);
> diff --git a/security/selinux/include/initial_sid_to_string.h b/security/selinux/include/initial_sid_to_string.h
> index 60820517aa43..ecc6e74fa09b 100644
> --- a/security/selinux/include/initial_sid_to_string.h
> +++ b/security/selinux/include/initial_sid_to_string.h
> @@ -1,4 +1,7 @@
> /* SPDX-License-Identifier: GPL-2.0 */
> +
> +#include <linux/stddef.h>
> +
> static const char *const initial_sid_to_string[] = {
> NULL,
> "kernel",
> --
> 2.40.1

--
paul-moore.com