Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testcases/OpTestKexec.py: add new test cases with -s and -c options #816

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

nasastry
Copy link
Contributor

Add new test cases with -s and -c options.
test case with -c option should fail when secure boot is enabled

self.skipTest("Can not create unsigned binary. Using- %s"
% cmd)
cmd = "kexec -s -l %s.unsigned" % self.kernel_image
ret = self.execute_kexec_cmd(cmd)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

execute_kexec_cmd () will attempt to perform kexec reboot correct? If so is the test here to actually attempt to perform kexec with unsigned image or just an attempt to load an unsigned image. If its the later then can't we use load_kexec_kernel() instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function creates the unsigned kernel image from the existing signed kernel image and tries to load when guest secure boot is enabled.

@@ -0,0 +1,138 @@
#!/usr/bin/env perl
# SPDX-License-Identifier: GPL-2.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This license is different from what op-test uses. Is this okay?
Is it possible to download this file at runtime?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes agree with sachin , please use this link https://raw.githubusercontent.com/torvalds/linux/master/scripts/extract-module-sig.pl , may have wget in test itself as we don't have any API in op-test to perform wget

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will change.

@@ -0,0 +1,138 @@
#!/usr/bin/env perl
# SPDX-License-Identifier: GPL-2.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes agree with sachin , please use this link https://raw.githubusercontent.com/torvalds/linux/master/scripts/extract-module-sig.pl , may have wget in test itself as we don't have any API in op-test to perform wget


kexec_exec_cmd = self.get_kexec_exec_command(exec_opt=True)
ret = self.execute_kexec_cmd(kexec_exec_cmd, raw_pty_console=True)
self.assertTrue(ret, "kexec exec failed: " + kexec_exec_cmd)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use %s to concatenate string

Copy link
Collaborator

@PraveenPenguin PraveenPenguin Apr 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address this style issue and where ever it required

Add new test cases with -s and -c options.
test case with -c option should fail when secure boot is enabled

Signed-off-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
Add unsigned kernel test when secure boot enabled.
Add additional file ie extract-module-sig.pl, taken from linux kernel source.
This file helps in extracting an unsigned kernel from signed kernel.

Signed-off-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
@nasastry
Copy link
Contributor Author

Addressed all the comments and pushed the code. Thank You.

@PraveenPenguin PraveenPenguin merged commit e4c4fb6 into open-power:master Apr 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants