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
r358919 causing boot failures for MIPS Linux kernel #42108
Comments
Can we please revert r358919 for the clang-9 release, then sort this out/reland for clang-10? |
+Philip who wrote r358919 |
I'd like to see a testcase before we decide to revert anything; given the nature of the change, it's likely we'll conclude the kernel code in question has undefined behavior. |
Via: ClangBuiltLinux/linux#610 (comment) /*
/*
so I'm guessing that mips_io_port_base being declared const is problematic, but I'm not sure the LLVM change in question considers "casting away the const-ness." |
You can't cast away the const-ness of a variable. If you try, it's undefined behavior. (From the C standard: "If an attempt is made to modify an object defined with a const-qualified type through use of an lvalue with non-const-qualified type, the behavior is undefined.") |
0001-mips-avoid-undefined-behavior-in-assignment-of-mips_.patch |
OK, sorry for the noise and thanks for helping debug. Nathan confirmed the attached patch allows us to boot. We'll send it upstream to the Linux kernel. |
Maybe you should write about this optimization (and how to detect that UB.. sanitizers?) in Release notes? |
+1 I was just about to suggest that. Philip: would you be willing to mention this in the release notes? |
|
Perfect, thanks! (I've moved the note to the release_90 branch in r367997.) |
Extended Description
Reported via: ClangBuiltLinux/linux#610 (comment)
It seems that with clang-8, we can boot a working MIPS linux kernel.
It fails to boot with clang-9, seemingly due to r358919 commit d748689 ("[InstCombine] Eliminate stores to constant memory").
The particular optimization sounds like it may be potentially dangerous; maybe the kernel is exercising such an unconsidered case?
The text was updated successfully, but these errors were encountered: