Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1636685

Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for multiplication to work around Clang incompatibility

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for multiplication to work around Clang incompatibility
Date 2017-05-05 21:40 +0200
Message-ID <tDRf4-63i-27@gated-at.bofh.it> (permalink)
References <tCsiK-6wM-17@gated-at.bofh.it> <tDGMF-7Ep-5@gated-at.bofh.it> <tDIEN-s5-1@gated-at.bofh.it> <tDPGi-4Wu-9@gated-at.bofh.it> <tDQsF-5uu-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, May 5, 2017 at 11:44 AM, Matthias Kaehlcke <mka@chromium.org> wrote:
>
> Indeed, I expect 4.12 (with this patch ...) to build with Clang for a
> x86 defconfig (with tons of warnings). ARM64 is very close.

Does it actually *work*, rather than just build?

clang used to have actual code generation bugs that made for really
subtle kernel issues but didn't matter very often in user space.

The thing that comes to mind is the crazy handling of spilling
'eflags' on x86 (saving and restoring eflags over a function call in
order to save the arithmetic flags, but in the process also undoing
the changes to IF that that function call did.

That was a horrible horrible bug - it generates slow code, but it was
actually *incorrect* code too. It's just that in user space, people
very seldom mess with the non-arithmetic flags (things like IOPL, IF,
AC, etc - they *can* be used in user space but seldom are).

Some of the discussion I saw by the clang people pooh-poohed that bug
and seemed to think it was a kernel problem.

That kind of pure incompetence from compiler people doesn't make me
get the warm and fuzzies.

Generating code that is actively _wrong_ and performs badly too - hey
that happens. But then making excuses for clearly buggy code
generation?

I did have a report saying it was fixed, so hopefully saner people prevailed.

But it left a really bad taste, and it was an example of something
that may have built fine, but generated subtle broken code (where
"subtly" here means "it might work when you don't look too closely and
are lucky, and then cause lockups in odd situations").

I'd love to be able to compile the kernel with clang, but only if the
clang people take it seriously.

            Linus

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] x86/mm/kaslr: Use _ASM_MUL macro for multiplication Matthias Kaehlcke <mka@chromium.org> - 2017-05-02 00:50 +0200
  Re: [PATCH v2] x86/mm/kaslr: Use _ASM_MUL macro for multiplication Kees Cook <keescook@chromium.org> - 2017-05-02 04:10 +0200
  [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for  multiplication to work around Clang incompatibility tip-bot for Matthias Kaehlcke <tipbot@zytor.com> - 2017-05-05 10:30 +0200
    Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for  multiplication to work around Clang incompatibility Peter Zijlstra <peterz@infradead.org> - 2017-05-05 12:30 +0200
      Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for  multiplication to work around Clang incompatibility Ingo Molnar <mingo@kernel.org> - 2017-05-05 20:00 +0200
        Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for  multiplication to work around Clang incompatibility Peter Zijlstra <peterz@infradead.org> - 2017-05-05 20:30 +0200
        Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for  multiplication to work around Clang incompatibility Matthias Kaehlcke <mka@chromium.org> - 2017-05-05 20:50 +0200
          Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for  multiplication to work around Clang incompatibility Linus Torvalds <torvalds@linux-foundation.org> - 2017-05-05 21:40 +0200
            Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for  multiplication to work around Clang incompatibility Michael Davidson <md@google.com> - 2017-05-05 22:40 +0200
              Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for  multiplication to work around Clang incompatibility Peter Zijlstra <peterz@infradead.org> - 2017-05-06 10:20 +0200
                Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for multiplication to work around Clang incompatibility hpa@zytor.com - 2017-05-08 00:10 +0200
            Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for  multiplication to work around Clang incompatibility Matthias Kaehlcke <mka@chromium.org> - 2017-05-05 23:00 +0200
              Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for  multiplication to work around Clang incompatibility Ingo Molnar <mingo@kernel.org> - 2017-05-06 12:00 +0200
          Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for multiplication to work around Clang incompatibility hpa@zytor.com - 2017-05-05 22:00 +0200
            Re: [tip:x86/urgent] x86/mm/kaslr: Use the _ASM_MUL macro for  multiplication to work around Clang incompatibility Matthias Kaehlcke <mka@chromium.org> - 2017-05-05 23:30 +0200

csiph-web