Skip to content

Commit

Permalink
Merge tag 'powerpc-5.2-1' of ssh://gitolite.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/powerpc/linux

Pull powerpc updates from Michael Ellerman:
 "Slightly delayed due to the issue with printk() calling
  probe_kernel_read() interacting with our new user access prevention
  stuff, but all fixed now.

  The only out-of-area changes are the addition of a cpuhp_state, small
  additions to Documentation and MAINTAINERS updates.

  Highlights:

   - Support for Kernel Userspace Access/Execution Prevention (like
     SMAP/SMEP/PAN/PXN) on some 64-bit and 32-bit CPUs. This prevents
     the kernel from accidentally accessing userspace outside
     copy_to/from_user(), or ever executing userspace.

   - KASAN support on 32-bit.

   - Rework of where we map the kernel, vmalloc, etc. on 64-bit hash to
     use the same address ranges we use with the Radix MMU.

   - A rewrite into C of large parts of our idle handling code for
     64-bit Book3S (ie. power8 & power9).

   - A fast path entry for syscalls on 32-bit CPUs, for a 12-17% speedup
     in the null_syscall benchmark.

   - On 64-bit bare metal we have support for recovering from errors
     with the time base (our clocksource), however if that fails
     currently we hang in __delay() and never crash. We now have support
     for detecting that case and short circuiting __delay() so we at
     least panic() and reboot.

   - Add support for optionally enabling the DAWR on Power9, which had
     to be disabled by default due to a hardware erratum. This has the
     effect of enabling hardware breakpoints for GDB, the downside is a
     badly behaved program could crash the machine by pointing the DAWR
     at cache inhibited memory. This is opt-in obviously.

   - xmon, our crash handler, gets support for a read only mode where
     operations that could change memory or otherwise disturb the system
     are disabled.

  Plus many clean-ups, reworks and minor fixes etc.

  Thanks to: Christophe Leroy, Akshay Adiga, Alastair D'Silva, Alexey
  Kardashevskiy, Andrew Donnellan, Aneesh Kumar K.V, Anju T Sudhakar,
  Anton Blanchard, Ben Hutchings, Bo YU, Breno Leitao, Cédric Le Goater,
  Christopher M. Riedl, Christoph Hellwig, Colin Ian King, David Gibson,
  Ganesh Goudar, Gautham R. Shenoy, George Spelvin, Greg Kroah-Hartman,
  Greg Kurz, Horia Geantă, Jagadeesh Pagadala, Joel Stanley, Joe
  Perches, Julia Lawall, Laurentiu Tudor, Laurent Vivier, Lukas Bulwahn,
  Madhavan Srinivasan, Mahesh Salgaonkar, Mathieu Malaterre, Michael
  Neuling, Mukesh Ojha, Nathan Fontenot, Nathan Lynch, Nicholas Piggin,
  Nick Desaulniers, Oliver O'Halloran, Peng Hao, Qian Cai, Ravi
  Bangoria, Rick Lindsley, Russell Currey, Sachin Sant, Stewart Smith,
  Sukadev Bhattiprolu, Thomas Huth, Tobin C. Harding, Tyrel Datwyler,
  Valentin Schneider, Wei Yongjun, Wen Yang, YueHaibing"

* tag 'powerpc-5.2-1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (205 commits)
  powerpc/64s: Use early_mmu_has_feature() in set_kuap()
  powerpc/book3s/64: check for NULL pointer in pgd_alloc()
  powerpc/mm: Fix hugetlb page initialization
  ocxl: Fix return value check in afu_ioctl()
  powerpc/mm: fix section mismatch for setup_kup()
  powerpc/mm: fix redundant inclusion of pgtable-frag.o in Makefile
  powerpc/mm: Fix makefile for KASAN
  powerpc/kasan: add missing/lost Makefile
  selftests/powerpc: Add a signal fuzzer selftest
  powerpc/booke64: set RI in default MSR
  ocxl: Provide global MMIO accessors for external drivers
  ocxl: move event_fd handling to frontend
  ocxl: afu_irq only deals with IRQ IDs, not offsets
  ocxl: Allow external drivers to use OpenCAPI contexts
  ocxl: Create a clear delineation between ocxl backend & frontend
  ocxl: Don't pass pci_dev around
  ocxl: Split pci.c
  ocxl: Remove some unused exported symbols
  ocxl: Remove superfluous 'extern' from headers
  ocxl: read_pasid never returns an error, so make it void
  ...
  • Loading branch information
torvalds committed May 10, 2019
2 parents 8ea5b2a + 8150a15 commit b970afc
Show file tree
Hide file tree
Showing 247 changed files with 7,819 additions and 4,558 deletions.
4 changes: 2 additions & 2 deletions Documentation/admin-guide/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2875,11 +2875,11 @@
noexec=on: enable non-executable mappings (default)
noexec=off: disable non-executable mappings

nosmap [X86]
nosmap [X86,PPC]
Disable SMAP (Supervisor Mode Access Prevention)
even if it is supported by processor.

nosmep [X86]
nosmep [X86,PPC]
Disable SMEP (Supervisor Mode Execution Prevention)
even if it is supported by processor.

Expand Down
40 changes: 36 additions & 4 deletions Documentation/powerpc/DAWR-POWER9.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
DAWR issues on POWER9
============================

On POWER9 the DAWR can cause a checkstop if it points to cache
inhibited (CI) memory. Currently Linux has no way to disinguish CI
memory when configuring the DAWR, so (for now) the DAWR is disabled by
this commit:
On POWER9 the Data Address Watchpoint Register (DAWR) can cause a checkstop
if it points to cache inhibited (CI) memory. Currently Linux has no way to
disinguish CI memory when configuring the DAWR, so (for now) the DAWR is
disabled by this commit:

commit 9654153158d3e0684a1bdb76dbababdb7111d5a0
Author: Michael Neuling <[email protected]>
Expand Down Expand Up @@ -56,3 +56,35 @@ POWER9. Loads and stores to the watchpoint locations will not be
trapped in GDB. The watchpoint is remembered, so if the guest is
migrated back to the POWER8 host, it will start working again.

Force enabling the DAWR
=============================
Kernels (since ~v5.2) have an option to force enable the DAWR via:

echo Y > /sys/kernel/debug/powerpc/dawr_enable_dangerous

This enables the DAWR even on POWER9.

This is a dangerous setting, USE AT YOUR OWN RISK.

Some users may not care about a bad user crashing their box
(ie. single user/desktop systems) and really want the DAWR. This
allows them to force enable DAWR.

This flag can also be used to disable DAWR access. Once this is
cleared, all DAWR access should be cleared immediately and your
machine once again safe from crashing.

Userspace may get confused by toggling this. If DAWR is force
enabled/disabled between getting the number of breakpoints (via
PTRACE_GETHWDBGINFO) and setting the breakpoint, userspace will get an
inconsistent view of what's available. Similarly for guests.

For the DAWR to be enabled in a KVM guest, the DAWR needs to be force
enabled in the host AND the guest. For this reason, this won't work on
POWERVM as it doesn't allow the HCALL to work. Writes of 'Y' to the
dawr_enable_dangerous file will fail if the hypervisor doesn't support
writing the DAWR.

To double check the DAWR is working, run this kernel selftest:
tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c
Any errors/failures/skips mean something is wrong.
13 changes: 6 additions & 7 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -4347,7 +4347,7 @@ F: drivers/net/ethernet/chelsio/cxgb4vf/

CXL (IBM Coherent Accelerator Processor Interface CAPI) DRIVER
M: Frederic Barrat <[email protected]>
M: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
M: Andrew Donnellan <ajd@linux.ibm.com>
L: [email protected]
S: Supported
F: arch/powerpc/platforms/powernv/pci-cxl.c
Expand Down Expand Up @@ -7483,13 +7483,12 @@ S: Supported
F: drivers/net/ethernet/ibm/ibmvnic.*

IBM Power Virtual Accelerator Switchboard
M: Sukadev Bhattiprolu
M: Sukadev Bhattiprolu <[email protected]>
L: [email protected]
S: Supported
F: arch/powerpc/platforms/powernv/vas*
F: arch/powerpc/platforms/powernv/copy-paste.h
F: arch/powerpc/include/asm/vas.h
F: arch/powerpc/include/uapi/asm/vas.h

IBM Power Virtual Ethernet Device Driver
M: Thomas Falcon <[email protected]>
Expand Down Expand Up @@ -7536,14 +7535,14 @@ F: drivers/crypto/vmx/ghash*
F: drivers/crypto/vmx/ppc-xlate.pl

IBM Power PCI Hotplug Driver for RPA-compliant PPC64 platform
M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
M: Tyrel Datwyler <[email protected]>
L: [email protected]
L: [email protected]
S: Supported
F: drivers/pci/hotplug/rpaphp*

IBM Power IO DLPAR Driver for RPA-compliant PPC64 platform
M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
M: Tyrel Datwyler <[email protected]>
L: [email protected]
L: [email protected]
S: Supported
Expand Down Expand Up @@ -10498,7 +10497,7 @@ F: arch/arm/mach-mmp/

MMU GATHER AND TLB INVALIDATION
M: Will Deacon <[email protected]>
M: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
M: "Aneesh Kumar K.V" <[email protected]>
M: Andrew Morton <[email protected]>
M: Nick Piggin <[email protected]>
M: Peter Zijlstra <[email protected]>
Expand Down Expand Up @@ -11299,7 +11298,7 @@ F: tools/objtool/

OCXL (Open Coherent Accelerator Processor Interface OpenCAPI) DRIVER
M: Frederic Barrat <[email protected]>
M: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
M: Andrew Donnellan <ajd@linux.ibm.com>
L: [email protected]
S: Supported
F: arch/powerpc/platforms/powernv/ocxl.c
Expand Down
10 changes: 5 additions & 5 deletions arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ config PPC
select GENERIC_TIME_VSYSCALL
select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_JUMP_LABEL
select HAVE_ARCH_KASAN if PPC32
select HAVE_ARCH_KGDB
select HAVE_ARCH_MMAP_RND_BITS
select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
Expand Down Expand Up @@ -375,7 +376,6 @@ config ZONE_DMA
config PGTABLE_LEVELS
int
default 2 if !PPC64
default 3 if PPC_64K_PAGES && !PPC_BOOK3S_64
default 4

source "arch/powerpc/sysdev/Kconfig"
Expand All @@ -391,7 +391,7 @@ source "kernel/Kconfig.hz"

config HUGETLB_PAGE_SIZE_VARIABLE
bool
depends on HUGETLB_PAGE
depends on HUGETLB_PAGE && PPC_BOOK3S_64
default y

config MATH_EMULATION
Expand Down Expand Up @@ -832,9 +832,9 @@ config CMDLINE_BOOL
bool "Default bootloader kernel arguments"

config CMDLINE
string "Initial kernel command string"
depends on CMDLINE_BOOL
default "console=ttyS0,9600 console=tty0 root=/dev/sda2"
string "Initial kernel command string" if CMDLINE_BOOL
default "console=ttyS0,9600 console=tty0 root=/dev/sda2" if CMDLINE_BOOL
default ""
help
On some platforms, there is currently no way for the boot loader to
pass arguments to the kernel. For these platforms, you can supply
Expand Down
32 changes: 32 additions & 0 deletions arch/powerpc/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ config XMON_DISASSEMBLY
to say Y here, unless you're building for a memory-constrained
system.

config XMON_DEFAULT_RO_MODE
bool "Restrict xmon to read-only operations by default"
depends on XMON
default y
help
Operate xmon in read-only mode. The cmdline options 'xmon=rw' and
'xmon=ro' override this default.

config DEBUGGER
bool
depends on KGDB || XMON
Expand Down Expand Up @@ -361,8 +369,32 @@ config PPC_PTDUMP

If you are unsure, say N.

config PPC_DEBUG_WX
bool "Warn on W+X mappings at boot"
depends on PPC_PTDUMP
help
Generate a warning if any W+X mappings are found at boot.

This is useful for discovering cases where the kernel is leaving
W+X mappings after applying NX, as such mappings are a security risk.

Note that even if the check fails, your kernel is possibly
still fine, as W+X mappings are not a security hole in
themselves, what they do is that they make the exploitation
of other unfixed kernel bugs easier.

