diff mbox series

selinux: fix Makefile dependencies of flask.h

Message ID 20230412135919.582613-1-omosnace@redhat.com (mailing list archive)
State Accepted
Delegated to: Paul Moore
Headers show
Series selinux: fix Makefile dependencies of flask.h | expand

Commit Message

Ondrej Mosnacek April 12, 2023, 1:59 p.m. UTC
Make the flask.h target depend on the genheaders binary instead of
classmap.h to ensure that it is rebuilt if any of the dependencies of
genheaders are changed.

Notably this fixes flask.h not being rebuilt when
initial_sid_to_string.h is modified.

Fixes: 8753f6bec352 ("selinux: generate flask headers during kernel build")
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
 security/selinux/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stephen Smalley April 12, 2023, 3:26 p.m. UTC | #1
On Wed, Apr 12, 2023 at 9:59 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> Make the flask.h target depend on the genheaders binary instead of
> classmap.h to ensure that it is rebuilt if any of the dependencies of
> genheaders are changed.
>
> Notably this fixes flask.h not being rebuilt when
> initial_sid_to_string.h is modified.
>
> Fixes: 8753f6bec352 ("selinux: generate flask headers during kernel build")
> Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>

Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>

> ---
>  security/selinux/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/security/selinux/Makefile b/security/selinux/Makefile
> index 7761624448826..103c2776478a7 100644
> --- a/security/selinux/Makefile
> +++ b/security/selinux/Makefile
> @@ -23,8 +23,8 @@ ccflags-y := -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include
>  $(addprefix $(obj)/,$(selinux-y)): $(obj)/flask.h
>
>  quiet_cmd_flask = GEN     $(obj)/flask.h $(obj)/av_permissions.h
> -      cmd_flask = scripts/selinux/genheaders/genheaders $(obj)/flask.h $(obj)/av_permissions.h
> +      cmd_flask = $< $(obj)/flask.h $(obj)/av_permissions.h
>
>  targets += flask.h av_permissions.h
> -$(obj)/flask.h: $(src)/include/classmap.h FORCE
> +$(obj)/flask.h: scripts/selinux/genheaders/genheaders FORCE
>         $(call if_changed,flask)
> --
> 2.39.2
>
Paul Moore April 12, 2023, 8:45 p.m. UTC | #2
On Wed, Apr 12, 2023 at 9:59 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> Make the flask.h target depend on the genheaders binary instead of
> classmap.h to ensure that it is rebuilt if any of the dependencies of
> genheaders are changed.
>
> Notably this fixes flask.h not being rebuilt when
> initial_sid_to_string.h is modified.
>
> Fixes: 8753f6bec352 ("selinux: generate flask headers during kernel build")
> Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
> ---
>  security/selinux/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks Ondrej, I just merged this into selinux/next.  You also
inspired me to fix a build bug with av_permissions.h that has bit me
once or twice :)
diff mbox series

Patch

diff --git a/security/selinux/Makefile b/security/selinux/Makefile
index 7761624448826..103c2776478a7 100644
--- a/security/selinux/Makefile
+++ b/security/selinux/Makefile
@@ -23,8 +23,8 @@  ccflags-y := -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include
 $(addprefix $(obj)/,$(selinux-y)): $(obj)/flask.h
 
 quiet_cmd_flask = GEN     $(obj)/flask.h $(obj)/av_permissions.h
-      cmd_flask = scripts/selinux/genheaders/genheaders $(obj)/flask.h $(obj)/av_permissions.h
+      cmd_flask = $< $(obj)/flask.h $(obj)/av_permissions.h
 
 targets += flask.h av_permissions.h
-$(obj)/flask.h: $(src)/include/classmap.h FORCE
+$(obj)/flask.h: scripts/selinux/genheaders/genheaders FORCE
 	$(call if_changed,flask)