Skip to contentSkip to conversation

FAILED: patch "[PATCH] arm64: kexec_file: use more system keyrings to verify kernel" failed to apply to 5.19-stable tree

PATCH [email protected] 4 participants 14 messages Aug 15, 2022 – Aug 19, 2022

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 0d519cadf75184a24313568e7f489a7fc9b1be3b Mon Sep 17 00:00:00 2001
From: Coiby Xu <[email protected]>
Date: Thu, 14 Jul 2022 21:40:26 +0800
Subject: [PATCH] arm64: kexec_file: use more system keyrings to verify kernel
image signature

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 [email protected] # 105e10e2cf1c: kexec_file: drop weak attribute from functions
Cc [email protected] # 34d5960af253: kexec: clean up arch_kexec_kernel_verify_sig
Cc [email protected] # 83b7bb2d49ae: kexec, KEYS: make the code in bzImage64_verify_sig generic
arch/arm64/kernel/kexec_image.c +1 -10
index 9ec34690e255..5ed6a585f21f 100644
@@ -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
 };
#1 lore raw

Hi Greg,

Quoted 4 lines · On Mon, 2022-08-15 at 17:33 +0200, [email protected] wrote:

The patch below does not apply to the 5.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

The commits contained in the 88b61b130334 ("Merge remote-tracking branch 'linux-integrity/kexec-keyrings' into next-integrity") should be applied in the proper order to avoid merge conflicts.

The third patch has a dependency on the first two commits, which were
initially in Andrew's tree. The third commit says, "Note later
patches are dependent on this patch so it should be backported to the stable tree as well."

thanks,

Mimi

author maintainer
#2 lore raw
Quoted 8 lines · Mimi Zohar

Hi Greg,

Quoted 4 lines · On Mon, 2022-08-15 at 17:33 +0200, [email protected] wrote:

The patch below does not apply to the 5.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Quoted 8 lines

The commits contained in the 88b61b130334 ("Merge remote-tracking branch 'linux-integrity/kexec-keyrings' into next-integrity") should be applied in the proper order to avoid merge conflicts.

The third patch has a dependency on the first two commits, which were
initially in Andrew's tree. The third commit says, "Note later
patches are dependent on this patch so it should be backported to the stable tree as well."

I need git commit ids of those commits please. Otherwise this is impossible to determine given the huge number of commits in the tree.

thanks,

greg k-h

#3 lore raw
In reply to [email protected]

Hi Greg,

Good to see you here:)

Quoted 26 lines · On Mon, Aug 15, 2022 at 05:33:03PM +0200, [email protected] wrote:

The patch below does not apply to the 5.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 0d519cadf75184a24313568e7f489a7fc9b1be3b Mon Sep 17 00:00:00 2001
From: Coiby Xu <[email protected]>
Date: Thu, 14 Jul 2022 21:40:26 +0800
Subject: [PATCH] arm64: kexec_file: use more system keyrings to verify kernel image signature

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".

Quoted 7 lines

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 [email protected] # 105e10e2cf1c: kexec_file: drop weak attribute from functions
Cc [email protected] # 34d5960af253: kexec: clean up arch_kexec_kernel_verify_sig
Cc [email protected] # 83b7bb2d49ae: kexec, KEYS: make the code in bzImage64_verify_sig generic

I've added the above three patch prerequisites following [1]. I assume there is a program automatically picking up this patch. But somehow it fails to pick up the prerequisites first. Is it because the commit ids change when the patches are finally applied to Linus's tree? If it's true, how do we make sure the we have the correct commit ids? Note [1] strongly recommends "Cc: [email protected]" to submit patches to stable tree but it seems there is no way to know beforehand the correct commit ids of the prerequisites that are yet to arrive in Linus's tree.

[1] https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html

Quoted 43 lines
arch/arm64/kernel/kexec_image.c +1 -10
index 9ec34690e255..5ed6a585f21f 100644
@@ -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
 };
Signature · 2 lines
Best regards,
Coiby
author maintainer
#4 lore raw
Quoted 36 lines · Coiby Xu

Hi Greg,

Good to see you here:)

Quoted 31 lines · On Mon, Aug 15, 2022 at 05:33:03PM +0200, [email protected] wrote:

The patch below does not apply to the 5.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 0d519cadf75184a24313568e7f489a7fc9b1be3b Mon Sep 17 00:00:00 2001

From: Coiby Xu <[email protected]>
Date: Thu, 14 Jul 2022 21:40:26 +0800
Subject: [PATCH] arm64: kexec_file: use more system keyrings to verify kernel image signature

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 [email protected] # 105e10e2cf1c: kexec_file: drop weak attribute from functions

This is not a valid commit id in Linus's tree.

Quoted 1 line
Quoted 1 line
Cc [email protected] # 34d5960af253: kexec: clean up arch_kexec_kernel_verify_sig

This is not a valid commit id in Linus's tree

Quoted 1 line
Quoted 1 line
Cc [email protected] # 83b7bb2d49ae: kexec, KEYS: make the code in bzImage64_verify_sig generic

And this too is not a valid commit in Linus's tree.

Quoted 5 lines

I've added the above three patch prerequisites following [1]. I assume there is a program automatically picking up this patch. But somehow it fails to pick up the prerequisites first. Is it because the commit ids change when the patches are finally applied to Linus's tree?

Where did you get those commit ids from?

Quoted 5 lines

If it's
true, how do we make sure the we have the correct commit ids? Note [1] strongly recommends "Cc: [email protected]" to submit patches to stable tree but it seems there is no way to know beforehand the correct commit ids of the prerequisites that are yet to arrive in Linus's tree.

Hopefully the git ids can be stable when they are merged to a maintainer's tree. If not, then you can respond to this "failed" email with the full series of what needs to be done here, as I have no idea :(

thanks,

greg k-h

#5 lore raw
Quoted 40 lines · Greg KH
Quoted 36 lines · Coiby Xu

Hi Greg,

Good to see you here:)

Quoted 31 lines · On Mon, Aug 15, 2022 at 05:33:03PM +0200, [email protected] wrote:

The patch below does not apply to the 5.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 0d519cadf75184a24313568e7f489a7fc9b1be3b Mon Sep 17 00:00:00 2001

From: Coiby Xu <[email protected]>
Date: Thu, 14 Jul 2022 21:40:26 +0800
Subject: [PATCH] arm64: kexec_file: use more system keyrings to verify kernel image signature

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 [email protected] # 105e10e2cf1c: kexec_file: drop weak attribute from functions

This is not a valid commit id in Linus's tree.

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Cc [email protected] # 34d5960af253: kexec: clean up arch_kexec_kernel_verify_sig

This is not a valid commit id in Linus's tree

Quoted 1 line
Quoted 1 line
Cc [email protected] # 83b7bb2d49ae: kexec, KEYS: make the code in bzImage64_verify_sig generic

And this too is not a valid commit in Linus's tree.

Sorry for the confusion. The correct commit ids are as follows,

0738eceb6201 ("kexec: drop weak attribute from functions") 689a71493bd2 ("kexec: clean up arch_kexec_kernel_verify_sig") c903dae8941d ("kexec, KEYS: make the code in bzImage64_verify_sig generic")

Quoted 8 lines
Quoted 6 lines

I've added the above three patch prerequisites following [1]. I assume there is a program automatically picking up this patch. But somehow it fails to pick up the prerequisites first. Is it because the commit ids change when the patches are finally applied to Linus's tree?

Where did you get those commit ids from?

I got the commit ids when rebasing the patches onto the then latest Linus tree or next-integrity tree.

Quoted 9 lines
Quoted 6 lines

If it's
true, how do we make sure the we have the correct commit ids? Note [1] strongly recommends "Cc: [email protected]" to submit patches to stable tree but it seems there is no way to know beforehand the correct commit ids of the prerequisites that are yet to arrive in Linus's tree.

Hopefully the git ids can be stable when they are merged to a maintainer's tree.

I notice the commit ids of these patches in current next-integrity tree are still different from Linus's tree. It seems there is no way to avoid manually backporting a patch for similar cases unless the commit ids are automatically fixed when Linus merges the patch or we could match a commit by its subject.

Quoted 2 lines

If not, then you can respond to this "failed" email
with the full series of what needs to be done here, as I have no idea :(

Sure, I'll email the backport to [email protected] as the response to this "failed" email.

Quoted 5 lines

thanks,

greg k-h

Signature · 2 lines
Best regards,
Coiby
#6 lore raw
Quoted 4 lines · Coiby Xu
Quoted 2 lines · Greg KH

Hopefully the git ids can be stable when they are merged to a maintainer's tree.

A missing Ack was added to one of the commits resulting in a forced rebase.

Quoted 6 lines

I notice the commit ids of these patches in current next-integrity tree are still different from Linus's tree. It seems there is no way to avoid manually backporting a patch for similar cases unless the commit ids are automatically fixed when Linus merges the patch or we could match a commit by its subject.

After "fixing" the topic branch merge message, I forgot to push it out to the next-integrity branch. (Will be fixed shortly.) Other than the merge message commit itself, the commits in Linus' tree and the next- integrity branch are the same. The pull request was based on the integrity-6.20 tag.

Tip of linux-integrity/next-integrity:

$ git log 1d212f9037b0 | head -2
commit 1d212f9037b035e638d53834bfe8d3094ca1d04c
Merge: c808a6ec7166 0828c4a39be5

Tip of the my local branch and what's in Linus' branch:

$ git log 88b61b130334 | head -2
commit 88b61b130334212f8f05175e291c04adeb2bf30b
Merge: c808a6ec7166 0828c4a39be5

The pull request tag:

$ git log integrity-6.20 | head -2
commit 88b61b130334212f8f05175e291c04adeb2bf30b
Merge: c808a6ec7166 0828c4a39be5

Mimi

#7 lore raw
Quoted 28 lines · Mimi Zohar
Quoted 4 lines · Coiby Xu
Quoted 2 lines · Greg KH

Hopefully the git ids can be stable when they are merged to a maintainer's tree.

A missing Ack was added to one of the commits resulting in a forced rebase.

Quoted 6 lines

I notice the commit ids of these patches in current next-integrity tree are still different from Linus's tree. It seems there is no way to avoid manually backporting a patch for similar cases unless the commit ids are automatically fixed when Linus merges the patch or we could match a commit by its subject.

After "fixing" the topic branch merge message, I forgot to push it out to the next-integrity branch. (Will be fixed shortly.) Other than the merge message commit itself, the commits in Linus' tree and the next- integrity branch are the same. The pull request was based on the integrity-6.20 tag.

Tip of linux-integrity/next-integrity:

$ git log 1d212f9037b0 | head -2
commit 1d212f9037b035e638d53834bfe8d3094ca1d04c
Merge: c808a6ec7166 0828c4a39be5

Tip of the my local branch and what's in Linus' branch:

Quoted 8 lines
$ git log 88b61b130334 | head -2
commit 88b61b130334212f8f05175e291c04adeb2bf30b
Merge: c808a6ec7166 0828c4a39be5

The pull request tag:

$ git log integrity-6.20 | head -2
commit 88b61b130334212f8f05175e291c04adeb2bf30b
Merge: c808a6ec7166 0828c4a39be5

Thanks for the explanation! Previously I thought the commit ids are different because Linus may have picked up the patches from the next tree and the git ids can only be determined in the last moment. But according to [2][3], Linus always merges a signed tag from a subsystem maintainer and unlike cherry-pick-up a merge could preserves the commit ids so a subsystem maintainer could know stable commit ids.

[2] https://www.spinics.net/lists/newbies/msg63520.html
[3] https://docs.kernel.org/maintainer/pull-requests.html

Quoted 3 lines

Mimi

Signature · 2 lines
Best regards,
Coiby
author maintainer
#8 lore raw
In reply to Coiby Xu
Quoted 47 lines · Coiby Xu
Quoted 46 lines · Greg KH
Quoted 36 lines · Coiby Xu

Hi Greg,

Good to see you here:)

Quoted 31 lines · On Mon, Aug 15, 2022 at 05:33:03PM +0200, [email protected] wrote:

The patch below does not apply to the 5.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 0d519cadf75184a24313568e7f489a7fc9b1be3b Mon Sep 17 00:00:00 2001

From: Coiby Xu <[email protected]>
Date: Thu, 14 Jul 2022 21:40:26 +0800
Subject: [PATCH] arm64: kexec_file: use more system keyrings to verify kernel image signature

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 [email protected] # 105e10e2cf1c: kexec_file: drop weak attribute from functions

This is not a valid commit id in Linus's tree.

Quoted 1 line
Quoted 1 line
Cc [email protected] # 34d5960af253: kexec: clean up arch_kexec_kernel_verify_sig

