2019-07-26 02:12:51

by Masahiro Yamada

[permalink] [raw]
Subject: [PATCH 0/5] security: integrity: Makefile cleanups

Masahiro Yamada (5):
integrity: remove unneeded, broken attempt to add -fshort-wchar
integrity: remove pointless subdir-$(CONFIG_...)
integrity: use obj-y for non-modular objects
IMA: use obj-y for non-modular objects
EVM: use obj-y for non-modular objects

security/integrity/Makefile | 19 +++++++------------
security/integrity/evm/Makefile | 6 ++----
security/integrity/ima/Makefile | 8 +++-----
3 files changed, 12 insertions(+), 21 deletions(-)

--
2.17.1



2019-07-26 02:13:09

by Masahiro Yamada

[permalink] [raw]
Subject: [PATCH 3/5] integrity: use obj-y for non-modular objects

CONFIG_INTEGRITY is a boolean option, so none of these objects is
linked into a module.

All of the other CONFIG options here depend on CONFIG_INTEGRITY,
so there is no point in creating the composite object, integirity.o

Flatten the code into the obj-$(CONFIG_...) form.

Signed-off-by: Masahiro Yamada <[email protected]>
---

security/integrity/Makefile | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/security/integrity/Makefile b/security/integrity/Makefile
index 35e6ca773734..53bb1d70e631 100644
--- a/security/integrity/Makefile
+++ b/security/integrity/Makefile
@@ -3,16 +3,14 @@
# Makefile for caching inode integrity data (iint)
#

-obj-$(CONFIG_INTEGRITY) += integrity.o
-
-integrity-y := iint.o
-integrity-$(CONFIG_INTEGRITY_AUDIT) += integrity_audit.o
-integrity-$(CONFIG_INTEGRITY_SIGNATURE) += digsig.o
-integrity-$(CONFIG_INTEGRITY_ASYMMETRIC_KEYS) += digsig_asymmetric.o
-integrity-$(CONFIG_INTEGRITY_PLATFORM_KEYRING) += platform_certs/platform_keyring.o
-integrity-$(CONFIG_LOAD_UEFI_KEYS) += platform_certs/efi_parser.o \
+obj-$(CONFIG_INTEGRITY) += iint.o
+obj-$(CONFIG_INTEGRITY_AUDIT) += integrity_audit.o
+obj-$(CONFIG_INTEGRITY_SIGNATURE) += digsig.o
+obj-$(CONFIG_INTEGRITY_ASYMMETRIC_KEYS) += digsig_asymmetric.o
+obj-$(CONFIG_INTEGRITY_PLATFORM_KEYRING) += platform_certs/platform_keyring.o
+obj-$(CONFIG_LOAD_UEFI_KEYS) += platform_certs/efi_parser.o \
platform_certs/load_uefi.o
-integrity-$(CONFIG_LOAD_IPL_KEYS) += platform_certs/load_ipl_s390.o
+obj-$(CONFIG_LOAD_IPL_KEYS) += platform_certs/load_ipl_s390.o

obj-$(CONFIG_IMA) += ima/
obj-$(CONFIG_EVM) += evm/
--
2.17.1


2019-07-26 02:13:12

by Masahiro Yamada

[permalink] [raw]
Subject: [PATCH 4/5] IMA: use obj-y for non-modular objects

CONFIG_IMA is a boolean option, so none of these objects is linked
into a module.

All the objects in this directory are compiled only when CONFIG_IMA=y
since this directory is guarded by the parent Makefile:

obj-$(CONFIG_IMA) += ima/

So, there is no point in creating the composite object, ima.o

Flatten the code into the obj-$(CONFIG_...) form.

Signed-off-by: Masahiro Yamada <[email protected]>
---

security/integrity/ima/Makefile | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/security/integrity/ima/Makefile b/security/integrity/ima/Makefile
index d921dc4f9eb0..5517486c9154 100644
--- a/security/integrity/ima/Makefile
+++ b/security/integrity/ima/Makefile
@@ -4,10 +4,8 @@
# Measurement Architecture(IMA).
#

-obj-$(CONFIG_IMA) += ima.o
-
-ima-y := ima_fs.o ima_queue.o ima_init.o ima_main.o ima_crypto.o ima_api.o \
+obj-y := ima_fs.o ima_queue.o ima_init.o ima_main.o ima_crypto.o ima_api.o \
ima_policy.o ima_template.o ima_template_lib.o
-ima-$(CONFIG_IMA_APPRAISE) += ima_appraise.o
-ima-$(CONFIG_HAVE_IMA_KEXEC) += ima_kexec.o
+obj-$(CONFIG_IMA_APPRAISE) += ima_appraise.o
+obj-$(CONFIG_HAVE_IMA_KEXEC) += ima_kexec.o
obj-$(CONFIG_IMA_BLACKLIST_KEYRING) += ima_mok.o
--
2.17.1


2019-07-26 02:13:28

by Masahiro Yamada

[permalink] [raw]
Subject: [PATCH 2/5] integrity: remove pointless subdir-$(CONFIG_...)

The ima/ and evm/ sub-directories contain built-in objects, so
obj-$(CONFIG_...) is the correct way to descend into them.

subdir-$(CONFIG_...) is redundant.

Signed-off-by: Masahiro Yamada <[email protected]>
---

security/integrity/Makefile | 2 --
1 file changed, 2 deletions(-)

diff --git a/security/integrity/Makefile b/security/integrity/Makefile
index b6d6273a4176..35e6ca773734 100644
--- a/security/integrity/Makefile
+++ b/security/integrity/Makefile
@@ -14,7 +14,5 @@ integrity-$(CONFIG_LOAD_UEFI_KEYS) += platform_certs/efi_parser.o \
platform_certs/load_uefi.o
integrity-$(CONFIG_LOAD_IPL_KEYS) += platform_certs/load_ipl_s390.o

-subdir-$(CONFIG_IMA) += ima
obj-$(CONFIG_IMA) += ima/
-subdir-$(CONFIG_EVM) += evm
obj-$(CONFIG_EVM) += evm/
--
2.17.1


2019-07-26 04:38:17

by Eric Biggers

[permalink] [raw]
Subject: Re: [PATCH 4/5] IMA: use obj-y for non-modular objects

On Fri, Jul 26, 2019 at 11:10:57AM +0900, Masahiro Yamada wrote:
> CONFIG_IMA is a boolean option, so none of these objects is linked
> into a module.
>
> All the objects in this directory are compiled only when CONFIG_IMA=y
> since this directory is guarded by the parent Makefile:
>
> obj-$(CONFIG_IMA) += ima/
>
> So, there is no point in creating the composite object, ima.o
>
> Flatten the code into the obj-$(CONFIG_...) form.
>
> Signed-off-by: Masahiro Yamada <[email protected]>
> ---
>
> security/integrity/ima/Makefile | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/security/integrity/ima/Makefile b/security/integrity/ima/Makefile
> index d921dc4f9eb0..5517486c9154 100644
> --- a/security/integrity/ima/Makefile
> +++ b/security/integrity/ima/Makefile
> @@ -4,10 +4,8 @@
> # Measurement Architecture(IMA).
> #
>
> -obj-$(CONFIG_IMA) += ima.o
> -
> -ima-y := ima_fs.o ima_queue.o ima_init.o ima_main.o ima_crypto.o ima_api.o \
> +obj-y := ima_fs.o ima_queue.o ima_init.o ima_main.o ima_crypto.o ima_api.o \
> ima_policy.o ima_template.o ima_template_lib.o
> -ima-$(CONFIG_IMA_APPRAISE) += ima_appraise.o
> -ima-$(CONFIG_HAVE_IMA_KEXEC) += ima_kexec.o
> +obj-$(CONFIG_IMA_APPRAISE) += ima_appraise.o
> +obj-$(CONFIG_HAVE_IMA_KEXEC) += ima_kexec.o
> obj-$(CONFIG_IMA_BLACKLIST_KEYRING) += ima_mok.o
> --

This patch changes the kernel command line options

ima.ahash_minsize
ima.ahash_bufsize

to
ima_crypto.ahash_minsize
ima_crypto.ahash_bufsize

