|
Message-ID: <d481ec66-8e14-614f-8e33-d381ce606bc5@c-s.fr> Date: Wed, 29 Apr 2020 07:48:11 +0200 From: Christophe Leroy <christophe.leroy@....fr> To: "Christopher M. Riedl" <cmr@...ormatik.wtf>, linuxppc-dev@...ts.ozlabs.org, kernel-hardening@...ts.openwall.com Subject: Re: [RFC PATCH v2 1/5] powerpc/mm: Introduce temporary mm Le 29/04/2020 à 04:05, Christopher M. Riedl a écrit : > x86 supports the notion of a temporary mm which restricts access to > temporary PTEs to a single CPU. A temporary mm is useful for situations > where a CPU needs to perform sensitive operations (such as patching a > STRICT_KERNEL_RWX kernel) requiring temporary mappings without exposing > said mappings to other CPUs. A side benefit is that other CPU TLBs do > not need to be flushed when the temporary mm is torn down. > > Mappings in the temporary mm can be set in the userspace portion of the > address-space. > > Interrupts must be disabled while the temporary mm is in use. HW > breakpoints, which may have been set by userspace as watchpoints on > addresses now within the temporary mm, are saved and disabled when > loading the temporary mm. The HW breakpoints are restored when unloading > the temporary mm. All HW breakpoints are indiscriminately disabled while > the temporary mm is in use. Why do we need to use a temporary mm all the time ? Doesn't each CPU have its own mm already ? Only the upper address space is shared between all mm's but each mm has its own lower address space, at least when it is running a user process. Why not just use that mm ? As we are mapping then unmapping with interrupts disabled, there is no risk at all that the user starts running while the patch page is mapped, so I'm not sure why switching to a temporary mm is needed. > > Based on x86 implementation: > > commit cefa929c034e > ("x86/mm: Introduce temporary mm structs") > > Signed-off-by: Christopher M. Riedl <cmr@...ormatik.wtf> Christophe
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.