This is not a valid commit id in Linus's tree

Quoted 1 line
Quoted 1 line
Cc [email protected] # 83b7bb2d49ae: kexec, KEYS: make the code in bzImage64_verify_sig generic
Quoted 7 lines
Quoted 1 line

And this too is not a valid commit in Linus's tree.

Sorry for the confusion. The correct commit ids are as follows,

0738eceb6201 ("kexec: drop weak attribute from functions") 689a71493bd2 ("kexec: clean up arch_kexec_kernel_verify_sig") c903dae8941d ("kexec, KEYS: make the code in bzImage64_verify_sig generic")

What order do they need to be applied in?

thanks,

greg k-h

#9 lore raw
Quoted 50 lines · Greg KH
Quoted 49 lines · Coiby Xu
Quoted 47 lines · Greg KH
Quoted 36 lines · Coiby Xu

Hi Greg,

Good to see you here:)

Quoted 31 lines · On Mon, Aug 15, 2022 at 05:33:03PM +0200, [email protected] wrote:

The patch below does not apply to the 5.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 0d519cadf75184a24313568e7f489a7fc9b1be3b Mon Sep 17 00:00:00 2001

From: Coiby Xu <[email protected]>
Date: Thu, 14 Jul 2022 21:40:26 +0800
Subject: [PATCH] arm64: kexec_file: use more system keyrings to verify kernel image signature

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 [email protected] # 105e10e2cf1c: kexec_file: drop weak attribute from functions

This is not a valid commit id in Linus's tree.

Quoted 1 line
Quoted 1 line
Cc [email protected] # 34d5960af253: kexec: clean up arch_kexec_kernel_verify_sig

This is not a valid commit id in Linus's tree

Quoted 1 line
Quoted 1 line
Cc [email protected] # 83b7bb2d49ae: kexec, KEYS: make the code in bzImage64_verify_sig generic

And this too is not a valid commit in Linus's tree.

Quoted 7 lines
Quoted 5 lines

Sorry for the confusion. The correct commit ids are as follows,

0738eceb6201 ("kexec: drop weak attribute from functions") 689a71493bd2 ("kexec: clean up arch_kexec_kernel_verify_sig") c903dae8941d ("kexec, KEYS: make the code in bzImage64_verify_sig generic")

What order do they need to be applied in?

This is the whole series as seen in Linus tree from oldest to newest:

65d9a9a60fd71be964effb2e94747a6acb6e7015 kexec_file: drop weak attribute from functions 0738eceb6201691534df07e0928d0a6168a35787 kexec: drop weak attribute from functions 689a71493bd2f31c024f8c0395f85a1fd4b2138e kexec: clean up arch_kexec_kernel_verify_sig c903dae8941deb55043ee46ded29e84e97cd84bb kexec, KEYS: make the code in bzImage64_verify_sig generic 0d519cadf75184a24313568e7f489a7fc9b1be3b arm64: kexec_file: use more system keyrings to verify kernel image signature

(with the exception of the s390 patch which stands on its own)

Thanks

Michal

author maintainer
#10 lore raw
Quoted 59 lines · Michal Suchánek
Quoted 50 lines · Greg KH
Quoted 49 lines · Coiby Xu
Quoted 47 lines · Greg KH
Quoted 36 lines · Coiby Xu

Hi Greg,

Good to see you here:)

Quoted 31 lines · On Mon, Aug 15, 2022 at 05:33:03PM +0200, [email protected] wrote:

The patch below does not apply to the 5.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 0d519cadf75184a24313568e7f489a7fc9b1be3b Mon Sep 17 00:00:00 2001

From: Coiby Xu <[email protected]>
Date: Thu, 14 Jul 2022 21:40:26 +0800
Subject: [PATCH] arm64: kexec_file: use more system keyrings to verify kernel image signature

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 [email protected] # 105e10e2cf1c: kexec_file: drop weak attribute from functions

This is not a valid commit id in Linus's tree.

Quoted 1 line
Quoted 1 line
Cc [email protected] # 34d5960af253: kexec: clean up arch_kexec_kernel_verify_sig

This is not a valid commit id in Linus's tree

Quoted 1 line
Quoted 1 line
Cc [email protected] # 83b7bb2d49ae: kexec, KEYS: make the code in bzImage64_verify_sig generic

And this too is not a valid commit in Linus's tree.

Quoted 7 lines
Quoted 5 lines

Sorry for the confusion. The correct commit ids are as follows,

0738eceb6201 ("kexec: drop weak attribute from functions") 689a71493bd2 ("kexec: clean up arch_kexec_kernel_verify_sig") c903dae8941d ("kexec, KEYS: make the code in bzImage64_verify_sig generic")

What order do they need to be applied in?

Quoted 7 lines

This is the whole series as seen in Linus tree from oldest to newest:

65d9a9a60fd71be964effb2e94747a6acb6e7015 kexec_file: drop weak attribute from functions 0738eceb6201691534df07e0928d0a6168a35787 kexec: drop weak attribute from functions 689a71493bd2f31c024f8c0395f85a1fd4b2138e kexec: clean up arch_kexec_kernel_verify_sig c903dae8941deb55043ee46ded29e84e97cd84bb kexec, KEYS: make the code in bzImage64_verify_sig generic 0d519cadf75184a24313568e7f489a7fc9b1be3b arm64: kexec_file: use more system keyrings to verify kernel image signature

Great!

Quoted 1 line

(with the exception of the s390 patch which stands on its own)

What s390 patch?

Now you confused me again...

greg k-h

#11 lore raw
Quoted 68 lines · Greg KH
Quoted 59 lines · Michal Suchánek
Quoted 50 lines · Greg KH
Quoted 49 lines · Coiby Xu
Quoted 47 lines · Greg KH
Quoted 36 lines · Coiby Xu

Hi Greg,

Good to see you here:)

Quoted 31 lines · On Mon, Aug 15, 2022 at 05:33:03PM +0200, [email protected] wrote:

The patch below does not apply to the 5.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 0d519cadf75184a24313568e7f489a7fc9b1be3b Mon Sep 17 00:00:00 2001

From: Coiby Xu <[email protected]>
Date: Thu, 14 Jul 2022 21:40:26 +0800
Subject: [PATCH] arm64: kexec_file: use more system keyrings to verify kernel image signature

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 [email protected] # 105e10e2cf1c: kexec_file: drop weak attribute from functions

This is not a valid commit id in Linus's tree.

Quoted 1 line
Quoted 1 line
Cc [email protected] # 34d5960af253: kexec: clean up arch_kexec_kernel_verify_sig

This is not a valid commit id in Linus's tree

Quoted 1 line
Quoted 1 line
Cc [email protected] # 83b7bb2d49ae: kexec, KEYS: make the code in bzImage64_verify_sig generic

And this too is not a valid commit in Linus's tree.

Quoted 7 lines
Quoted 5 lines

Sorry for the confusion. The correct commit ids are as follows,

0738eceb6201 ("kexec: drop weak attribute from functions") 689a71493bd2 ("kexec: clean up arch_kexec_kernel_verify_sig") c903dae8941d ("kexec, KEYS: make the code in bzImage64_verify_sig generic")

What order do they need to be applied in?

Quoted 7 lines

This is the whole series as seen in Linus tree from oldest to newest:

65d9a9a60fd71be964effb2e94747a6acb6e7015 kexec_file: drop weak attribute from functions 0738eceb6201691534df07e0928d0a6168a35787 kexec: drop weak attribute from functions 689a71493bd2f31c024f8c0395f85a1fd4b2138e kexec: clean up arch_kexec_kernel_verify_sig c903dae8941deb55043ee46ded29e84e97cd84bb kexec, KEYS: make the code in bzImage64_verify_sig generic 0d519cadf75184a24313568e7f489a7fc9b1be3b arm64: kexec_file: use more system keyrings to verify kernel image signature

Quoted 5 lines

Great!

Quoted 1 line

(with the exception of the s390 patch which stands on its own)

What s390 patch?

0828c4a39be57768b8788e8cbd0d84683ea757e5 kexec, KEYS, s390: Make use of built-in and secondary keyring for signature verification

Quoted 3 lines

Now you confused me again...

greg k-h

author maintainer
#12 lore raw
In reply to Michal Suchánek
Quoted 61 lines · Michal Suchánek
Quoted 50 lines · Greg KH
Quoted 49 lines · Coiby Xu
Quoted 47 lines · Greg KH
Quoted 36 lines · Coiby Xu

Hi Greg,

Good to see you here:)