Intentional?

Note that these are documented in
Documentation/admin-guide/kernel-parameters.txt.

- Eric

2019-07-26 07:07:04

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH 4/5] IMA: use obj-y for non-modular objects

On Fri, Jul 26, 2019 at 1:37 PM Eric Biggers <[email protected]> wrote:
>
> On Fri, Jul 26, 2019 at 11:10:57AM +0900, Masahiro Yamada wrote:
> > CONFIG_IMA is a boolean option, so none of these objects is linked
> > into a module.
> >
> > All the objects in this directory are compiled only when CONFIG_IMA=y
> > since this directory is guarded by the parent Makefile:
> >
> > obj-$(CONFIG_IMA) += ima/
> >
> > So, there is no point in creating the composite object, ima.o
> >
> > Flatten the code into the obj-$(CONFIG_...) form.
> >
> > Signed-off-by: Masahiro Yamada <[email protected]>
> > ---
> >
> > security/integrity/ima/Makefile | 8 +++-----
> > 1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/security/integrity/ima/Makefile b/security/integrity/ima/Makefile
> > index d921dc4f9eb0..5517486c9154 100644
> > --- a/security/integrity/ima/Makefile
> > +++ b/security/integrity/ima/Makefile
> > @@ -4,10 +4,8 @@
> > # Measurement Architecture(IMA).
> > #
> >
> > -obj-$(CONFIG_IMA) += ima.o
> > -
> > -ima-y := ima_fs.o ima_queue.o ima_init.o ima_main.o ima_crypto.o ima_api.o \
> > +obj-y := ima_fs.o ima_queue.o ima_init.o ima_main.o ima_crypto.o ima_api.o \
> > ima_policy.o ima_template.o ima_template_lib.o
> > -ima-$(CONFIG_IMA_APPRAISE) += ima_appraise.o
> > -ima-$(CONFIG_HAVE_IMA_KEXEC) += ima_kexec.o
> > +obj-$(CONFIG_IMA_APPRAISE) += ima_appraise.o
> > +obj-$(CONFIG_HAVE_IMA_KEXEC) += ima_kexec.o
> > obj-$(CONFIG_IMA_BLACKLIST_KEYRING) += ima_mok.o
> > --
>
> This patch changes the kernel command line options
>
> ima.ahash_minsize
> ima.ahash_bufsize
>
> to
> ima_crypto.ahash_minsize
> ima_crypto.ahash_bufsize
>
> Intentional?

No.
I missed those kernel parameters.
So, please drop this patch.

I see no problem in 3/5, 5/5, but
if composite object is preferred for consistency,
please feel free to drop them as well.

Thanks.




> Note that these are documented in
> Documentation/admin-guide/kernel-parameters.txt.






--
Best Regards
Masahiro Yamada

2019-09-10 00:19:22

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH 2/5] integrity: remove pointless subdir-$(CONFIG_...)

On Fri, Jul 26, 2019 at 11:12 AM Masahiro Yamada
<[email protected]> wrote:
>
> The ima/ and evm/ sub-directories contain built-in objects, so
> obj-$(CONFIG_...) is the correct way to descend into them.
>
> subdir-$(CONFIG_...) is redundant.
>
> Signed-off-by: Masahiro Yamada <[email protected]>
> ---

Ping.


>
> security/integrity/Makefile | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/security/integrity/Makefile b/security/integrity/Makefile
> index b6d6273a4176..35e6ca773734 100644
> --- a/security/integrity/Makefile
> +++ b/security/integrity/Makefile
> @@ -14,7 +14,5 @@ integrity-$(CONFIG_LOAD_UEFI_KEYS) += platform_certs/efi_parser.o \
> platform_certs/load_uefi.o
> integrity-$(CONFIG_LOAD_IPL_KEYS) += platform_certs/load_ipl_s390.o
>
> -subdir-$(CONFIG_IMA) += ima
> obj-$(CONFIG_IMA) += ima/
> -subdir-$(CONFIG_EVM) += evm
> obj-$(CONFIG_EVM) += evm/
> --
> 2.17.1
>


--
Best Regards
Masahiro Yamada