-
Notifications
You must be signed in to change notification settings - Fork 72
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
mkosi and GA CI support for boot test on Ubuntus #61
Conversation
@vt-alt Thank you for the contribution! Should we possibly see it in action already on this PR (we don't yet) or will it activate automatically upon merging (I guess so) or do we need to make any change in the repo's settings on GitHub? |
Example in action there https://github.com/vt-alt/lkrg/actions two top builds with |
After some thought, I think they run a version of workflow that is already committed to the branch where a new commit or PR appears. (You can limit the events that trigger work, but there I don't limit anything.) |
Possible small improvement to this PR: as you can see there https://github.com/vt-alt/lkrg/runs/2215564904?check_suite_focus=true#step:7:774 there are empty lines between console output, I think this is a possible "\r\n" artifact, I may try to add "\r" stripping between About |
Yes, |
FYI. Also, I decided to use ps. Ah, and I remember, one more small improvement would be to add >20 seconds sleep to trigger kernel softlockup check for sure. But, that could be done later. Now there is still >20 delay by the chance of slow boot: |
Some additional thoughts on possible future tests additions and improvements:
|
Force-pushed again to change the commit message, I noticed that I referenced |
It could be related to this bug: @vt-alt thanks for that PR. I've no knowledge about |
FYI http://0pointer.net/blog/mkosi-a-tool-for-generating-os-images.html |
mkosi is systemd's boot test tool. This support is mainly for GA CI to implement full boot tests (on Ubuntu). But, this would be useful on it's own for experiments with lkrg on all mkosi supported distros. I support only bios (grub) BootProtocol without unified kernel. - .gitignore updated to exclude mkosi artifacts (otherwise they could recursively go into created image causing disk full error). - mkosi.default is mkosi config pre-configured for ubuntu focal, you can overwrite this with command line options. - mkosi.build is script to build lkrg and install it into DESTDIR. - mkosi.postinst hook updates initrd to include and insmod lkrg and grub to remove 'quiet' cmdline option. Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Use mkosi to test full system boot with LKRG module loaded early in initrd. mkosi creates system disk image (quite slow, 5 minutes for ubuntu focal in my tests, and size is 1.3G), builds lkrg there (using systemd-nspawn), and finally boots it in qemu. Then we grep boot.log for possible problems. Ubuntu is chosen, because it's native to GA. Only successful (for the test) releases are 'focal' and 'groovy'. It seems mkosi does not support 'hirsute' (yet, failure installing packages into image). Also, 'bionic' does not build lkrg properly, but mkosi works good. Older Ubuntu seems to not have systemd, which is a hard mkosi requirement. Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Ping? |
@solardiz what's your opinion? |
Maybe I am wrong with the test approach. There is so 0 of opinion on this PR. so it looked like you not interested at all. |
@vt-alt I'm sorry, I just didn't have enough time for everything needing my attention. Please don't feel discouraged. Your contribution is greatly appreciated and we'll proceed to try it out. For this, I intend to go ahead and merge it now, and then we'll see what's next. Thank you! |
The CI tests added here were triggered right upon merging this PR and have completed in 7 minutes each (for two versions of Ubuntu). Thanks again, @vt-alt! |
I do agree that the full system boot tests are necessary and important - thanks for working on such feature! However, I was overblown with the urgent work in my daily job for the last 2 weeks and didn't have time to follow-up on
I do agree that the full system boot tests are necessary and important - thanks for working on such feature! |
Unfortunately, I also lack knowledge on In my past discussions with @vt-alt (via private e-mail), I had encouraged him or others at ALT to contribute something like this (after having heard @wladmis had implemented something "like this" for/in ALT's package of LKRG). Our thinking was that @Adam-pi3 could then proceed to add (regression) tests (for known past issues) to run in the system booted in the temporary VM. So, Adam, we'd appreciate it if you do proceed to add such tests if/when any become relevant. I guess this shouldn't be too hard to do even without full knowledge over how that system is created and booted up. |
I think the most valuable would be to run a sequence of commands including |
That's great, thanks for your opinion!
I took a different (but more flexible) approach than that small
If you show some example module and a test binary/script I could try to add them into CI workflow. But,
That part I don't understand. |
To add. In that case, we can leave mkosi boot test as is just as a full system boot test, which is beneficial in itself. And create an additional workflow for regression tests.
|
Do I understand you right: you mean to make a special kernel module for test purposes with a vulnerability, and check whether LKRG catches an exploit of it? |
We could, but if we disable LKRG causing kernel panic on detection violations (and are OK with not testing that aspect) then we could as well use one workflow for both successful boot testing (make sure there are no unexpected messages from LKRG, say, in the first 10 seconds after its success message) and vulnerable module loading and exploit testing (make sure every exploitation attempt produces the expected detection messages from LKRG).
It is relevant to test any kernel versions we support, so in your question it would be both latest mainline and older distro kernels. I don't know which are "better" to include in the testing - we'd want to detect and look into any issues with either kind. However, if some breakage is caused by a change in latest mainline rather than in LKRG, it could take us a longer while to address it, and it would be unfortunate to have sort of non-working CI during this period (that would keep reporting the would-be-already-known issue with mainline and making it harder for us to see if there's also some LKRG regression). So perhaps we should have an easy way to temporarily disable and re-enable testing with latest mainline kernels?
We don't know. We generally only hear from a user when there's a problem, and we've heard about all sorts of distros. Ubuntu is a popular one, but other popular choices seems to be CentOS, Arch, Debian/Whonix, and perhaps ALT?
I think we should keep Ubuntu, but also add perhaps CentOS 7 and 8. Instead of CentOS 8, it can be (and will eventually have to be) AlmaLinux or (later) RockyLinux. Can also have Fedora or CentOS Stream - would probably let us catch issues (typically back-ports that LKRG needs to adapt to) before they appear in a RHEL/CentOS/AlmaLinux/RockyLinux release. |
Yes, that's what Adam meant, and he already has that intentionally vulnerable kernel module - but perhaps it would need some cleanups and maybe some kind of safety feature (against inadvertent misuse) before being committed to somewhere in this repo. |
@solardiz Thanks for your answer. There is a few thought on this:
I think tests do not need to be perfect and all green all the times, as we (well, you) (when looking why tests reported not green status) can ignore tests that are not producing correct results temporarily, or know 'latest kernel' test isn't relevant today and don't even need to be looked upon for details. GA has 'experimental' job flag, but I don't know yet how they are reported (affecting color of workflow or not). |
Correct. We need to clean it up and before publishing. From my understanding similar functionality can be made by |
Agreed. We should have both tests including latest mainline. @vt-alt I assume you are thinking about integration of https://kernel.ubuntu.com/~kernel-ppa/mainline/ compilation, correct? |
Yes. I am already (I think) done with the download script, now thinking about better integration with mkosi and GA.
|
There are two commits:
I tested this only on Ubuntu focal (in Vagrant). But, this may work on other distributions where
mkosi
is supported (many, but not ALT).Tested on different Ubuntu releases and only working are
focal
(with Linux v5.4),groovy
(Linux v5.8), andbionic
(with Linux v4.15, excluding the fact that LKRG does not build for it). I hopehirsute
will work too as soon as it's released.