Linked by Thom Holwerda on Wed 3rd Jan 2018 00:42 UTC
Intel

A fundamental design flaw in Intel's processor chips has forced a significant redesign of the Linux and Windows kernels to defang the chip-level security bug.

Programmers are scrambling to overhaul the open-source Linux kernel's virtual memory system. Meanwhile, Microsoft is expected to publicly introduce the necessary changes to its Windows operating system in an upcoming Patch Tuesday: these changes were seeded to beta testers running fast-ring Windows Insider builds in November and December.

Crucially, these updates to both Linux and Windows will incur a performance hit on Intel products. The effects are still being benchmarked, however we're looking at a ballpark figure of five to 30 per cent slow down, depending on the task and the processor model. More recent Intel chips have features - such as PCID - to reduce the performance hit.

That's one hell of a bug.

Permalink for comment 652449
To read all comments associated with this story, please click here.
RE[2]: Overhyped
by Brendan on Wed 3rd Jan 2018 10:26 UTC in reply to "RE: Overhyped"
Brendan
Member since:
2005-11-16

Hi,

"Note that the insane hackery to avoid this non-issue adds significant overhead to kernel system calls; ironically, making the performance of monolithic kernels worse than the performance of micro-kernels (while still providing inferior security than micro-kernels). The insane hackery doesn't entirely fix the "problem" either (a small part of kernel must remain mapped, and an attacker can still find out where in kernel space that small part of the kernel is and use this information to infer where the rest of the kernel is)."

Please do not claim bogus. Microkernels fixed against this defect will in fact take a higher hit than a monolithic kernel. Kernel to usermode switching cost increases when you have to change complete page tables every single time changing from kernel to userspace and back. Microkernel do this way more often than Monolithic. The advantage of running drivers in kernel space.


Completely changing page tables is expensive. Windows and Linux will be doing this for every system call and every IRQ. For things that don't involve a driver (all scheduling, all memory management, etc) a micro-kernel won't change page tables (because there's "almost nothing" in kernel-space, and certainly no encryption keys or passwords or other sensitive data, and therefore there's no reason to bother) but the monolithic kernels will. This is the main reason that (after patches) monolithic kernels will be slower than micro-kernels.

For things that do involve a device driver, a micro-kernel and a monolithic kernel both change page tables and end up "similar". However, micro-kernels are *designed* knowing that there will be context switching costs and therefore the designers design everything to reduce/mitigate those costs (including things like postponing task switches in the hope of "one task switch instead of many" and things like having a single "do this list of things" message rather than doing one little thing per message). Monolithic kernels were never designed to mitigate these costs. This is the other reason that monolithic kernels will be slower than micro-kernels.

Note: the "address space ID" feature reduces the cost of changing page tables for both monolithic and micro-kernel; and therefore doesn't make monolithic (with these patches) "less worse" in comparison.

This is not exactly a non issue. The fact userspace ring is interfering was able to detect kernel space pages was found in 2016. Now kernel space pages with wrong protective bits for any reason are also exposed due to that fault.


Those were exposed anyway (just use a "for each page (try something)" loop and ignore any page faults).

Small fragment mapped of kernel mapped in userspace does not provide enough information to work out the randomisation. Complete kernel mapped into userspace as Intel CPU have been doing down right does.


That's not how it works. You have a virtual address space where user-space is in one area of the virtual address space and kernel is in another area, and where these areas are separated by privilege levels. Kernel has never been mapped into user-space.

Small fragment mapped into user-space on independent page tables does not mean there is any relationship of that information once you enter kernel mode and switch to kernel mode TLB.

Also this mapping fix to work around Intel MMU/CPU design issue applied to a Microkernel in fact hurts worst. It some ways it explains why AMD cpu have been slightly slower in particular benchmarks.

Yes AMD MMU/CPU if you attempt to access ring 0 pages from ring 1-3 and they have not been mapped for you its not happening. Same with ring 1 from ring 2 and 3.

So that KASLR attack from 2016 did not work on AMD CPUs. So finding extra protection flaws also have no effect on AMD CPU because the KASLR attack from 2016 does not work. Its not that the AMD has different timing is better page memory rules enforced by hardware so most of the kernel ring 0 pages are basically non existent to the userspace code.

Really this is another reason why in the past it was require by the USA Mil for anything they acquired to come 3 vendors using compatible sockets. So a vendor glitch like this could have been fixed by changing chips.

There is security by obscurity and there is no be there. No be there is better. AMD cpu/mmu is doing no be there so userspace could not see all of the kernel space ring 0 pages and this makes solving the address randomisation of kernel next to impossible.

Intel was depending on obscurity that no one would hunt the memory and find out that complete kernel space pages and userspace pages were in fact exposed to userspace program. Then Intel prayed that memory protection settings would always be enforced and correct. There turned up a few case in 2017 where the memory protections were not always on. So now you have kernel pages exposed to userspace and userspace able to write them how can you say mega failure.

Implementing two page tables one for kernel space and one for userspace is about the only valid way to work around intel goof up. Please note this kind of fault dates back to the 286. All the AMD processors with built in MMU have had different behaviour so preventing the problem.


Intel wasn't depending on obscurity - they didn't invent or implement "kernel address space randomisation". This probably came from one of the "hardened Linux" groups (SELinux? Grsecurity?) before being adopted in "mainline Linux" (and cloned by Microsoft).

As far as I know this problem *might* effect Pentium III and newer (and might only effect Broadwell and newer - details are hard to find). It does not effect 80286, 80386, 80486 or Pentium. 80286 doesn't even support paging (and doesn't do speculative execution either).

Don't forget that recent ARM CPUs are also effected - it's not just "Intel's goof up" (this time).

- Brendan

Reply Parent Score: 3