Skip to content

Commit

Permalink
Merge tag 'powerpc-5.10-6' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/powerpc/linux

Pull powerpc fix from Michael Ellerman:
 "One commit to implement copy_from_kernel_nofault_allowed(), otherwise
  copy_from_kernel_nofault() can trigger warnings when accessing bad
  addresses in some configurations.

  Thanks to Christophe Leroy and Qian Cai"

* tag 'powerpc-5.10-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/mm: Fix KUAP warning by providing copy_from_kernel_nofault_allowed()
  • Loading branch information
torvalds committed Dec 11, 2020
2 parents 197c61c + 5eedf9f commit 47003b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arch/powerpc/mm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)

obj-y := fault.o mem.o pgtable.o mmap.o \
obj-y := fault.o mem.o pgtable.o mmap.o maccess.o \
init_$(BITS).o pgtable_$(BITS).o \
pgtable-frag.o ioremap.o ioremap_$(BITS).o \
init-common.o mmu_context.o drmem.o
Expand Down
9 changes: 9 additions & 0 deletions arch/powerpc/mm/maccess.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-only

#include <linux/uaccess.h>
#include <linux/kernel.h>

bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size)
{
return is_kernel_addr((unsigned long)unsafe_src);
}

0 comments on commit 47003b9

Please sign in to comment.