-
Notifications
You must be signed in to change notification settings - Fork 14
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
CoCo code breaks with CFI #2015
Comments
Hmmm, I am not able to reproduce this on top of defconfig with the following options enabled. Perhaps I will need your full configuration.
I'll try to reproduce with both tip of tree LLVM main and |
Hmmmm, I probably should've disabled
This is on the same config as the original, but without Also, I used ToT to test just before filing this report, & the same issue is present there. Has been for months, as a matter of fact. But again, it may just be the patches messing with it, so give me a day or so to test fully vanilla LLVM. But if it helps, here is my config: lolconfig.txt It does play with fire a little compared to the usual distro kernel config, with stuff like |
Something with these patches is almost certainly going to be the root cause of the problem. If it does, it would be pretty helpful to narrow down the exact change that causes it, as it may be possible to disable it for the kernel explicitly so that regardless of changed defaults, everything works. There is precedent for this with GCC, which allows certain defaults to be customized by the user.
No worries.
I'll give it a go when I have some time. |
Yes. Most people building the kernel with Clang use truly vanilla LLVM, but distributions often patch LLVM to have sane security defaults, so it would be nice to have an OOTB LLVM build with those. I do wish they'd use Clang configuration files, but AFAIK only Gentoo does that RN.
Thanks! The devil is always in the details, but please remember to disable most modules here to save on compile times; I don't think it'll affect whether the bug is reproducible or not. This config enables basically everything, but I don't think it'd hurt to disable network drivers, multimedia, SCSI, DRM, industrial I/O, filesystems, & sound card support. Just those account for some 3/4 of the build. |
Also worth noting that the LLVM I am building RN, aside from removing all patches, I have taken out Would be neat if that was actually the cause; that option in most cases provides a safe fallback for buggy code, but for some code it brings out its edge cases 100% of the time, as opposed to basically never in practice. |
What I have found is that this issue only occurs because my LLVM was built with a random ToT revision that was silently buggy for kcfi only, somehow (I swear, I run the kernels I build with LLVM through plenty of testsuites, they do absolutely work just fine). I did one build that was only different from the compiler in the initial bug report in that it used my system GCC to compile the 1st stage of the LLVM build & that was enough to make it work. So it's not the patches that were relevant, though I've since dropped those. So the solution is just to stop building stable LLVM with a dangerous cowboy revision of LLVM, even if it passed the testsuite at the time. I just built the entire config shared above with these issues fixed, & everything works:
So the issue was just one of those fun compiler issues that requires a 3-stage compile to fix, & I didn't think to do that since it'd been working perfectly for everything else. Really was just me being a little foolish, sorry for that. |
Greetings. I've tried to build an x86_64 kernel with CFI enabled. It's a "distro kernel" config of sorts, kitted out with every driver & every bit of functionality. The x86 CoCo infrastructure breaks when you enable CFI. Here's the relevant log snippet:
You don't need any CoCo-supporting HW or setup to trigger this, this'll break anywhere on boot. Specifically, it happens during the alternative patching stage, so you can't miss it. Just enable any option that enables
CONFIG_ARCH_HAS_CC_PLATFORM
(enables thecc_platform_has
function seen above).I am compiling with
LLVM=1 LLVM_IAS=1
, with self-built LLVM 18.1.4.Let me know if you need the config.
The text was updated successfully, but these errors were encountered: