Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1535267
| From | Linus Torvalds <torvalds@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation |
| Date | 2016-12-03 00:20 +0100 |
| Message-ID | <sK5hv-1NF-11@gated-at.bofh.it> (permalink) |
| References | (11 earlier) <sK1QB-7Z6-25@gated-at.bofh.it> <sK1QB-7Z6-23@gated-at.bofh.it> <sK2Wl-dS-11@gated-at.bofh.it> <sK3pn-D9-27@gated-at.bofh.it> <sK4Ya-1s6-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Dec 2, 2016 at 2:55 PM, Andy Lutomirski <luto@amacapital.net> wrote:
>>
>> Honestly, I think Intel should clean up their documentation.
>
> I'm not sure I follow. If a user program gets migrated, it might end
> up doing cross-modification when it expects self-modification. If
> that trips the program up, is that a user bug or a kernel bug?
Well, the user may not see it as a cross-modification.
Example: user compiles a program, and writes out the new binary. That
write goes to the page cache.
The user then immediately executes that program.
It's technically a "cross modification", because the build that wrote
the page cache ran on one CPU, and then it gets loaded on another.
Not, page faulting the binary does bring in a known serializing
instruction: iret.
But let's theorize that we have your "optimistic sysret" return path
because sometimes it can happen. So the "iret" isn't exactly
fundamental.
But we know we will write %cr2, which is a serializing instruction.
But that's not fundamental either, because we <i>could</i> just have a
program just load the object file into its own address space using the
dynamic linker. And if you don't unmap anything, there won't be any
TLB flushes.
Now, that is safe <i>too</I>, but by then we're not even relying on
simply the fact that the code couldn't even have been in any virtual
caches in the running environment, so it _must_ have come from the
physically indexed data cache. So no actual serializing instruction
even _needed_.
So there is no room for any cache I$ coherency issue at any point, but
note how we got to the point where we're now basically depending on
some fairly fundamental logic that is not in the Intel documentation?
THAT is what I don't like. I don't doubt for a moment that what we're
doing is entirely coherent, and we're fine. But the intel memory
ordering documentation simply doesn't cover this situation at all. The
"real" memory ordering documentation only covers the normal data
cache. And then they handwave the "self-modifying code" situation with
incomplete examples and just bullshit "you need a serializing
instruction", which clearly isn't actually the case, and is also
something that we very much don't even do.
It would be better if here was actual documentation, and we had some
nice clear "yeah, we don't need any stinking serializing instructions,
because we're already doing X".
Linus
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4] CPUID-less CPU fixes and improvements Andy Lutomirski <luto@kernel.org> - 2016-11-30 21:40 +0100
[PATCH 4/4] x86/asm: Change sync_core() to use MOV to CR2 to serialize Andy Lutomirski <luto@kernel.org> - 2016-11-30 21:40 +0100
Re: [PATCH 4/4] x86/asm: Change sync_core() to use MOV to CR2 to serialize Borislav Petkov <bp@alien8.de> - 2016-12-01 10:30 +0100
Re: [PATCH 4/4] x86/asm: Change sync_core() to use MOV to CR2 to serialize Andy Lutomirski <luto@amacapital.net> - 2016-12-01 18:10 +0100
Re: [PATCH 4/4] x86/asm: Change sync_core() to use MOV to CR2 to serialize Andrew Cooper <andrew.cooper3@citrix.com> - 2016-12-01 18:50 +0100
Re: [PATCH 4/4] x86/asm: Change sync_core() to use MOV to CR2 to serialize Ingo Molnar <mingo@kernel.org> - 2016-12-02 08:40 +0100
[PATCH 3/4] x86/microcode/intel: Replace sync_core() with cpuid_eax(1) Andy Lutomirski <luto@kernel.org> - 2016-11-30 21:40 +0100
Re: [PATCH 3/4] x86/microcode/intel: Replace sync_core() with cpuid_eax(1) Borislav Petkov <bp@alien8.de> - 2016-12-01 10:20 +0100
[PATCH v2 6/6] x86/asm: Change sync_core() to use MOV to CR2 to serialize Andy Lutomirski <luto@kernel.org> - 2016-12-02 01:40 +0100
[PATCH v2 4/6] x86/paravirt: Make sync_core() be a paravirt op Andy Lutomirski <luto@kernel.org> - 2016-12-02 01:40 +0100
[PATCH v2 3/6] x86/microcode/intel: Replace sync_core() with cpuid_eax(1) Andy Lutomirski <luto@kernel.org> - 2016-12-02 01:40 +0100
[PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andy Lutomirski <luto@kernel.org> - 2016-12-02 01:40 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andrew Cooper <andrew.cooper3@citrix.com> - 2016-12-02 12:50 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andy Lutomirski <luto@amacapital.net> - 2016-12-02 18:10 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andrew Cooper <andrew.cooper3@citrix.com> - 2016-12-02 18:20 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andrew Cooper <andrew.cooper3@citrix.com> - 2016-12-02 18:30 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andy Lutomirski <luto@amacapital.net> - 2016-12-02 18:30 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-12-02 19:50 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andy Lutomirski <luto@amacapital.net> - 2016-12-02 20:40 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-12-02 21:10 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Linus Torvalds <torvalds@linux-foundation.org> - 2016-12-02 18:40 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andy Lutomirski <luto@kernel.org> - 2016-12-02 18:40 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Borislav Petkov <bp@kernel.org> - 2016-12-02 19:20 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Linus Torvalds <torvalds@linux-foundation.org> - 2016-12-02 19:30 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Borislav Petkov <bp@kernel.org> - 2016-12-02 20:00 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Linus Torvalds <torvalds@linux-foundation.org> - 2016-12-02 20:10 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Linus Torvalds <torvalds@linux-foundation.org> - 2016-12-02 20:30 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Borislav Petkov <bp@alien8.de> - 2016-12-02 20:30 +0100
[PATCH] x86/alternatives: Do not use sync_core() to serialize I$ Borislav Petkov <bp@alien8.de> - 2016-12-03 16:10 +0100
Re: [PATCH] x86/alternatives: Do not use sync_core() to serialize I$ Andy Lutomirski <luto@amacapital.net> - 2016-12-03 18:20 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Linus Torvalds <torvalds@linux-foundation.org> - 2016-12-02 20:40 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andy Lutomirski <luto@amacapital.net> - 2016-12-02 21:50 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Linus Torvalds <torvalds@linux-foundation.org> - 2016-12-02 22:20 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andy Lutomirski <luto@amacapital.net> - 2016-12-03 00:00 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Linus Torvalds <torvalds@linux-foundation.org> - 2016-12-03 00:20 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andy Lutomirski <luto@amacapital.net> - 2016-12-02 20:40 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andy Lutomirski <luto@amacapital.net> - 2016-12-02 20:30 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Borislav Petkov <bp@alien8.de> - 2016-12-02 20:40 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Borislav Petkov <bp@alien8.de> - 2016-12-02 20:30 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Linus Torvalds <torvalds@linux-foundation.org> - 2016-12-02 19:20 +0100
Re: [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Borislav Petkov <bp@alien8.de> - 2016-12-03 13:50 +0100
[PATCH v2 2/6] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing" Andy Lutomirski <luto@kernel.org> - 2016-12-02 01:40 +0100
Re: [PATCH 0/4] CPUID-less CPU fixes and improvements Andy Lutomirski <luto@amacapital.net> - 2016-12-02 01:40 +0100
Re: [PATCH 0/4] CPUID-less CPU fixes and improvements Ingo Molnar <mingo@kernel.org> - 2016-12-02 11:20 +0100
[PATCH v2 0/6] CPUID-less CPU/sync_core fixes and improvements Andy Lutomirski <luto@kernel.org> - 2016-12-02 01:40 +0100
[PATCH v2 1/6] x86/asm/32: Make sync_core() handle missing CPUID on all 32-bit kernels Andy Lutomirski <luto@kernel.org> - 2016-12-02 01:40 +0100
csiph-web