f_evgeny wrote: 05 Jan 2018 17:25
zVlad wrote: 05 Jan 2018 16:41
Согласен с тем что память ядра мапится в пространство пользователя это нормально. Это есть и в zOS тоже. Но в Windows это как-то связано с вызовом системных функций и есть, кaк я понимаю, разные способы имплементации этих вызовов (по крайней мере описания что я читал ссылаюстаы на вызов системной функции перед тем как все становится плохо). Вызов системных функций на System z осуществляется командой SVC и обеспечивает полную изоляцию пользователя от ядра.
Да неважно, что там в Вмндовс или Линукс. Баг в процессоре, и даже не в микрокоде. Баг в том, как я понимаю, что в кэш грузится память до проверки разрешенности чтения а проверка производится в при чтении, и когда мы пытаемся прочитать адрес, который нам запрещен, то происходит исключение, но считанное в кэш значение можно прочитать.
Вообще то там не одна, а три разных причины. Мы, похоже, о разных говорим. Та, о которой Вы говорите, это микрокодовая. Я же в данном случае имел в виду другое:
https://www.theregister.co.uk/2018/01/0 ... sign_flaw/
It allows normal user programs – from database applications to JavaScript in web browsers – to discern to some extent the layout or contents of protected kernel memory areas.
The fix is to separate the kernel's memory completely from user processes using what's called Kernel Page Table Isolation, or KPTI. At one point, Forcefully Unmap Complete Kernel With Interrupt Trampolines, aka FUCKWIT, was mulled by the Linux kernel team, giving you an idea of how annoying this has been for the developers.
Whenever a running program needs to do anything useful – such as write to a file or open a network connection – it has to temporarily hand control of the processor to the kernel to carry out the job. To make the transition from user mode to kernel mode and back to user mode as fast and efficient as possible, the kernel is present in all processes' virtual memory address spaces, although it is invisible to these programs. When the kernel is needed, the program makes a system call, the processor switches to kernel mode and enters the kernel. When it is done, the CPU is told to switch back to user mode, and reenter the process. While in user mode, the kernel's code and data remains out of sight but present in the process's page tables.
Think of the kernel as God sitting on a cloud, looking down on Earth. It's there, and no normal being can see it, yet they can pray to it.
These KPTI patches move the kernel into a completely separate address space, so it's not just invisible to a running process, it's not even there at all. Really, this shouldn't be needed, but clearly there is a flaw in Intel's silicon that allows kernel access protections to be bypassed in some way.
The downside to this separation is that it is relatively expensive, time wise, to keep switching between two separate address spaces for every system call and for every interrupt from the hardware. These context switches do not happen instantly, and they force the processor to dump cached data and reload information from memory. This increases the kernel's overhead, and slows down the computer.
Your Intel-powered machine will run slower as a result.