Quoted 31 lines · On Mon, Aug 15, 2022 at 05:33:03PM +0200, [email protected] wrote:

The patch below does not apply to the 5.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 0d519cadf75184a24313568e7f489a7fc9b1be3b Mon Sep 17 00:00:00 2001

From: Coiby Xu <[email protected]>
Date: Thu, 14 Jul 2022 21:40:26 +0800
Subject: [PATCH] arm64: kexec_file: use more system keyrings to verify kernel image signature

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 [email protected] # 105e10e2cf1c: kexec_file: drop weak attribute from functions

This is not a valid commit id in Linus's tree.

Quoted 1 line
Quoted 1 line
Cc [email protected] # 34d5960af253: kexec: clean up arch_kexec_kernel_verify_sig

This is not a valid commit id in Linus's tree

Quoted 1 line
Quoted 1 line
Cc [email protected] # 83b7bb2d49ae: kexec, KEYS: make the code in bzImage64_verify_sig generic

And this too is not a valid commit in Linus's tree.

Quoted 7 lines
Quoted 5 lines

Sorry for the confusion. The correct commit ids are as follows,

0738eceb6201 ("kexec: drop weak attribute from functions") 689a71493bd2 ("kexec: clean up arch_kexec_kernel_verify_sig") c903dae8941d ("kexec, KEYS: make the code in bzImage64_verify_sig generic")

What order do they need to be applied in?

This is the whole series as seen in Linus tree from oldest to newest:

Quoted 7 lines

65d9a9a60fd71be964effb2e94747a6acb6e7015 kexec_file: drop weak attribute from functions 0738eceb6201691534df07e0928d0a6168a35787 kexec: drop weak attribute from functions 689a71493bd2f31c024f8c0395f85a1fd4b2138e kexec: clean up arch_kexec_kernel_verify_sig c903dae8941deb55043ee46ded29e84e97cd84bb kexec, KEYS: make the code in bzImage64_verify_sig generic 0d519cadf75184a24313568e7f489a7fc9b1be3b arm64: kexec_file: use more system keyrings to verify kernel image signature

(with the exception of the s390 patch which stands on its own)

Ok, I think I now have all of this straightened out. If not, please let me know.

greg k-h

#13 lore raw
In reply to Greg KH
Quoted 1 line · Greg KH

On Tue, Aug 16, 2022 at 06:45:59PM +0800, Coiby Xu wrote:

[...]

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 14 lines
Quoted 14 lines
Quoted 1 line

From 0d519cadf75184a24313568e7f489a7fc9b1be3b Mon Sep 17 00:00:00 2001

From: Coiby Xu <[email protected]>
Date: Thu, 14 Jul 2022 21:40:26 +0800
Subject: [PATCH] arm64: kexec_file: use more system keyrings to verify kernel image signature

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".

Quoted 5 lines
Quoted 5 lines

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 [email protected] # 105e10e2cf1c: kexec_file: drop weak attribute from functions

This is not a valid commit id in Linus's tree.

Quoted 1 line
Quoted 1 line
Cc [email protected] # 34d5960af253: kexec: clean up arch_kexec_kernel_verify_sig

This is not a valid commit id in Linus's tree

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Cc [email protected] # 83b7bb2d49ae: kexec, KEYS: make the code in bzImage64_verify_sig generic

And this too is not a valid commit in Linus's tree.

Sorry for the confusion. The correct commit ids are as follows,

0738eceb6201 ("kexec: drop weak attribute from functions")

Sorry, the first one should be 65d9a9a60fd7 ("kexec_file: drop weak attribute from functions").

Quoted 4 lines
Quoted 2 lines

689a71493bd2 ("kexec: clean up arch_kexec_kernel_verify_sig") c903dae8941d ("kexec, KEYS: make the code in bzImage64_verify_sig generic")

What order do they need to be applied in?

They should be applied from top-down, i.e.

1. 65d9a9a60fd7 ("kexec_file: drop weak attribute from functions")
2. 689a71493bd2 ("kexec: clean up arch_kexec_kernel_verify_sig")
3. c903dae8941d ("kexec, KEYS: make the code in bzImage64_verify_sig generic")

But I notice stable/linux-5.19.y has already the first two prerequisites backported. So only the 3rd prerequisite is needed.

Quoted 5 lines

thanks,

greg k-h

Signature · 2 lines
Best regards,
Coiby