-
Notifications
You must be signed in to change notification settings - Fork 265
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
Linux ci - Compile KVM with goto-cc #5916
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #5916 +/- ##
===========================================
- Coverage 74.30% 74.27% -0.03%
===========================================
Files 1444 1444
Lines 157453 157460 +7
===========================================
- Hits 116995 116953 -42
- Misses 40458 40507 +49
Continue to review full report at Codecov.
|
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: CPROVER-faultyInput | ||
path: CPROVER/faultyInput/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does one actually download these? GitHub keeps telling me that I need to have the "actions" scope, perhaps the repository permissions are set up in a way that doesn't permit non-members to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about doing tail -n +1 CPROVER/faultyInput/*
instead? Really simple and avoids any permissions problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the checks page (here, e.g.: https://github.com/diffblue/cbmc/pull/5916/checks there is an "artifacts" button on the top left, which allows (me) to download, I did not see any permission restrictions in the description of the action). Yes, I could also dump the content of the files, but that likely floods the output, as those are preprocessed already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err, thank you, that was too easy. A first fix is in #5928.
sudo apt-get install --no-install-recommends -y coreutils build-essential gcc git make flex bison software-properties-common curl python | ||
sudo apt-get install --no-install-recommends -y bin86 gdb bcc liblzma-dev python-dev gettext iasl uuid-dev libncurses5-dev libncursesw5-dev pkg-config | ||
sudo apt-get install --no-install-recommends -y libgtk2.0-dev libyajl-dev sudo time ccache | ||
sudo apt-get install --no-install-recommends -y automake bc libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf gawk jq |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I recall, we just need build-essential libssl-dev
for the Linux kernel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, that depends on the configuration. I can minimize this set.
- name: Get Linux v5.10 | ||
run: git clone -b v5.10 --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux_5_10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest to always use the latest release (at the risk of builds surprisingly breaking) and perhaps also using tar/zip instead of cloning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If people are willing to take the risk, and address the issue (or roll this action back to the last known working release) I can build logic to always access the latest release.
On the other hand, I would like to be able to ensure that a specific version is always working.
This is the risk I see when always using the latest release: Once the latest release fails, people might ignore the failure or disable this action to unblock themselves. Afterwards, even compiling older relases might start to break again. Hence, I decided to pick a specific release for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should have two such actions? One with a fixed, longterm-maintenance release (5.10 seems like a reasonable candidate) and one using the "master" branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do the stable one for now, and iterate once that one is in.
95c617f
to
e5d5a1e
Compare
We will next need #5730 to be merged. |
make -C linux_5_10 allnoconfig | ||
make -C linux_5_10 kvm_guest.config | ||
make -C linux_5_10 bzImage -j $(nproc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I suggest the following variation of this:
cat > kvm-config <<EOF
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_MULTIUSER=y
CONFIG_NET=y
CONFIG_VIRTUALIZATION=y
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_KVM_GUEST=y
CONFIG_KVM=y
CONFIG_KVM_INTEL=y
CONFIG_KVM_AMD=y
EOF
KCONFIG_ALLCONFIG=kvm-config make allnoconfig
make bzImage -j $(nproc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can re-iterate
make -C linux_5_10 kvm_guest.config | ||
make -C linux_5_10 bzImage -j $(nproc) | ||
du -h . --max-depth=1 | ||
rm "linux_5_10/arch/x86/kernel/kvm.o" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the above, perhaps instead do:
rm arch/x86/kernel/kvm.o
find arch/x86/kvm/ -name "*.o" -delete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will iterate
make -C linux_5_10 bzImage -j $(nproc) | ||
du -h . --max-depth=1 | ||
rm "linux_5_10/arch/x86/kernel/kvm.o" | ||
one-line-scan/one-line-scan --add-to-path $(pwd)/src/cbmc --add-to-path $(pwd)/src/goto-diff --add-to-path $(pwd)/src/goto-cc --no-analysis --trunc-existing --extra-cflags -Wno-error -o CPROVER -j 3 -- make -C linux_5_10 bzImage -j $(nproc) -k || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we we should be ignoring failures here, thus drop -k || true
. Also, shouldn't one-line-scan use (at least) the same -j
as the command being run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that should work.
The '-j' for one-line-scan is limited to not consume too much memory. For github, that should be good enough. For other use cases, that might be higher.
I addressed the comments, and factored out the actual compilation into a separate script, so that these steps can be executed in other environments more easily. |
Thanks a lot, I'll review whether I already have a patch for the invariant failure. |
A proposal for the patch is in #5967, but I need to reconsider whether that's the correct approach (it is borrowed from #5738, which also made a number of other changes). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me (modulo the CI failure).
I will wait for this to be fixed then I will approve this to get in.
7931bda
to
21abee1
Compare
Script the steps required to build linux, so that they can also be executed locally. Signed-off-by: Norbert Manthey <nmanthey@amazon.de> Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
Similarly to Xen, CBMC should be able to compile the linux kernel. As compiling the full kernel is very time consuming, and with CBMC also space consuming, only compile a core part all its dependencies, with the smalles configuration possible. For this core part, we select the KVM hypervisor. Once this is working, the configuration, as well as targets to be compiled can be increased. When the linuxci fails, we want to be able to easily understand the failure. The used one-line-scan tool already captures input files that cannot be handled by goto-cc. Hence, also archives these files for easy access in the web UI. Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
on: | ||
pull_request: | ||
branches: | ||
- '**' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little hesitant about (another) CI job that runs on all PRs, specially one that we expect to report failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to suggest another branch pattern. I can also target the develop and production branch only. That might result in late surprises.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TGWDB Why would you expect failures here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nmanthey I'm no git expert and don't have a better suggestion. I agree that late failures are not a good idea.
@tautschnig Based on the original PR text:
"This change adds a github workflow that compiles parts of the Linux kernel with goto-cc, and fails in case compilation fails. Furthermore, the input fails that lead to the failure are archived, to allow easy consumption and investigation."
I'm happy if this works without failures, but was (mis?)reading that we expect this to fail more often due to the target and perhaps related aspects of cbmc
.
If we expect goto-cc
to never fail this except for when we break something then I have no objection.
This change adds a github workflow that compiles parts of the Linux kernel with goto-cc, and fails in case compilation fails. Furthermore, the input fails that lead to the failure are archived, to allow easy consumption and investigation.
Note: This is currently failing, and should help to improve goto-cc to be able to compile Linux
An example failed run with the broken input as artifact has been created as part of my testing: https://github.com/nmanthey/cbmc/pull/5/checks?check_run_id=2093209018