ima: add a new CONFIG for loading arch-specific policies
Subsystems (8)
PATCH v2 1/1 ima: add a new CONFIG for loading arch-specific policies
Every time a new architecture defines the IMA architecture specific functions - arch_ima_get_secureboot() and arch_ima_get_policy(), the IMA include file needs to be updated. To avoid this "noise", this patch defines a new IMA Kconfig IMA_SECURE_AND_OR_TRUSTED_BOOT option, allowing the different architectures to select it.
---
v2:
* Fixed the issue identified by Mimi. Thanks Mimi, Ard, Heiko and Michael for discussing the fix.
arch/powerpc/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/x86/Kconfig | 1 + include/linux/ima.h | 3 +-- security/integrity/ima/Kconfig | 9 +++++++++ 5 files changed, 13 insertions(+), 2 deletions(-)
arch/powerpc/Kconfig +1 -0
@@ -979,6 +979,7 @@ config PPC_SECURE_BOOT bool depends on PPC_POWERNV depends on IMA_ARCH_POLICY + select IMA_SECURE_AND_OR_TRUSTED_BOOT help Systems with firmware secure boot enabled need to define security policies to extend secure boot to the OS. This config allows a user
arch/s390/Kconfig +1 -0
@@ -195,6 +195,7 @@ config S390 select ARCH_HAS_FORCE_DMA_UNENCRYPTED select SWIOTLB select GENERIC_ALLOCATOR + select IMA_SECURE_AND_OR_TRUSTED_BOOT if IMA_ARCH_POLICY config SCHED_OMIT_FRAME_POINTER
arch/x86/Kconfig +1 -0
@@ -230,6 +230,7 @@ config X86 select VIRT_TO_BUS select X86_FEATURE_NAMES if PROC_FS select PROC_PID_ARCH_STATUS if PROC_FS + select IMA_SECURE_AND_OR_TRUSTED_BOOT if EFI && IMA_ARCH_POLICY config INSTRUCTION_DECODER def_bool y
include/linux/ima.h +1 -2
@@ -30,8 +30,7 @@ extern void ima_kexec_cmdline(const void *buf, int size);extern void ima_add_kexec_buffer (struct kimage *image);#endif -#if (defined(CONFIG_X86 ) && defined(CONFIG_EFI )) || defined(CONFIG_S390 ) \ - || defined(CONFIG_PPC_SECURE_BOOT ) +#ifdef CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT extern bool arch_ima_get_secureboot (void );extern const char *const *arch_get_ima_policy (void );#else
security/integrity/ima/Kconfig +9 -0
@@ -327,3 +327,12 @@ config IMA_QUEUE_EARLY_BOOT_KEYS depends on IMA_MEASURE_ASYMMETRIC_KEYS depends on SYSTEM_TRUSTED_KEYRING default y + +config IMA_SECURE_AND_OR_TRUSTED_BOOT + bool + depends on IMA + depends on IMA_ARCH_POLICY + default n + help + This option is selected by architectures to enable secure and/or + trusted boot based on IMA runtime policies.
Signature · 1 line
2.13.6
Quoted 7 lines · Nayna Jain
Every time a new architecture defines the IMA architecture specific functions -
arch_ima_get_secureboot()andarch_ima_get_policy(), the IMA include file needs to be updated. To avoid this "noise", this patch defines a new IMAKconfigIMA_SECURE_AND_OR_TRUSTED_BOOToption, allowing the different architectures to select it.
Quoted 5 lines
Suggested-by Linus Torvalds <[email protected]>Signed-off-by Nayna Jain <[email protected]>Cc Ard Biesheuvel <[email protected]>Cc Philipp Rudo <[email protected]>Cc Michael Ellerman <[email protected]>
for the x86 bits, but I'm not an x86 maintainer. Also, you may need to split this if you want to permit arch maintainers to pick up their parts individually.
Quoted 67 lines
---
v2:
* Fixed the issue identified by Mimi. Thanks Mimi, Ard, Heiko and Michael for discussing the fix.arch/powerpc/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/x86/Kconfig | 1 + include/linux/ima.h | 3 +-- security/integrity/ima/Kconfig | 9 +++++++++ 5 files changed, 13 insertions(+), 2 deletions(-)arch/powerpc/Kconfig +1
-0@@ -979,6 +979,7 @@ config PPC_SECURE_BOOT bool depends on PPC_POWERNV depends on IMA_ARCH_POLICY + select IMA_SECURE_AND_OR_TRUSTED_BOOT help Systems with firmware secure boot enabled need to define security policies to extend secure boot to the OS. This config allows a userarch/s390/Kconfig +1
-0@@ -195,6 +195,7 @@ config S390 select ARCH_HAS_FORCE_DMA_UNENCRYPTED select SWIOTLB select GENERIC_ALLOCATOR + select IMA_SECURE_AND_OR_TRUSTED_BOOT if IMA_ARCH_POLICY config SCHED_OMIT_FRAME_POINTERarch/x86/Kconfig +1
-0@@ -230,6 +230,7 @@ config X86 select VIRT_TO_BUS select X86_FEATURE_NAMES if PROC_FS select PROC_PID_ARCH_STATUS if PROC_FS + select IMA_SECURE_AND_OR_TRUSTED_BOOT if EFI && IMA_ARCH_POLICY config INSTRUCTION_DECODER def_bool yinclude/linux/ima.h +1
-2@@ -30,8 +30,7 @@ extern void ima_kexec_cmdline(const void *buf, int size);extern void ima_add_kexec_buffer (struct kimage *image);#endif -#if (defined(CONFIG_X86 ) && defined(CONFIG_EFI )) || defined(CONFIG_S390 ) \ - || defined(CONFIG_PPC_SECURE_BOOT ) +#ifdef CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT extern bool arch_ima_get_secureboot (void );extern const char *const *arch_get_ima_policy (void );#else security/integrity/ima/Kconfig +0
-0
security/integrity/ima/Kconfig config IMA_QUEUE_EARLY_BOOT_KEYS · line 334
Quoted 8 lines
security/integrity/ima/Kconfig +5
-0@@ -327,3 +327,12 @@ config IMA_QUEUE_EARLY_BOOT_KEYS depends on IMA_MEASURE_ASYMMETRIC_KEYS depends on SYSTEM_TRUSTED_KEYRING default y + +config IMA_SECURE_AND_OR_TRUSTED_BOOT + bool + depends on IMA + depends on IMA_ARCH_POLICY
Doesn't the latter already depend on the former?
Quoted 7 lines
security/integrity/ima/Kconfig +4
-1+ default n + help + This option is selected by architectures to enable secure and/or + trusted boot based on IMA runtime policies. --2.13.6
Mimi Zohar
maintainer[Cc'ing Thomas Gleixner and x86 mailing list]
Quoted 8 lines · Ard Biesheuvel
Quoted 7 lines · Nayna Jain
Every time a new architecture defines the IMA architecture specific functions -
arch_ima_get_secureboot()andarch_ima_get_policy(), the IMA include file needs to be updated. To avoid this "noise", this patch defines a new IMAKconfigIMA_SECURE_AND_OR_TRUSTED_BOOToption, allowing the different architectures to select it.
Quoted 7 lines
Quoted 5 lines
Suggested-by Linus Torvalds <[email protected]>Signed-off-by Nayna Jain <[email protected]>Cc Ard Biesheuvel <[email protected]>Cc Philipp Rudo <[email protected]>Cc Michael Ellerman <[email protected]>Acked-by Ard Biesheuvel <[email protected]>
Thanks, Ard.
Quoted 4 lines
for the x86 bits, but I'm not an x86 maintainer. Also, you may need to split this if you want to permit arch maintainers to pick up their parts individually.
Michael, Philipp, Thomas, do you prefer separate patches?
Quoted 70 lines
Quoted 70 lines
---
v2:
* Fixed the issue identified by Mimi. Thanks Mimi, Ard, Heiko and Michael for discussing the fix.arch/powerpc/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/x86/Kconfig | 1 + include/linux/ima.h | 3 +-- security/integrity/ima/Kconfig | 9 +++++++++ 5 files changed, 13 insertions(+), 2 deletions(-)arch/powerpc/Kconfig +1
-0@@ -979,6 +979,7 @@ config PPC_SECURE_BOOT bool depends on PPC_POWERNV depends on IMA_ARCH_POLICY + select IMA_SECURE_AND_OR_TRUSTED_BOOT help Systems with firmware secure boot enabled need to define security policies to extend secure boot to the OS. This config allows a userarch/s390/Kconfig +1
-0@@ -195,6 +195,7 @@ config S390 select ARCH_HAS_FORCE_DMA_UNENCRYPTED select SWIOTLB select GENERIC_ALLOCATOR + select IMA_SECURE_AND_OR_TRUSTED_BOOT if IMA_ARCH_POLICY config SCHED_OMIT_FRAME_POINTERarch/x86/Kconfig +1
-0@@ -230,6 +230,7 @@ config X86 select VIRT_TO_BUS select X86_FEATURE_NAMES if PROC_FS select PROC_PID_ARCH_STATUS if PROC_FS + select IMA_SECURE_AND_OR_TRUSTED_BOOT if EFI && IMA_ARCH_POLICY config INSTRUCTION_DECODER def_bool yinclude/linux/ima.h +1
-2@@ -30,8 +30,7 @@ extern void ima_kexec_cmdline(const void *buf, int size);extern void ima_add_kexec_buffer (struct kimage *image);#endif -#if (defined(CONFIG_X86 ) && defined(CONFIG_EFI )) || defined(CONFIG_S390 ) \ - || defined(CONFIG_PPC_SECURE_BOOT ) +#ifdef CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT extern bool arch_ima_get_secureboot (void );extern const char *const *arch_get_ima_policy (void );#else security/integrity/ima/Kconfig +0
-0@@ -327,3 +327,12 @@ config IMA_QUEUE_EARLY_BOOT_KEYS depends on IMA_MEASURE_ASYMMETRIC_KEYS depends on SYSTEM_TRUSTED_KEYRING
Quoted 8 lines
security/integrity/ima/Kconfig config IMA_QUEUE_EARLY_BOOT_KEYS · line 334
Quoted 6 lines
security/integrity/ima/Kconfig +5
-0default y + +config IMA_SECURE_AND_OR_TRUSTED_BOOT + bool + depends on IMA + depends on IMA_ARCH_POLICYDoesn't the latter already depend on the former?
Yes, there's no need for the first.
Mimi
Quoted 8 lines
Quoted 8 lines
security/integrity/ima/Kconfig +4
-1+ default n + help + This option is selected by architectures to enable secure and/or + trusted boot based on IMA runtime policies. --2.13.6
Quoted 19 lines · On Wed, 04 Mar 2020 07:55:38 -0500 Mimi Zohar <[email protected]> wrote:
[Cc'ing Thomas Gleixner and x86 mailing list]
Quoted 8 lines · Ard Biesheuvel
Quoted 7 lines · Nayna Jain
Every time a new architecture defines the IMA architecture specific functions -
arch_ima_get_secureboot()andarch_ima_get_policy(), the IMA include file needs to be updated. To avoid this "noise", this patch defines a new IMAKconfigIMA_SECURE_AND_OR_TRUSTED_BOOToption, allowing the different architectures to select it.Quoted 7 lines
Quoted 5 lines
Suggested-by Linus Torvalds <[email protected]>Signed-off-by Nayna Jain <[email protected]>Cc Ard Biesheuvel <[email protected]>Cc Philipp Rudo <[email protected]>Cc Michael Ellerman <[email protected]>Acked-by Ard Biesheuvel <[email protected]>
Quoted 7 lines
Thanks, Ard.
Quoted 4 lines
for the x86 bits, but I'm not an x86 maintainer. Also, you may need to split this if you want to permit arch maintainers to pick up their parts individually.
Michael, Philipp, Thomas, do you prefer separate patches?
I don't think splitting this patch makes sense. Otherwise you would break the build for all architectures until they picked up their line of code.
I'm fine with the patch as is.
Thanks
Philipp
Quoted 91 lines
Quoted 70 lines
Quoted 70 lines
---
v2:
* Fixed the issue identified by Mimi. Thanks Mimi, Ard, Heiko and Michael for discussing the fix.arch/powerpc/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/x86/Kconfig | 1 + include/linux/ima.h | 3 +-- security/integrity/ima/Kconfig | 9 +++++++++ 5 files changed, 13 insertions(+), 2 deletions(-)arch/powerpc/Kconfig +1
-0@@ -979,6 +979,7 @@ config PPC_SECURE_BOOT bool depends on PPC_POWERNV depends on IMA_ARCH_POLICY + select IMA_SECURE_AND_OR_TRUSTED_BOOT help Systems with firmware secure boot enabled need to define security policies to extend secure boot to the OS. This config allows a userarch/s390/Kconfig +1
-0@@ -195,6 +195,7 @@ config S390 select ARCH_HAS_FORCE_DMA_UNENCRYPTED select SWIOTLB select GENERIC_ALLOCATOR + select IMA_SECURE_AND_OR_TRUSTED_BOOT if IMA_ARCH_POLICY config SCHED_OMIT_FRAME_POINTERarch/x86/Kconfig +1
-0@@ -230,6 +230,7 @@ config X86 select VIRT_TO_BUS select X86_FEATURE_NAMES if PROC_FS select PROC_PID_ARCH_STATUS if PROC_FS + select IMA_SECURE_AND_OR_TRUSTED_BOOT if EFI && IMA_ARCH_POLICY config INSTRUCTION_DECODER def_bool yinclude/linux/ima.h +1
-2@@ -30,8 +30,7 @@ extern void ima_kexec_cmdline(const void *buf, int size);extern void ima_add_kexec_buffer (struct kimage *image);#endif -#if (defined(CONFIG_X86 ) && defined(CONFIG_EFI )) || defined(CONFIG_S390 ) \ - || defined(CONFIG_PPC_SECURE_BOOT ) +#ifdef CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT extern bool arch_ima_get_secureboot (void );extern const char *const *arch_get_ima_policy (void );#else security/integrity/ima/Kconfig +0
-0@@ -327,3 +327,12 @@ config IMA_QUEUE_EARLY_BOOT_KEYS depends on IMA_MEASURE_ASYMMETRIC_KEYS depends on SYSTEM_TRUSTED_KEYRINGQuoted 8 lines
security/integrity/ima/Kconfig config IMA_QUEUE_EARLY_BOOT_KEYS · line 334
Quoted 6 lines
security/integrity/ima/Kconfig +5
-0default y + +config IMA_SECURE_AND_OR_TRUSTED_BOOT + bool + depends on IMA + depends on IMA_ARCH_POLICYDoesn't the latter already depend on the former?
Yes, there's no need for the first.
Mimi
Quoted 8 lines
Quoted 8 lines
security/integrity/ima/Kconfig +4
-1+ default n + help + This option is selected by architectures to enable secure and/or + trusted boot based on IMA runtime policies. --2.13.6
James Bottomley
maintainerQuoted 87 lines · Nayna Jain
Every time a new architecture defines the IMA architecture specific functions -
arch_ima_get_secureboot()andarch_ima_get_policy(), the IMA
include file needs to be updated. To avoid this "noise", this patch defines a new IMAKconfigIMA_SECURE_AND_OR_TRUSTED_BOOToption, allowing
the different architectures to select it.Suggested-by Linus Torvalds <[email protected]>Signed-off-by Nayna Jain <[email protected]>Cc Ard Biesheuvel <[email protected]>Cc Philipp Rudo <[email protected]>Cc Michael Ellerman <[email protected]>---
v2:
* Fixed the issue identified by Mimi. Thanks Mimi, Ard, Heiko and Michael for
discussing the fix.arch/powerpc/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/x86/Kconfig | 1 + include/linux/ima.h | 3 +-- security/integrity/ima/Kconfig | 9 +++++++++ 5 files changed, 13 insertions(+), 2 deletions(-)arch/powerpc/Kconfig +1
-0@@ -979,6 +979,7 @@ config PPC_SECURE_BOOT bool depends on PPC_POWERNV depends on IMA_ARCH_POLICY + select IMA_SECURE_AND_OR_TRUSTED_BOOT help Systems with firmware secure boot enabled need to definesecurity
policies to extend secure boot to the OS. This config
allows a userarch/s390/Kconfig +1
-0@@ -195,6 +195,7 @@ config S390 select ARCH_HAS_FORCE_DMA_UNENCRYPTED select SWIOTLB select GENERIC_ALLOCATOR + select IMA_SECURE_AND_OR_TRUSTED_BOOT if IMA_ARCH_POLICY config SCHED_OMIT_FRAME_POINTERarch/x86/Kconfig +1
-0@@ -230,6 +230,7 @@ config X86 select VIRT_TO_BUS select X86_FEATURE_NAMES if PROC_FS select PROC_PID_ARCH_STATUS if PROC_FS + select IMA_SECURE_AND_OR_TRUSTED_BOOT if EFI &&
IMA_ARCH_POLICYconfig
INSTRUCTION_DECODERarch/x86/Kconfig +0
-0def_bool yinclude/linux/ima.h +1
-2@@ -30,8 +30,7 @@ extern void ima_kexec_cmdline(const void *buf, int size);extern void ima_add_kexec_buffer (struct kimage *image);#endif -#if (defined(CONFIG_X86 ) && defined(CONFIG_EFI )) || defined(CONFIG_S390) \ - || defined(CONFIG_PPC_SECURE_BOOT ) +#ifdef CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT extern bool arch_ima_get_secureboot (void );extern const char * const
*arch_get_ima_policy(void); #elsesecurity/integrity/ima/Kconfig +0
-0
security/integrity/ima/Kconfig config IMA_QUEUE_EARLY_BOOT_KEYS · line 335
Quoted 9 lines
security/integrity/ima/Kconfig +6
-0@@ -327,3 +327,12 @@ config IMA_QUEUE_EARLY_BOOT_KEYS depends on IMA_MEASURE_ASYMMETRIC_KEYS depends on SYSTEM_TRUSTED_KEYRING default y + +config IMA_SECURE_AND_OR_TRUSTED_BOOT + bool + depends on IMA + depends on IMA_ARCH_POLICY + default n
You can't do this: a symbol designed to be selected can't depend on other symbols because Kconfig doesn't see the dependencies during select. We even have a doc for this now:
Documentation/kbuild/Kconfig.select-break
The only way to get this to work would be to have the long name symbol select both IMA and IMA_ARCH_POLICY, which doesn't seem to be what you want either.
Looking at what you're trying to do, I think making the symbol independent of IMA and IMA_ARCH_POLICY is the correct thing, then enforce the dependencies inside the outer #ifdef, but I haven't looked deeply at the code.
James
Mimi Zohar
maintainerQuoted 22 lines · James Bottomley
Quoted 6 lines · Nayna Jain
security/integrity/ima/Kconfig +0
-0security/integrity/ima/Kconfig config IMA_QUEUE_EARLY_BOOT_KEYS · line 335
Quoted 9 lines
security/integrity/ima/Kconfig +6
-0@@ -327,3 +327,12 @@ config IMA_QUEUE_EARLY_BOOT_KEYS depends on IMA_MEASURE_ASYMMETRIC_KEYS depends on SYSTEM_TRUSTED_KEYRING default y + +config IMA_SECURE_AND_OR_TRUSTED_BOOT + bool + depends on IMA + depends on IMA_ARCH_POLICY + default nYou can't do this: a symbol designed to be selected can't depend on other symbols because
Kconfigdoesn't see the dependencies during select. We even have a doc for this now:
Quoted 1 line
Documentation/kbuild/Kconfig.select-break
The document is discussing a circular dependency, where C selects B. IMA_SECURE_AND_OR_TRUSTED_BOOT is not selecting anything, but is being selected. All of the Kconfig's are now dependent on IMA_ARCH_POLICY being enabled before selecting IMA_SECURE_AND_OR_TRUSTED_BOOT.
As Ard pointed out, both IMA and IMA_ARCH_POLICY are not needed, as IMA_ARCH_POLICY is already dependent on IMA.
Mimi
James Bottomley
maintainerQuoted 24 lines · Mimi Zohar
Quoted 21 lines · James Bottomley
Quoted 6 lines · Nayna Jain
security/integrity/ima/Kconfig +0
-0security/integrity/ima/Kconfig config IMA_QUEUE_EARLY_BOOT_KEYS · line 335
Quoted 9 lines
security/integrity/ima/Kconfig +6
-0@@ -327,3 +327,12 @@ config IMA_QUEUE_EARLY_BOOT_KEYS depends on IMA_MEASURE_ASYMMETRIC_KEYS depends on SYSTEM_TRUSTED_KEYRING default y + +config IMA_SECURE_AND_OR_TRUSTED_BOOT + bool + depends on IMA + depends on IMA_ARCH_POLICY + default nYou can't do this: a symbol designed to be selected can't depend on other symbols because
Kconfigdoesn't see the dependencies during select. We even have a doc for this now:Quoted 1 line
Documentation/kbuild/Kconfig.select-break
Quoted 8 lines
The document is discussing a circular dependency, where C selects B.
IMA_SECURE_AND_OR_TRUSTED_BOOTis not selecting anything, but is
being selected. All of the Kconfig's are now dependent onIMA_ARCH_POLICYbeing enabled before selectingIMA_SECURE_AND_OR_TRUSTED_BOOT.As Ard pointed out, both IMA and
IMA_ARCH_POLICYare not needed, asIMA_ARCH_POLICYis already dependent on IMA.
Then removing them is fine, if they're not necessary ... you just can't
select a symbol with dependencies because the two Kconfig mechanisms
don't mix.
James
Michael Ellerman
reviewerQuoted 31 lines · James Bottomley
Quoted 30 lines · Mimi Zohar
Quoted 21 lines · James Bottomley
Quoted 6 lines · Nayna Jain
security/integrity/ima/Kconfig +0
-0security/integrity/ima/Kconfig config IMA_QUEUE_EARLY_BOOT_KEYS · line 335
Quoted 9 lines
security/integrity/ima/Kconfig +6
-0@@ -327,3 +327,12 @@ config IMA_QUEUE_EARLY_BOOT_KEYS depends on IMA_MEASURE_ASYMMETRIC_KEYS depends on SYSTEM_TRUSTED_KEYRING default y + +config IMA_SECURE_AND_OR_TRUSTED_BOOT + bool + depends on IMA + depends on IMA_ARCH_POLICY + default nYou can't do this: a symbol designed to be selected can't depend on other symbols because
Kconfigdoesn't see the dependencies during select. We even have a doc for this now:Quoted 1 line
Documentation/kbuild/Kconfig.select-breakThe document is discussing a circular dependency, where C selects B.
IMA_SECURE_AND_OR_TRUSTED_BOOTis not selecting anything, but is
being selected. All of the Kconfig's are now dependent onIMA_ARCH_POLICYbeing enabled before selectingIMA_SECURE_AND_OR_TRUSTED_BOOT.
Quoted 6 lines
Quoted 2 lines
As Ard pointed out, both IMA and
IMA_ARCH_POLICYare not needed, asIMA_ARCH_POLICYis already dependent on IMA.Then removing them is fine, if they're not necessary ... you just can't
select a symbol with dependencies because the twoKconfigmechanisms
don't mix.
You can safely select something if the selector has the same or stricter set of dependencies than the selectee. And in this case that's true.
config IMA_SECURE_AND_OR_TRUSTED_BOOT
bool
depends on IMA
depends on IMA_ARCH_POLICY
powerpc:
depends on IMA_ARCH_POLICY
select IMA_SECURE_AND_OR_TRUSTED_BOOT
s390: select IMA_SECURE_AND_OR_TRUSTED_BOOT if IMA_ARCH_POLICY
x86: select IMA_SECURE_AND_OR_TRUSTED_BOOT if EFI && IMA_ARCH_POLICY
But that's not to say it's the best solution, because you have to ensure the arch code has the right set of dependencies.
I think this is actually a perfect case for using imply. We want the arch code to indicate it wants IMA_SECURE_..., but only if all the IMA related dependencies are met.
I think the patch below should work.
For example:
$ grep PPC_SECURE_BOOT .config CONFIG_PPC_SECURE_BOOT=y $ ./scripts/config -d CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT $ grep IMA_SECURE .config # CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT is not set $ make oldconfig scripts/kconfig/conf --oldconfig Kconfig # # configuration written to .config # $ grep IMA_SECURE .config CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT=y
$ ./scripts/config -d CONFIG_IMA_ARCH_POLICY $ grep -e IMA_ARCH_POLICY -e IMA_SECURE .config # CONFIG_IMA_ARCH_POLICY is not set CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT=y $ make olddefconfig scripts/kconfig/conf --olddefconfig Kconfig # # configuration written to .config # $ grep -e IMA_ARCH_POLICY -e IMA_SECURE .config # CONFIG_IMA_ARCH_POLICY is not set $
cheers
arch/powerpc/Kconfig +1 -0
@@ -979,6 +979,7 @@ config PPC_SECURE_BOOT bool depends on PPC_POWERNV depends on IMA_ARCH_POLICY + imply IMA_SECURE_AND_OR_TRUSTED_BOOT help Systems with firmware secure boot enabled need to define security policies to extend secure boot to the OS. This config allows a user
arch/s390/Kconfig +1 -0
@@ -195,6 +195,7 @@ config S390 select ARCH_HAS_FORCE_DMA_UNENCRYPTED select SWIOTLB select GENERIC_ALLOCATOR + imply IMA_SECURE_AND_OR_TRUSTED_BOOT config SCHED_OMIT_FRAME_POINTER
arch/x86/Kconfig +1 -0
@@ -230,6 +230,7 @@ config X86 select VIRT_TO_BUS select X86_FEATURE_NAMES if PROC_FS select PROC_PID_ARCH_STATUS if PROC_FS + imply IMA_SECURE_AND_OR_TRUSTED_BOOT if EFI config INSTRUCTION_DECODER def_bool y
include/linux/ima.h +1 -2
@@ -30,8 +30,7 @@ extern void ima_kexec_cmdline(const void *buf, int size);extern void ima_add_kexec_buffer (struct kimage *image);#endif -#if (defined(CONFIG_X86 ) && defined(CONFIG_EFI )) || defined(CONFIG_S390 ) \ - || defined(CONFIG_PPC_SECURE_BOOT ) +#ifdef CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT extern bool arch_ima_get_secureboot (void );extern const char *const *arch_get_ima_policy (void );#else
security/integrity/ima/Kconfig +7 -0
@@ -327,3 +327,10 @@ config IMA_QUEUE_EARLY_BOOT_KEYS depends on IMA_MEASURE_ASYMMETRIC_KEYS depends on SYSTEM_TRUSTED_KEYRING default y + +config IMA_SECURE_AND_OR_TRUSTED_BOOT + bool + depends on IMA_ARCH_POLICY + help + This option is selected by architectures to enable secure and/or + trusted boot based on IMA runtime policies.
kbuild test robot
build botI love your patch! Yet something to improve:
Hi Nayna,
I love your patch! Yet something to improve:
[auto build test ERROR on integrity/next-integrity]
[also build test ERROR on powerpc/next s390/features linus/master v5.6-rc4] [cannot apply to tip/x86/core next-20200304]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Nayna-Jain/ima-add-a-new-CONFIG-for-loading-arch-specific-policies/20200304-190747 base: https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git next-integrity config: x86_64-randconfig-s1-20200304 (attached as .config) compiler: gcc-7 (Debian 7.5.0-5) 7.5.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
>> arch/x86//kernel/ima_arch.c:54:6: error: redefinition of 'arch_ima_get_secureboot'
bool arch_ima_get_secureboot(void)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/x86//kernel/ima_arch.c:7:0:
include/linux/ima.h:37:20: note: previous definition of 'arch_ima_get_secureboot' was here
static inline bool arch_ima_get_secureboot(void)
^~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86//kernel/ima_arch.c:86:21: error: redefinition of 'arch_get_ima_policy' const char * const *arch_get_ima_policy(void)
^~~~~~~~~~~~~~~~~~~
In file included from arch/x86//kernel/ima_arch.c:7:0:
include/linux/ima.h:42:35: note: previous definition of 'arch_get_ima_policy' was here
static inline const char * const *arch_get_ima_policy(void)
^~~~~~~~~~~~~~~~~~~
vim +/arch_ima_get_secureboot +54 arch/x86//kernel/ima_arch.c
399574c64eaf94 Mimi Zohar 2018-11-18 53
0914ade209c452 Nayna Jain 2018-10-09 @54 bool arch_ima_get_secureboot(void)
0914ade209c452 Nayna Jain 2018-10-09 55 {
399574c64eaf94 Mimi Zohar 2018-11-18 56 static enum efi_secureboot_mode sb_mode;
399574c64eaf94 Mimi Zohar 2018-11-18 57 static bool initialized;
399574c64eaf94 Mimi Zohar 2018-11-18 58
399574c64eaf94 Mimi Zohar 2018-11-18 59 if (!initialized && efi_enabled(EFI_BOOT)) {
399574c64eaf94 Mimi Zohar 2018-11-18 60 sb_mode = boot_params.secure_boot;
399574c64eaf94 Mimi Zohar 2018-11-18 61
399574c64eaf94 Mimi Zohar 2018-11-18 62 if (sb_mode == efi_secureboot_mode_unset)
399574c64eaf94 Mimi Zohar 2018-11-18 63 sb_mode = get_sb_mode();
399574c64eaf94 Mimi Zohar 2018-11-18 64 initialized = true;
399574c64eaf94 Mimi Zohar 2018-11-18 65 }
399574c64eaf94 Mimi Zohar 2018-11-18 66
399574c64eaf94 Mimi Zohar 2018-11-18 67 if (sb_mode == efi_secureboot_mode_enabled)
0914ade209c452 Nayna Jain 2018-10-09 68 return true;
0914ade209c452 Nayna Jain 2018-10-09 69 else
0914ade209c452 Nayna Jain 2018-10-09 70 return false;
0914ade209c452 Nayna Jain 2018-10-09 71 }
d958083a8f6408 Eric Richter 2018-10-09 72
d958083a8f6408 Eric Richter 2018-10-09 73 /* secureboot arch rules */
d958083a8f6408 Eric Richter 2018-10-09 74 static const char * const sb_arch_rules[] = {
99d5cadfde2b1a Jiri Bohac 2019-08-19 75 #if !IS_ENABLED(CONFIG_KEXEC_SIG)
d958083a8f6408 Eric Richter 2018-10-09 76 "appraise func=KEXEC_KERNEL_CHECK appraise_type=imasig",
99d5cadfde2b1a Jiri Bohac 2019-08-19 77 #endif /* CONFIG_KEXEC_SIG */
d958083a8f6408 Eric Richter 2018-10-09 78 "measure func=KEXEC_KERNEL_CHECK",
8db5da0b8618df Mimi Zohar 2019-01-27 79 #if !IS_ENABLED(CONFIG_MODULE_SIG)
8db5da0b8618df Mimi Zohar 2019-01-27 80 "appraise func=MODULE_CHECK appraise_type=imasig",
8db5da0b8618df Mimi Zohar 2019-01-27 81 #endif
8db5da0b8618df Mimi Zohar 2019-01-27 82 "measure func=MODULE_CHECK",
d958083a8f6408 Eric Richter 2018-10-09 83 NULL
d958083a8f6408 Eric Richter 2018-10-09 84 };
d958083a8f6408 Eric Richter 2018-10-09 85 d958083a8f6408 Eric Richter 2018-10-09 @86 const char * const *arch_get_ima_policy(void)
:::::: The code at line 54 was first introduced by commit
:::::: 0914ade209c452cff6a29b1c0ae6fff3167fa1d0 x86/ima: define arch_ima_get_secureboot
:::::: TO: Nayna Jain <[email protected]>
:::::: CC: Mimi Zohar <[email protected]>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kbuild test robot
build botI love your patch! Yet something to improve:
Hi Nayna,
I love your patch! Yet something to improve:
[auto build test ERROR on integrity/next-integrity]
[also build test ERROR on powerpc/next s390/features linus/master v5.6-rc4] [cannot apply to tip/x86/core next-20200304]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Nayna-Jain/ima-add-a-new-CONFIG-for-loading-arch-specific-policies/20200304-190747 base: https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git next-integrity config: s390-debug_defconfig (attached as .config) compiler: s390-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=s390
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
>> arch/s390/kernel/ima_arch.c:6:6: error: redefinition of 'arch_ima_get_secureboot'
bool arch_ima_get_secureboot(void)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/s390/kernel/ima_arch.c:3:0:
include/linux/ima.h:37:20: note: previous definition of 'arch_ima_get_secureboot' was here
static inline bool arch_ima_get_secureboot(void)
^~~~~~~~~~~~~~~~~~~~~~~
>> arch/s390/kernel/ima_arch.c:11:21: error: redefinition of 'arch_get_ima_policy' const char * const *arch_get_ima_policy(void)
^~~~~~~~~~~~~~~~~~~
In file included from arch/s390/kernel/ima_arch.c:3:0:
include/linux/ima.h:42:35: note: previous definition of 'arch_get_ima_policy' was here
static inline const char * const *arch_get_ima_policy(void)
^~~~~~~~~~~~~~~~~~~
vim +/arch_ima_get_secureboot +6 arch/s390/kernel/ima_arch.c
268a7840497359 Philipp Rudo 2019-03-26 5
268a7840497359 Philipp Rudo 2019-03-26 @6 bool arch_ima_get_secureboot(void)
268a7840497359 Philipp Rudo 2019-03-26 7 {
268a7840497359 Philipp Rudo 2019-03-26 8 return ipl_secure_flag;
268a7840497359 Philipp Rudo 2019-03-26 9 }268a7840497359 Philipp Rudo 2019-03-26 10268a7840497359 Philipp Rudo 2019-03-26 @11 const char * const *arch_get_ima_policy(void)
:::::: The code at line 6 was first introduced by commit
:::::: 268a78404973594d1a7ec3a2b6a2474e0543a435 s390/kexec_file: Disable kexec_load when IPLed secure
:::::: TO: Philipp Rudo <[email protected]> :::::: CC: Martin Schwidefsky <[email protected]>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org