Commit 997b611b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull parisc updates from Helge Deller:
 "Changes include:

   - Fix boot of 32bit SMP kernel (initial kernel mapping was too small)

   - Added hardened usercopy checks

   - Drop bootmem and switch to memblock and NO_BOOTMEM implementation

   - Drop the BROKEN_RODATA config option (and thus remove the relevant
     code from the generic headers and files because parisc was the last
     architecture which used this config option)

   - Improve segfault reporting by printing human readable error strings

   - Various smaller changes, e.g. dwarf debug support for assembly
     code, update comments regarding copy_user_page_asm, switch to
     kmalloc_array()"

* 'parisc-4.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  parisc: Increase KERNEL_INITIAL_SIZE for 32-bit SMP kernels
  parisc: Drop bootmem and switch to memblock
  parisc: Add hardened usercopy feature
  parisc: Add cfi_startproc and cfi_endproc to assembly code
  parisc: Move hpmc stack into page aligned bss section
  parisc: Fix self-detected CPU stall warnings on Mako machines
  parisc: Report trap type as human readable string
  parisc: Update comment regarding implementation of copy_user_page_asm
  parisc: Use kmalloc_array() in add_system_map_addresses()
  parisc: Check return value of smp_boot_one_cpu()
  parisc: Drop BROKEN_RODATA config option
parents 2c34ff14 690d097c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -10,12 +10,13 @@ config PARISC
	select RTC_CLASS
	select RTC_DRV_GENERIC
	select INIT_ALL_POSSIBLE
	select HAVE_MEMBLOCK
	select NO_BOOTMEM
	select BUG
	select BUILDTIME_EXTABLE_SORT
	select HAVE_PERF_EVENTS
	select GENERIC_ATOMIC64 if !64BIT
	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
	select BROKEN_RODATA
	select GENERIC_IRQ_PROBE
	select GENERIC_PCI_IOMAP
	select ARCH_HAVE_NMI_SAFE_CMPXCHG
@@ -24,6 +25,7 @@ config PARISC
	select SYSCTL_ARCH_UNALIGN_ALLOW
	select SYSCTL_EXCEPTION_TRACE
	select HAVE_MOD_ARCH_SPECIFIC
	select HAVE_ARCH_HARDENED_USERCOPY
	select VIRT_TO_BUS
	select MODULES_USE_ELF_RELA
	select CLONE_BACKWARDS
+23 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 Helge Deller <deller@gmx.de>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef _ASM_PARISC_DWARF_H
#define _ASM_PARISC_DWARF_H

#ifdef __ASSEMBLY__

#define CFI_STARTPROC	.cfi_startproc
#define CFI_ENDPROC	.cfi_endproc
#define CFI_DEF_CFA	.cfi_def_cfa
#define CFI_REGISTER	.cfi_register
#define CFI_REL_OFFSET	.cfi_rel_offset
#define CFI_UNDEFINED	.cfi_undefined

#endif	/* __ASSEMBLY__ */

#endif	/* _ASM_PARISC_DWARF_H */
+12 −0
Original line number Diff line number Diff line
#ifndef __ASM_PARISC_LINKAGE_H
#define __ASM_PARISC_LINKAGE_H

#include <asm/dwarf.h>

#ifndef __ALIGN
#define __ALIGN         .align 4
#define __ALIGN_STR     ".align 4"
@@ -10,6 +12,8 @@
 * In parisc assembly a semicolon marks a comment while a
 * exclamation mark is used to separate independent lines.
 */
#define ASM_NL	!

#ifdef __ASSEMBLY__

#define ENTRY(name) \
@@ -26,6 +30,14 @@ name:
	END(name)
#endif

#define ENTRY_CFI(name) \
	ENTRY(name)	ASM_NL\
	CFI_STARTPROC

#define ENDPROC_CFI(name) \
	ENDPROC(name)	ASM_NL\
	CFI_ENDPROC

#endif /* __ASSEMBLY__ */

#endif  /* __ASM_PARISC_LINKAGE_H */
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
	printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, (unsigned long)pgd_val(e))

/* This is the size of the initially mapped kernel memory */
#ifdef CONFIG_64BIT
#if defined(CONFIG_64BIT) || defined(CONFIG_SMP)
#define KERNEL_INITIAL_ORDER	25	/* 1<<25 = 32MB */
#else
#define KERNEL_INITIAL_ORDER	24	/* 1<<24 = 16MB */
+34 −14
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@

#include <linux/bug.h>
#include <linux/string.h>
#include <linux/thread_info.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1
@@ -201,10 +202,12 @@ extern long lstrnlen_user(const char __user *, long);
#define clear_user lclear_user
#define __clear_user lclear_user

unsigned long copy_to_user(void __user *dst, const void *src, unsigned long len);
#define __copy_to_user copy_to_user
unsigned long __copy_from_user(void *dst, const void __user *src, unsigned long len);
unsigned long copy_in_user(void __user *dst, const void __user *src, unsigned long len);
unsigned long __must_check __copy_to_user(void __user *dst, const void *src,
					  unsigned long len);
unsigned long __must_check __copy_from_user(void *dst, const void __user *src,
					  unsigned long len);
unsigned long copy_in_user(void __user *dst, const void __user *src,
			   unsigned long len);
#define __copy_in_user copy_in_user
#define __copy_to_user_inatomic __copy_to_user
#define __copy_from_user_inatomic __copy_from_user
@@ -217,25 +220,42 @@ static inline void copy_user_overflow(int size, unsigned long count)
	WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);
}

static inline unsigned long __must_check copy_from_user(void *to,
                                          const void __user *from,
                                          unsigned long n)
static __always_inline unsigned long __must_check
copy_from_user(void *to, const void __user *from, unsigned long n)
{
	int sz = __compiletime_object_size(to);
	unsigned long ret = n;

        if (likely(sz == -1 || sz >= n))
	if (likely(sz < 0 || sz >= n)) {
		check_object_size(to, n, false);
		ret = __copy_from_user(to, from, n);
        else if (!__builtin_constant_p(n))
	} else if (!__builtin_constant_p(n))
		copy_user_overflow(sz, n);
	else
		__bad_copy_user();

	if (unlikely(ret))
		memset(to + (n - ret), 0, ret);

	return ret;
}

static __always_inline unsigned long __must_check
copy_to_user(void __user *to, const void *from, unsigned long n)
{
	int sz = __compiletime_object_size(from);

	if (likely(sz < 0 || sz >= n)) {
		check_object_size(from, n, true);
		n = __copy_to_user(to, from, n);
	} else if (!__builtin_constant_p(n))
		copy_user_overflow(sz, n);
	else
		__bad_copy_user();

	return n;
}

struct pt_regs;
int fixup_exception(struct pt_regs *regs);

Loading