* [PATCH v9 1/4] kexec: clean up arch_kexec_kernel_verify_sig
2022-07-04 1:51 [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature Coiby Xu
@ 2022-07-04 1:51 ` Coiby Xu
2022-07-04 1:51 ` [PATCH v9 2/4] kexec, KEYS: make the code in bzImage64_verify_sig generic Coiby Xu
` (3 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Coiby Xu @ 2022-07-04 1:51 UTC (permalink / raw)
To: kexec, linux-integrity
Cc: Mimi Zohar, linux-arm-kernel, Michal Suchanek, Baoquan He,
Dave Young, Will Deacon, Eric W . Biederman, Chun-Yi Lee, stable,
open list
Currently there is no arch-specific implementation of
arch_kexec_kernel_verify_sig. Even if we want to add an implementation
for an architecture in the future, we can simply use "(struct
kexec_file_ops*)->verify_sig". So clean it up.
Note this patch is dependent by later patches so it should backported to
the stable tree as well.
Cc: stable@vger.kernel.org
Suggested-by: Eric W. Biederman <ebiederm@xmission.com>
Reviewed-by: Michal Suchanek <msuchanek@suse.de>
Acked-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
---
include/linux/kexec.h | 4 ----
kernel/kexec_file.c | 34 +++++++++++++---------------------
2 files changed, 13 insertions(+), 25 deletions(-)
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index ce6536f1d269..e3125fae1599 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -194,10 +194,6 @@ int arch_kexec_kernel_image_probe(struct kimage *image, void *buf,
unsigned long buf_len);
void *arch_kexec_kernel_image_load(struct kimage *image);
int arch_kimage_file_post_load_cleanup(struct kimage *image);
-#ifdef CONFIG_KEXEC_SIG
-int arch_kexec_kernel_verify_sig(struct kimage *image, void *buf,
- unsigned long buf_len);
-#endif
int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf);
extern int kexec_add_buffer(struct kexec_buf *kbuf);
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 145321a5e798..c7cbadc754a1 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -89,25 +89,6 @@ int __weak arch_kimage_file_post_load_cleanup(struct kimage *image)
return kexec_image_post_load_cleanup_default(image);
}
-#ifdef CONFIG_KEXEC_SIG
-static int kexec_image_verify_sig_default(struct kimage *image, void *buf,
- unsigned long buf_len)
-{
- if (!image->fops || !image->fops->verify_sig) {
- pr_debug("kernel loader does not support signature verification.\n");
- return -EKEYREJECTED;
- }
-
- return image->fops->verify_sig(buf, buf_len);
-}
-
-int __weak arch_kexec_kernel_verify_sig(struct kimage *image, void *buf,
- unsigned long buf_len)
-{
- return kexec_image_verify_sig_default(image, buf, buf_len);
-}
-#endif
-
/*
* Free up memory used by kernel, initrd, and command line. This is temporary
* memory allocation which is not needed any more after these buffers have
@@ -150,13 +131,24 @@ void kimage_file_post_load_cleanup(struct kimage *image)
}
#ifdef CONFIG_KEXEC_SIG
+static int kexec_image_verify_sig(struct kimage *image, void *buf,
+ unsigned long buf_len)
+{
+ if (!image->fops || !image->fops->verify_sig) {
+ pr_debug("kernel loader does not support signature verification.\n");
+ return -EKEYREJECTED;
+ }
+
+ return image->fops->verify_sig(buf, buf_len);
+}
+
static int
kimage_validate_signature(struct kimage *image)
{
int ret;
- ret = arch_kexec_kernel_verify_sig(image, image->kernel_buf,
- image->kernel_buf_len);
+ ret = kexec_image_verify_sig(image, image->kernel_buf,
+ image->kernel_buf_len);
if (ret) {
if (IS_ENABLED(CONFIG_KEXEC_SIG_FORCE)) {
--
2.35.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v9 2/4] kexec, KEYS: make the code in bzImage64_verify_sig generic
2022-07-04 1:51 [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature Coiby Xu
2022-07-04 1:51 ` [PATCH v9 1/4] kexec: clean up arch_kexec_kernel_verify_sig Coiby Xu
@ 2022-07-04 1:51 ` Coiby Xu
2022-07-04 1:52 ` [PATCH v9 3/4] arm64: kexec_file: use more system keyrings to verify kernel image signature Coiby Xu
` (2 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Coiby Xu @ 2022-07-04 1:51 UTC (permalink / raw)
To: kexec, linux-integrity
Cc: Mimi Zohar, linux-arm-kernel, Michal Suchanek, Baoquan He,
Dave Young, Will Deacon, Eric W . Biederman, Chun-Yi Lee,
keyrings, linux-security-module, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), H. Peter Anvin,
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)
commit 278311e417be ("kexec, KEYS: Make use of platform keyring for
signature verify") adds platform keyring support on x86 kexec but not
arm64.
The code in bzImage64_verify_sig uses the keys on the
.builtin_trusted_keys, .machine, if configured and enabled,
.secondary_trusted_keys, also if configured, and .platform keyrings
to verify the signed kernel image as PE file.
Cc: kexec@lists.infradead.org
Cc: keyrings@vger.kernel.org
Cc: linux-security-module@vger.kernel.org
Reviewed-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Coiby Xu <coxu@redhat.com>
---
arch/x86/kernel/kexec-bzimage64.c | 20 +-------------------
include/linux/kexec.h | 6 ++++++
kernel/kexec_file.c | 17 +++++++++++++++++
3 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c
index 170d0fd68b1f..f299b48f9c9f 100644
--- a/arch/x86/kernel/kexec-bzimage64.c
+++ b/arch/x86/kernel/kexec-bzimage64.c
@@ -17,7 +17,6 @@
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/efi.h>
-#include <linux/verification.h>
#include <asm/bootparam.h>
#include <asm/setup.h>
@@ -528,28 +527,11 @@ static int bzImage64_cleanup(void *loader_data)
return 0;
}
-#ifdef CONFIG_KEXEC_BZIMAGE_VERIFY_SIG
-static int bzImage64_verify_sig(const char *kernel, unsigned long kernel_len)
-{
- int ret;
-
- ret = verify_pefile_signature(kernel, kernel_len,
- VERIFY_USE_SECONDARY_KEYRING,
- VERIFYING_KEXEC_PE_SIGNATURE);
- if (ret == -ENOKEY && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING)) {
- ret = verify_pefile_signature(kernel, kernel_len,
- VERIFY_USE_PLATFORM_KEYRING,
- VERIFYING_KEXEC_PE_SIGNATURE);
- }
- return ret;
-}
-#endif
-
const struct kexec_file_ops kexec_bzImage64_ops = {
.probe = bzImage64_probe,
.load = bzImage64_load,
.cleanup = bzImage64_cleanup,
#ifdef CONFIG_KEXEC_BZIMAGE_VERIFY_SIG
- .verify_sig = bzImage64_verify_sig,
+ .verify_sig = kexec_kernel_verify_pe_sig,
#endif
};
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index e3125fae1599..620018bbc419 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -19,6 +19,7 @@
#include <asm/io.h>
#include <uapi/linux/kexec.h>
+#include <linux/verification.h>
/* Location of a reserved region to hold the crash kernel.
*/
@@ -194,6 +195,11 @@ int arch_kexec_kernel_image_probe(struct kimage *image, void *buf,
unsigned long buf_len);
void *arch_kexec_kernel_image_load(struct kimage *image);
int arch_kimage_file_post_load_cleanup(struct kimage *image);
+#ifdef CONFIG_KEXEC_SIG
+#ifdef CONFIG_SIGNED_PE_FILE_VERIFICATION
+int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);
+#endif
+#endif
int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf);
extern int kexec_add_buffer(struct kexec_buf *kbuf);
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index c7cbadc754a1..db6e89128b98 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -131,6 +131,23 @@ void kimage_file_post_load_cleanup(struct kimage *image)
}
#ifdef CONFIG_KEXEC_SIG
+#ifdef CONFIG_SIGNED_PE_FILE_VERIFICATION
+int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len)
+{
+ int ret;
+
+ ret = verify_pefile_signature(kernel, kernel_len,
+ VERIFY_USE_SECONDARY_KEYRING,
+ VERIFYING_KEXEC_PE_SIGNATURE);
+ if (ret == -ENOKEY && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING)) {
+ ret = verify_pefile_signature(kernel, kernel_len,
+ VERIFY_USE_PLATFORM_KEYRING,
+ VERIFYING_KEXEC_PE_SIGNATURE);
+ }
+ return ret;
+}
+#endif
+
static int kexec_image_verify_sig(struct kimage *image, void *buf,
unsigned long buf_len)
{
--
2.35.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v9 3/4] arm64: kexec_file: use more system keyrings to verify kernel image signature
2022-07-04 1:51 [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature Coiby Xu
2022-07-04 1:51 ` [PATCH v9 1/4] kexec: clean up arch_kexec_kernel_verify_sig Coiby Xu
2022-07-04 1:51 ` [PATCH v9 2/4] kexec, KEYS: make the code in bzImage64_verify_sig generic Coiby Xu
@ 2022-07-04 1:52 ` Coiby Xu
2022-07-04 1:52 ` [PATCH v9 4/4] kexec, KEYS, s390: Make use of built-in and secondary keyring for signature verification Coiby Xu
2022-07-06 11:35 ` [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature Mimi Zohar
4 siblings, 0 replies; 11+ messages in thread
From: Coiby Xu @ 2022-07-04 1:52 UTC (permalink / raw)
To: kexec, linux-integrity
Cc: Mimi Zohar, linux-arm-kernel, Michal Suchanek, Baoquan He,
Dave Young, Will Deacon, Eric W . Biederman, Chun-Yi Lee, stable,
keyrings, linux-security-module, Catalin Marinas, AKASHI Takahiro,
James Morse, open list
Currently, when loading a kernel image via the kexec_file_load() system
call, arm64 can only use the .builtin_trusted_keys keyring to verify
a signature whereas x86 can use three more keyrings i.e.
.secondary_trusted_keys, .machine and .platform keyrings. For example,
one resulting problem is kexec'ing a kernel image would be rejected
with the error "Lockdown: kexec: kexec of unsigned images is restricted;
see man kernel_lockdown.7".
This patch set enables arm64 to make use of the same keyrings as x86 to
verify the signature kexec'ed kernel image.
Fixes: 732b7b93d849 ("arm64: kexec_file: add kernel signature verification support")
Cc: stable@vger.kernel.org # 34d5960af253: kexec: clean up arch_kexec_kernel_verify_sig
Cc: stable@vger.kernel.org # 83b7bb2d49ae: kexec, KEYS: make the code in bzImage64_verify_sig generic
Acked-by: Baoquan He <bhe@redhat.com>
Cc: kexec@lists.infradead.org
Cc: keyrings@vger.kernel.org
Cc: linux-security-module@vger.kernel.org
Co-developed-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Coiby Xu <coxu@redhat.com>
---
arch/arm64/kernel/kexec_image.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/arch/arm64/kernel/kexec_image.c b/arch/arm64/kernel/kexec_image.c
index 9ec34690e255..5ed6a585f21f 100644
--- a/arch/arm64/kernel/kexec_image.c
+++ b/arch/arm64/kernel/kexec_image.c
@@ -14,7 +14,6 @@
#include <linux/kexec.h>
#include <linux/pe.h>
#include <linux/string.h>
-#include <linux/verification.h>
#include <asm/byteorder.h>
#include <asm/cpufeature.h>
#include <asm/image.h>
@@ -130,18 +129,10 @@ static void *image_load(struct kimage *image,
return NULL;
}
-#ifdef CONFIG_KEXEC_IMAGE_VERIFY_SIG
-static int image_verify_sig(const char *kernel, unsigned long kernel_len)
-{
- return verify_pefile_signature(kernel, kernel_len, NULL,
- VERIFYING_KEXEC_PE_SIGNATURE);
-}
-#endif
-
const struct kexec_file_ops kexec_image_ops = {
.probe = image_probe,
.load = image_load,
#ifdef CONFIG_KEXEC_IMAGE_VERIFY_SIG
- .verify_sig = image_verify_sig,
+ .verify_sig = kexec_kernel_verify_pe_sig,
#endif
};
--
2.35.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v9 4/4] kexec, KEYS, s390: Make use of built-in and secondary keyring for signature verification
2022-07-04 1:51 [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature Coiby Xu
` (2 preceding siblings ...)
2022-07-04 1:52 ` [PATCH v9 3/4] arm64: kexec_file: use more system keyrings to verify kernel image signature Coiby Xu
@ 2022-07-04 1:52 ` Coiby Xu
2022-07-06 11:35 ` [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature Mimi Zohar
4 siblings, 0 replies; 11+ messages in thread
From: Coiby Xu @ 2022-07-04 1:52 UTC (permalink / raw)
To: kexec, linux-integrity
Cc: Mimi Zohar, linux-arm-kernel, Michal Suchanek, Baoquan He,
Dave Young, Will Deacon, Eric W . Biederman, Chun-Yi Lee, stable,
Philipp Rudo, keyrings, linux-security-module, Heiko Carstens,
Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
Sven Schnelle, Martin Schwidefsky, open list:S390, open list
From: Michal Suchanek <msuchanek@suse.de>
commit e23a8020ce4e ("s390/kexec_file: Signature verification prototype")
adds support for KEXEC_SIG verification with keys from platform keyring
but the built-in keys and secondary keyring are not used.
Add support for the built-in keys and secondary keyring as x86 does.
Fixes: e23a8020ce4e ("s390/kexec_file: Signature verification prototype")
Cc: stable@vger.kernel.org
Cc: Philipp Rudo <prudo@linux.ibm.com>
Cc: kexec@lists.infradead.org
Cc: keyrings@vger.kernel.org
Cc: linux-security-module@vger.kernel.org
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: "Lee, Chun-Yi" <jlee@suse.com>
Acked-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
---
arch/s390/kernel/machine_kexec_file.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machine_kexec_file.c
index 8f43575a4dd3..fc6d5f58debe 100644
--- a/arch/s390/kernel/machine_kexec_file.c
+++ b/arch/s390/kernel/machine_kexec_file.c
@@ -31,6 +31,7 @@ int s390_verify_sig(const char *kernel, unsigned long kernel_len)
const unsigned long marker_len = sizeof(MODULE_SIG_STRING) - 1;
struct module_signature *ms;
unsigned long sig_len;
+ int ret;
/* Skip signature verification when not secure IPLed. */
if (!ipl_secure_flag)
@@ -65,11 +66,18 @@ int s390_verify_sig(const char *kernel, unsigned long kernel_len)
return -EBADMSG;
}
- return verify_pkcs7_signature(kernel, kernel_len,
- kernel + kernel_len, sig_len,
- VERIFY_USE_PLATFORM_KEYRING,
- VERIFYING_MODULE_SIGNATURE,
- NULL, NULL);
+ ret = verify_pkcs7_signature(kernel, kernel_len,
+ kernel + kernel_len, sig_len,
+ VERIFY_USE_SECONDARY_KEYRING,
+ VERIFYING_MODULE_SIGNATURE,
+ NULL, NULL);
+ if (ret == -ENOKEY && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING))
+ ret = verify_pkcs7_signature(kernel, kernel_len,
+ kernel + kernel_len, sig_len,
+ VERIFY_USE_PLATFORM_KEYRING,
+ VERIFYING_MODULE_SIGNATURE,
+ NULL, NULL);
+ return ret;
}
#endif /* CONFIG_KEXEC_SIG */
--
2.35.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature
2022-07-04 1:51 [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature Coiby Xu
` (3 preceding siblings ...)
2022-07-04 1:52 ` [PATCH v9 4/4] kexec, KEYS, s390: Make use of built-in and secondary keyring for signature verification Coiby Xu
@ 2022-07-06 11:35 ` Mimi Zohar
2022-07-06 11:48 ` Will Deacon
4 siblings, 1 reply; 11+ messages in thread
From: Mimi Zohar @ 2022-07-06 11:35 UTC (permalink / raw)
To: Coiby Xu, kexec, linux-integrity
Cc: linux-arm-kernel, Michal Suchanek, Baoquan He, Dave Young,
Will Deacon, Eric W . Biederman, Chun-Yi Lee
On Mon, 2022-07-04 at 09:51 +0800, Coiby Xu wrote:
> Currently when loading a kernel image via the kexec_file_load() system
> call, x86 can make use of three keyrings i.e. the .builtin_trusted_keys,
> .secondary_trusted_keys and .platform keyrings to verify a signature.
> However, arm64 and s390 can only use the .builtin_trusted_keys and
> .platform keyring respectively. For example, one resulting problem is
> kexec'ing a kernel image would be rejected with the error "Lockdown:
> kexec: kexec of unsigned images is restricted; see man
> kernel_lockdown.7".
>
> This patch set enables arm64 and s390 to make use of the same keyrings
> as x86 to verify the signature kexec'ed kernel image.
>
> The recently introduced .machine keyring impacts the roots of trust by
> linking the .machine keyring to the .secondary keyring. The roots of
> trust for different keyrings are described as follows,
>
> .builtin_trusted_keys:
>
> Keys may be built into the kernel during build or inserted into memory
> reserved for keys post build. The root of trust is based on verification
> of the kernel image signature. For example, on a physical system in a
> secure boot environment, this trust is rooted in hardware.
>
> .machine:
>
> If the end-users choose to trust the keys provided by first-stage UEFI
> bootloader shim i.e. Machine Owner Keys (MOK keys), the keys will be
> added to this keyring which is linked to the .secondary_trusted_keys
> keyring as the same as the .builtin_trusted_keys keyring. Shim has
> built-in keys from a Linux distribution or the end-users-enrolled keys.
> So the root of trust of this keyring is either a Linux distribution
> vendor or the end-users.
>
> .secondary_trusted_keys:
>
> Certificates signed by keys on the .builtin_trusted_keys, .machine, or
> existing keys on the .secondary_trusted_keys keryings may be loaded
> onto the .secondary_trusted_keys keyring. This establishes a signature
> chain of trust based on keys loaded on either the .builtin_trusted_keys
> or .machine keyrings, if configured and enabled.
>
> .platform:
>
> The .platform keyring consist of UEFI db and MOK keys which are used by
> shim to verify the first boot kernel's image signature. If end-users
> choose to trust MOK keys and the kernel has the .machine keyring
> enabled, the .platform keyring only consists of UEFI db keys since the
> MOK keys are added to the .machine keyring instead. Because the
> end-users could also enroll their own MOK keys, the root of trust could
> be hardware and the end-users.
>
> The 3rd arm64 patch depends on the first two patches. The 4th s390 patch
> can be applied independently.
>
> I've tested the patch set on 5.19.0-rc2 and it works as expected.
>
> For arm64, the tests were done as follows,
> 1. build 5.19.0-rc2
> 2. generate keys and add them to .secondary_trusted_keys, MOK, UEFI
> db;
> 3. sign different kernel images with different keys including keys
> from .builtin_trusted_key, .secondary_trusted_keys keyring, a UEFI db
> key and MOK key
> 4. Without lockdown, all kernel images can be kexec'ed; with lockdown
> enabled, only the kernel image signed by the key from the
> .builtin_trusted_key keyring can be kexec'ed
Just confirming, for arm64, this patch set allows verifying the
kexec'ed kernel image signature using keys on either the .platform or
.secondary_trusted_keys keyrings.
thanks,
Mimi
>
> For 390, I commented out the code that skips signature verification when
> secure boot is not enabled since the testing machine doesn't supports
> secure boot and can confirm before applying the patch, kernel images
> signed by keys from .builtin_trusted_key, .secondary_trusted_keys
> couldn't be kexec'ed when lockdown is enabled; after applying the patch,
> those kernel images could be kexec'ed.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature
2022-07-06 11:35 ` [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature Mimi Zohar
@ 2022-07-06 11:48 ` Will Deacon
2022-07-06 14:33 ` Mimi Zohar
0 siblings, 1 reply; 11+ messages in thread
From: Will Deacon @ 2022-07-06 11:48 UTC (permalink / raw)
To: Mimi Zohar
Cc: Coiby Xu, kexec, linux-integrity, linux-arm-kernel,
Michal Suchanek, Baoquan He, Dave Young, Eric W . Biederman,
Chun-Yi Lee
On Wed, Jul 06, 2022 at 07:35:36AM -0400, Mimi Zohar wrote:
> On Mon, 2022-07-04 at 09:51 +0800, Coiby Xu wrote:
> > Currently when loading a kernel image via the kexec_file_load() system
> > call, x86 can make use of three keyrings i.e. the .builtin_trusted_keys,
> > .secondary_trusted_keys and .platform keyrings to verify a signature.
> > However, arm64 and s390 can only use the .builtin_trusted_keys and
> > .platform keyring respectively. For example, one resulting problem is
> > kexec'ing a kernel image would be rejected with the error "Lockdown:
> > kexec: kexec of unsigned images is restricted; see man
> > kernel_lockdown.7".
> >
> > This patch set enables arm64 and s390 to make use of the same keyrings
> > as x86 to verify the signature kexec'ed kernel image.
[...]
> > For arm64, the tests were done as follows,
> > 1. build 5.19.0-rc2
> > 2. generate keys and add them to .secondary_trusted_keys, MOK, UEFI
> > db;
> > 3. sign different kernel images with different keys including keys
> > from .builtin_trusted_key, .secondary_trusted_keys keyring, a UEFI db
> > key and MOK key
> > 4. Without lockdown, all kernel images can be kexec'ed; with lockdown
> > enabled, only the kernel image signed by the key from the
> > .builtin_trusted_key keyring can be kexec'ed
>
> Just confirming, for arm64, this patch set allows verifying the
> kexec'ed kernel image signature using keys on either the .platform or
> .secondary_trusted_keys keyrings.
It looks like this series is ready to go, but it's not clear who should
pick it up. Eric -- would you be the best person? Otherwise, I'm happy to
take it via the arm64 tree (on its own branch) if that would be helpful.
Thanks,
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature
2022-07-06 11:48 ` Will Deacon
@ 2022-07-06 14:33 ` Mimi Zohar
2022-07-07 14:10 ` Coiby Xu
0 siblings, 1 reply; 11+ messages in thread
From: Mimi Zohar @ 2022-07-06 14:33 UTC (permalink / raw)
To: Will Deacon
Cc: Coiby Xu, kexec, linux-integrity, linux-arm-kernel,
Michal Suchanek, Baoquan He, Dave Young, Eric W . Biederman,
Chun-Yi Lee
On Wed, 2022-07-06 at 12:48 +0100, Will Deacon wrote:
> On Wed, Jul 06, 2022 at 07:35:36AM -0400, Mimi Zohar wrote:
> > On Mon, 2022-07-04 at 09:51 +0800, Coiby Xu wrote:
> > > Currently when loading a kernel image via the kexec_file_load() system
> > > call, x86 can make use of three keyrings i.e. the .builtin_trusted_keys,
> > > .secondary_trusted_keys and .platform keyrings to verify a signature.
> > > However, arm64 and s390 can only use the .builtin_trusted_keys and
> > > .platform keyring respectively. For example, one resulting problem is
> > > kexec'ing a kernel image would be rejected with the error "Lockdown:
> > > kexec: kexec of unsigned images is restricted; see man
> > > kernel_lockdown.7".
> > >
> > > This patch set enables arm64 and s390 to make use of the same keyrings
> > > as x86 to verify the signature kexec'ed kernel image.
>
> [...]
>
> > > For arm64, the tests were done as follows,
> > > 1. build 5.19.0-rc2
> > > 2. generate keys and add them to .secondary_trusted_keys, MOK, UEFI
> > > db;
> > > 3. sign different kernel images with different keys including keys
> > > from .builtin_trusted_key, .secondary_trusted_keys keyring, a UEFI db
> > > key and MOK key
> > > 4. Without lockdown, all kernel images can be kexec'ed; with lockdown
> > > enabled, only the kernel image signed by the key from the
> > > .builtin_trusted_key keyring can be kexec'ed
> >
> > Just confirming, for arm64, this patch set allows verifying the
> > kexec'ed kernel image signature using keys on either the .platform or
> > .secondary_trusted_keys keyrings.
>
> It looks like this series is ready to go, but it's not clear who should
> pick it up. Eric -- would you be the best person? Otherwise, I'm happy to
> take it via the arm64 tree (on its own branch) if that would be helpful.
Unless Eric is interested, I was asked to pick this patch set up.
thanks,
Mimi
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature
2022-07-06 14:33 ` Mimi Zohar
@ 2022-07-07 14:10 ` Coiby Xu
2022-07-07 22:28 ` Mimi Zohar
0 siblings, 1 reply; 11+ messages in thread
From: Coiby Xu @ 2022-07-07 14:10 UTC (permalink / raw)
To: Mimi Zohar
Cc: Will Deacon, Naveen N. Rao, kexec, linux-integrity,
linux-arm-kernel, Michal Suchanek, Baoquan He, Dave Young,
Eric W . Biederman, Chun-Yi Lee
Hi Mimi,
On Wed, Jul 06, 2022 at 10:33:50AM -0400, Mimi Zohar wrote:
>On Wed, 2022-07-06 at 12:48 +0100, Will Deacon wrote:
[..]
>> It looks like this series is ready to go, but it's not clear who should
>> pick it up. Eric -- would you be the best person? Otherwise, I'm happy to
>> take it via the arm64 tree (on its own branch) if that would be helpful.
>
>Unless Eric is interested, I was asked to pick this patch set up.
Thanks! FYI, Andrew has queued up Naveen's patch set "[PATCH 0/2] kexec:
Drop __weak attributes from functions" though:
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/log/?h=mm-nonmm-unstable
With Naveen's patch set, "[PATCH v9 1/4] kexec: clean up
arch_kexec_kernel_verify_sig"" can be dropped. If you need me to send a
new version, please let me know.
>
>thanks,
>
>Mimi
>
--
Best regards,
Coiby
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature
2022-07-07 14:10 ` Coiby Xu
@ 2022-07-07 22:28 ` Mimi Zohar
2022-07-14 13:48 ` Coiby Xu
0 siblings, 1 reply; 11+ messages in thread
From: Mimi Zohar @ 2022-07-07 22:28 UTC (permalink / raw)
To: Coiby Xu, akpm
Cc: Will Deacon, Naveen N. Rao, kexec, linux-integrity,
linux-arm-kernel, Michal Suchanek, Baoquan He, Dave Young,
Eric W . Biederman, Chun-Yi Lee
On Thu, 2022-07-07 at 22:10 +0800, Coiby Xu wrote:
> Hi Mimi,
>
> On Wed, Jul 06, 2022 at 10:33:50AM -0400, Mimi Zohar wrote:
> >On Wed, 2022-07-06 at 12:48 +0100, Will Deacon wrote:
> [..]
> >> It looks like this series is ready to go, but it's not clear who should
> >> pick it up. Eric -- would you be the best person? Otherwise, I'm happy to
> >> take it via the arm64 tree (on its own branch) if that would be helpful.
> >
> >Unless Eric is interested, I was asked to pick this patch set up.
>
> Thanks! FYI, Andrew has queued up Naveen's patch set "[PATCH 0/2] kexec:
> Drop __weak attributes from functions" though:
> https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/log/?h=mm-nonmm-unstable
>
> With Naveen's patch set, "[PATCH v9 1/4] kexec: clean up
> arch_kexec_kernel_verify_sig"" can be dropped. If you need me to send a
> new version, please let me know.
I'm not quite sure how to handle the prerequisite patches being in
Andrew's tree, without his creating a branch with just the two commits.
thanks,
Mimi
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v9 0/4] unify the keyrings of arm64 and s390 with x86 to verify kexec'ed kernel signature
2022-07-07 22:28 ` Mimi Zohar
@ 2022-07-14 13:48 ` Coiby Xu
0 siblings, 0 replies; 11+ messages in thread
From: Coiby Xu @ 2022-07-14 13:48 UTC (permalink / raw)
To: Mimi Zohar
Cc: akpm, Will Deacon, Naveen N. Rao, kexec, linux-integrity,
linux-arm-kernel, Michal Suchanek, Baoquan He, Dave Young,
Eric W . Biederman, Chun-Yi Lee
On Thu, Jul 07, 2022 at 06:28:50PM -0400, Mimi Zohar wrote:
>On Thu, 2022-07-07 at 22:10 +0800, Coiby Xu wrote:
>> Hi Mimi,
>>
>> On Wed, Jul 06, 2022 at 10:33:50AM -0400, Mimi Zohar wrote:
>> >On Wed, 2022-07-06 at 12:48 +0100, Will Deacon wrote:
>> [..]
>> >> It looks like this series is ready to go, but it's not clear who should
>> >> pick it up. Eric -- would you be the best person? Otherwise, I'm happy to
>> >> take it via the arm64 tree (on its own branch) if that would be helpful.
>> >
>> >Unless Eric is interested, I was asked to pick this patch set up.
>>
>> Thanks! FYI, Andrew has queued up Naveen's patch set "[PATCH 0/2] kexec:
>> Drop __weak attributes from functions" though:
>> https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/log/?h=mm-nonmm-unstable
>>
>> With Naveen's patch set, "[PATCH v9 1/4] kexec: clean up
>> arch_kexec_kernel_verify_sig"" can be dropped. If you need me to send a
>> new version, please let me know.
>
>I'm not quite sure how to handle the prerequisite patches being in
>Andrew's tree, without his creating a branch with just the two commits.
FYI, I just sent v10 based on Naveen's patch set and it targets
next-integrity since Mimi is going to pick it up.
>
>thanks,
>
>Mimi
>
--
Best regards,
Coiby
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 11+ messages in thread