From: Mike Rapoport Date: Mon, 26 Oct 2020 09:05:26 +0000 Subject: Re: [PATCH 0/4] arch, mm: improve robustness of direct map manipulation Message-Id: <20201026090526.GA1154158@kernel.org> List-Id: References: <20201025101555.3057-1-rppt@kernel.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: "Edgecombe, Rick P" Cc: "benh@kernel.crashing.org" , "david@redhat.com" , "peterz@infradead.org" , "catalin.marinas@arm.com" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "paulus@samba.org" , "pavel@ucw.cz" , "hpa@zytor.com" , "sparclinux@vger.kernel.org" , "cl@linux.com" , "will@kernel.org" , "linux-riscv@lists.infradead.org" , "linux-s390@vger.kernel.org" , "mpe@ellerman.id.au" , "x86@kernel.org" , "rppt@linux.ibm.com" , "borntraeger@de.ibm.com" , "mingo@redhat.com" , "rientjes@google.com" , "Brown, Len" , "aou@eecs.berkeley.edu" , "gor@linux.ibm.com" , "linux-pm@vger.kernel.org" , "hca@linux.ibm.com" , "bp@alien8.de" , "luto@kernel.org" , "paul.walmsley@sifive.com" , "kirill@shutemov.name" , "tglx@linutronix.de" , "akpm@linux-foundation.org" , "linux-arm-kernel@lists.infradead.org" , "rjw@rjwysocki.net" , "linux-kernel@vger.kernel.org" , "penberg@kernel.org" , "palmer@dabbelt.com" , "iamjoonsoo.kim@lge.com" , "linuxppc-dev@lists.ozlabs.org" , "davem@davemloft.net" On Mon, Oct 26, 2020 at 01:13:52AM +0000, Edgecombe, Rick P wrote: > On Sun, 2020-10-25 at 12:15 +0200, Mike Rapoport wrote: > > Indeed, for architectures that define CONFIG_ARCH_HAS_SET_DIRECT_MAP > > it is > > possible that __kernel_map_pages() would fail, but since this > > function is > > void, the failure will go unnoticed. > > Could you elaborate on how this could happen? Do you mean during > runtime today or if something new was introduced? A failure in__kernel_map_pages() may happen today. For instance, on x86 if the kernel is built with DEBUG_PAGEALLOC. __kernel_map_pages(page, 1, 0); will need to split, say, 2M page and during the split an allocation of page table could fail. Currently, the only user of __kernel_map_pages() outside DEBUG_PAGEALLOC is hibernation, but I think it would be safer to entirely prevent usage of __kernel_map_pages() when DEBUG_PAGEALLOC=n. -- Sincerely yours, Mike.