There is no runtime or memory usage effect of this option
once the kernel has booted up - it's a one time check.

If in doubt, say "Y".

config PPC_FAST_ENDIAN_SWITCH
bool "Deprecated fast endian-switch syscall"
depends on DEBUG_KERNEL && PPC_BOOK3S_64
help
If you're unsure what this is, say N.

config KASAN_SHADOW_OFFSET
hex
depends on KASAN
default 0xe0000000
15 changes: 10 additions & 5 deletions arch/powerpc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ ifdef CONFIG_PPC_BOOK3S_32
KBUILD_CFLAGS += -mcpu=powerpc
endif

ifeq ($(CROSS_COMPILE),)
KBUILD_DEFCONFIG := $(shell uname -m)_defconfig
else
KBUILD_DEFCONFIG := ppc64_defconfig
endif
# If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise just use
# ppc64_defconfig because we have nothing better to go on.
uname := $(shell uname -m)
KBUILD_DEFCONFIG := $(if $(filter ppc%,$(uname)),$(uname),ppc64)_defconfig

ifdef CONFIG_PPC64
new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
Expand Down Expand Up @@ -367,6 +366,10 @@ ppc32_allmodconfig:
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/book3s_32.config \
-f $(srctree)/Makefile allmodconfig

PHONY += ppc_defconfig
ppc_defconfig:
$(call merge_into_defconfig,book3s_32.config,)

PHONY += ppc64le_allmodconfig
ppc64le_allmodconfig:
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/le.config \
Expand Down Expand Up @@ -406,7 +409,9 @@ vdso_install:
ifdef CONFIG_PPC64
$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@
endif
ifdef CONFIG_VDSO32
$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@
endif

archclean:
$(Q)$(MAKE) $(clean)=$(boot)
Expand Down
6 changes: 5 additions & 1 deletion arch/powerpc/boot/addnote.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ main(int ac, char **av)
PUT_16(E_PHNUM, np + 2);

/* write back */
lseek(fd, (long) 0, SEEK_SET);
i = lseek(fd, (long) 0, SEEK_SET);
if (i < 0) {
perror("lseek");
exit(1);
}
i = write(fd, buf, n);
if (i < 0) {
perror("write");
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/boot/dts/fsl/b4qds.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
interrupt-parent = <&mpic>;

aliases {
crypto = &crypto;
phy_sgmii_10 = &phy_sgmii_10;
phy_sgmii_11 = &phy_sgmii_11;
phy_sgmii_1c = &phy_sgmii_1c;
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/configs/pseries_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ CONFIG_USB_MON=m
CONFIG_USB_EHCI_HCD=y
# CONFIG_USB_EHCI_HCD_PPC_OF is not set
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_STORAGE=m
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=m
Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/configs/skiroot_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ CONFIG_S2IO=m
CONFIG_MLX4_EN=m
# CONFIG_MLX4_CORE_GEN2 is not set
CONFIG_MLX5_CORE=m
CONFIG_MLX5_CORE_EN=y
# CONFIG_MLX5_EN_RXNFC is not set
# CONFIG_NET_VENDOR_MICREL is not set
# CONFIG_NET_VENDOR_MICROSEMI is not set
CONFIG_MYRI10GE=m
Expand Down
10 changes: 3 additions & 7 deletions arch/powerpc/crypto/crc-vpmsum_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,12 @@ static int __init crc_test_init(void)

pr_info("crc-vpmsum_test begins, %lu iterations\n", iterations);
for (i=0; i<iterations; i++) {
size_t len, offset;
size_t offset = prandom_u32_max(16);
size_t len = prandom_u32_max(MAX_CRC_LENGTH);

get_random_bytes(data, MAX_CRC_LENGTH);
get_random_bytes(&len, sizeof(len));
get_random_bytes(&offset, sizeof(offset));

len %= MAX_CRC_LENGTH;
offset &= 15;
if (len <= offset)
continue;
prandom_bytes(data, len);
len -= offset;

crypto_shash_update(crct10dif_shash, data+offset, len);
Expand Down
Loading

0 comments on commit b970afc

Please sign in to comment.