]> Git Repo - linux.git/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next
authorLinus Torvalds <[email protected]>
Tue, 3 Apr 2018 21:08:58 +0000 (14:08 -0700)
committerLinus Torvalds <[email protected]>
Tue, 3 Apr 2018 21:08:58 +0000 (14:08 -0700)
Pull sparc updates from David Miller:

 1) Add support for ADI (Application Data Integrity) found in more
    recent sparc64 cpus. Essentially this is keyed based access to
    virtual memory, and if the key encoded in the virual address is
    wrong you get a trap.

    The mm changes were reviewed by Andrew Morton and others.

    Work by Khalid Aziz.

 2) Validate DAX completion index range properly, from Rob Gardner.

 3) Add proper Kconfig deps for DAX driver. From Guenter Roeck.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next:
  sparc64: Make atomic_xchg() an inline function rather than a macro.
  sparc64: Properly range check DAX completion index
  sparc: Make auxiliary vectors for ADI available on 32-bit as well
  sparc64: Oracle DAX driver depends on SPARC64
  sparc64: Update signal delivery to use new helper functions
  sparc64: Add support for ADI (Application Data Integrity)
  mm: Allow arch code to override copy_highpage()
  mm: Clear arch specific VM flags on protection change
  mm: Add address parameter to arch_validate_prot()
  sparc64: Add auxiliary vectors to report platform ADI properties
  sparc64: Add handler for "Memory Corruption Detected" trap
  sparc64: Add HV fault type handlers for ADI related faults
  sparc64: Add support for ADI register fields, ASIs and traps
  mm, swap: Add infrastructure for saving page metadata on swap
  signals, sparc: Add signal codes for ADI violations

1  2 
arch/powerpc/kernel/syscalls.c
include/asm-generic/pgtable.h
include/linux/mm.h
include/uapi/asm-generic/siginfo.h

index 1ef3b80b62a6cba0a983ccfc70b3ad02a665f2b6,6d90ddbd2d1163d7d18b4a6fb1b189b60ce4437b..466216506eb2f4bfa7b6b94ed89140914b1ea682
@@@ -48,7 -48,7 +48,7 @@@ static inline long do_mmap2(unsigned lo
  {
        long ret = -EINVAL;
  
-       if (!arch_validate_prot(prot))
+       if (!arch_validate_prot(prot, addr))
                goto out;
  
        if (shift) {
@@@ -57,7 -57,7 +57,7 @@@
                off >>= shift;
        }
  
 -      ret = sys_mmap_pgoff(addr, len, prot, flags, fd, off);
 +      ret = ksys_mmap_pgoff(addr, len, prot, flags, fd, off);
  out:
        return ret;
  }
@@@ -119,8 -119,8 +119,8 @@@ long ppc64_personality(unsigned long pe
  long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low,
                      u32 len_high, u32 len_low)
  {
 -      return sys_fadvise64(fd, (u64)offset_high << 32 | offset_low,
 -                           (u64)len_high << 32 | len_low, advice);
 +      return ksys_fadvise64_64(fd, (u64)offset_high << 32 | offset_low,
 +                               (u64)len_high << 32 | len_low, advice);
  }
  
  long sys_switch_endian(void)
index bfbb44a5ad38965f00c82b19135b3d81ab20142d,6fbbc0b6c05ec1ffb851b5f4296a65d9aa845332..f59639afaa3908dbcaa06cec9defc8837cba09ee
@@@ -400,6 -400,42 +400,42 @@@ static inline int pud_same(pud_t pud_a
  #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
  #endif
  
+ #ifndef __HAVE_ARCH_DO_SWAP_PAGE
+ /*
+  * Some architectures support metadata associated with a page. When a
+  * page is being swapped out, this metadata must be saved so it can be
+  * restored when the page is swapped back in. SPARC M7 and newer
+  * processors support an ADI (Application Data Integrity) tag for the
+  * page as metadata for the page. arch_do_swap_page() can restore this
+  * metadata when a page is swapped back in.
+  */
+ static inline void arch_do_swap_page(struct mm_struct *mm,
+                                    struct vm_area_struct *vma,
+                                    unsigned long addr,
+                                    pte_t pte, pte_t oldpte)
+ {
+ }
+ #endif
+ #ifndef __HAVE_ARCH_UNMAP_ONE
+ /*
+  * Some architectures support metadata associated with a page. When a
+  * page is being swapped out, this metadata must be saved so it can be
+  * restored when the page is swapped back in. SPARC M7 and newer
+  * processors support an ADI (Application Data Integrity) tag for the
+  * page as metadata for the page. arch_unmap_one() can save this
+  * metadata on a swap-out of a page.
+  */
+ static inline int arch_unmap_one(struct mm_struct *mm,
+                                 struct vm_area_struct *vma,
+                                 unsigned long addr,
+                                 pte_t orig_pte)
+ {
+       return 0;
+ }
+ #endif
  #ifndef __HAVE_ARCH_PGD_OFFSET_GATE
  #define pgd_offset_gate(mm, addr)     pgd_offset(mm, addr)
  #endif
@@@ -983,8 -1019,6 +1019,8 @@@ int pud_set_huge(pud_t *pud, phys_addr_
  int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot);
  int pud_clear_huge(pud_t *pud);
  int pmd_clear_huge(pmd_t *pmd);
 +int pud_free_pmd_page(pud_t *pud);
 +int pmd_free_pte_page(pmd_t *pmd);
  #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
  static inline int p4d_set_huge(p4d_t *p4d, phys_addr_t addr, pgprot_t prot)
  {
@@@ -1010,14 -1044,6 +1046,14 @@@ static inline int pmd_clear_huge(pmd_t 
  {
        return 0;
  }
 +static inline int pud_free_pmd_page(pud_t *pud)
 +{
 +      return 0;
 +}
 +static inline int pmd_free_pte_page(pmd_t *pmd)
 +{
 +      return 0;
 +}
  #endif        /* CONFIG_HAVE_ARCH_HUGE_VMAP */
  
  #ifndef __HAVE_ARCH_FLUSH_PMD_TLB_RANGE
diff --combined include/linux/mm.h
index ccac10682ce58f841c63dca476824423468bfb22,32fe6919a11bfcb8fd975c9b85ff3b569ab08010..f945dff34925b3d4b67fa9abb911cbd62aaac091
@@@ -241,8 -241,13 +241,11 @@@ extern unsigned int kobjsize(const voi
  # define VM_SAO               VM_ARCH_1       /* Strong Access Ordering (powerpc) */
  #elif defined(CONFIG_PARISC)
  # define VM_GROWSUP   VM_ARCH_1
 -#elif defined(CONFIG_METAG)
 -# define VM_GROWSUP   VM_ARCH_1
  #elif defined(CONFIG_IA64)
  # define VM_GROWSUP   VM_ARCH_1
+ #elif defined(CONFIG_SPARC64)
+ # define VM_SPARC_ADI VM_ARCH_1       /* Uses ADI tag for access control */
+ # define VM_ARCH_CLEAR        VM_SPARC_ADI
  #elif !defined(CONFIG_MMU)
  # define VM_MAPPED_COPY       VM_ARCH_1       /* T if mapped copy of data (nommu mmap) */
  #endif
  /* This mask is used to clear all the VMA flags used by mlock */
  #define VM_LOCKED_CLEAR_MASK  (~(VM_LOCKED | VM_LOCKONFAULT))
  
+ /* Arch-specific flags to clear when updating VM flags on protection change */
+ #ifndef VM_ARCH_CLEAR
+ # define VM_ARCH_CLEAR        VM_NONE
+ #endif
+ #define VM_FLAGS_CLEAR        (ARCH_VM_PKEY_FLAGS | VM_ARCH_CLEAR)
  /*
   * mapping from the currently active vm_flags protection bits (the
   * low four bits) to a page protection mask..
index 5528cdb0b54acad27c1972ac2448cbebfd50947f,a01fd0a92b1bd111ea64bbd729fb74312814b1c2..73ae06b67051c3dc65605da838e7b96c16d657cb
@@@ -179,16 -179,33 +179,16 @@@ typedef struct siginfo 
   * SIGILL si_codes
   */
  #define ILL_ILLOPC    1       /* illegal opcode */
 -#ifdef __bfin__
 -# define ILL_ILLPARAOP        2       /* illegal opcode combine */
 -#endif
  #define ILL_ILLOPN    2       /* illegal operand */
  #define ILL_ILLADR    3       /* illegal addressing mode */
  #define ILL_ILLTRP    4       /* illegal trap */
 -#ifdef __bfin__
 -# define ILL_ILLEXCPT 4       /* unrecoverable exception */
 -#endif
  #define ILL_PRVOPC    5       /* privileged opcode */
  #define ILL_PRVREG    6       /* privileged register */
  #define ILL_COPROC    7       /* coprocessor error */
  #define ILL_BADSTK    8       /* internal stack error */
 -#ifdef __bfin__
 -# define ILL_CPLB_VI  9       /* D/I CPLB protect violation */
 -# define ILL_CPLB_MISS        10      /* D/I CPLB miss */
 -# define ILL_CPLB_MULHIT 11   /* D/I CPLB multiple hit */
 -#endif
 -#ifdef __tile__
 -# define ILL_DBLFLT   9       /* double fault */
 -# define ILL_HARDWALL 10      /* user networks hardwall violation */
 -#endif
 -#ifdef __ia64__
 -# define ILL_BADIADDR 9       /* unimplemented instruction address */
 -# define __ILL_BREAK  10      /* illegal break */
 -# define __ILL_BNDMOD 11      /* bundle-update (modification) in progress */
 -#endif
 +#define ILL_BADIADDR  9       /* unimplemented instruction address */
 +#define __ILL_BREAK   10      /* illegal break */
 +#define __ILL_BNDMOD  11      /* bundle-update (modification) in progress */
  #define NSIGILL               11
  
  /*
  #define FPE_FLTRES    6       /* floating point inexact result */
  #define FPE_FLTINV    7       /* floating point invalid operation */
  #define FPE_FLTSUB    8       /* subscript out of range */
 -#ifdef __frv__
 -# define FPE_MDAOVF   9       /* media overflow */
 -#endif
 -#ifdef __ia64__
 -# define __FPE_DECOVF 9       /* decimal overflow */
 -# define __FPE_DECDIV 10      /* decimal division by zero */
 -# define __FPE_DECERR 11      /* packed decimal error */
 -# define __FPE_INVASC 12      /* invalid ASCII digit */
 -# define __FPE_INVDEC 13      /* invalid decimal digit */
 -#endif
 +#define __FPE_DECOVF  9       /* decimal overflow */
 +#define __FPE_DECDIV  10      /* decimal division by zero */
 +#define __FPE_DECERR  11      /* packed decimal error */
 +#define __FPE_INVASC  12      /* invalid ASCII digit */
 +#define __FPE_INVDEC  13      /* invalid decimal digit */
  #define NSIGFPE               13
  
  /*
   */
  #define SEGV_MAPERR   1       /* address not mapped to object */
  #define SEGV_ACCERR   2       /* invalid permissions for mapped object */
 -#ifdef __bfin__
 -# define SEGV_STACKFLOW       3       /* stack overflow */
 -#else
 -# define SEGV_BNDERR  3       /* failed address bound checks */
 -#endif
 +#define SEGV_BNDERR   3       /* failed address bound checks */
  #ifdef __ia64__
  # define __SEGV_PSTKOVF       4       /* paragraph stack overflow */
  #else
  # define SEGV_PKUERR  4       /* failed protection key checks */
  #endif
- #define NSIGSEGV      4
+ #define SEGV_ACCADI   5       /* ADI not enabled for mapped object */
+ #define SEGV_ADIDERR  6       /* Disrupting MCD error */
+ #define SEGV_ADIPERR  7       /* Precise MCD exception */
+ #define NSIGSEGV      7
  
  /*
   * SIGBUS si_codes
  #define BUS_ADRALN    1       /* invalid address alignment */
  #define BUS_ADRERR    2       /* non-existent physical address */
  #define BUS_OBJERR    3       /* object specific hardware error */
 -#ifdef __bfin__
 -# define BUS_OPFETCH  4       /* error from instruction fetch */
 -#else
  /* hardware memory error consumed on a machine check: action required */
 -# define BUS_MCEERR_AR        4
 -#endif
 +#define BUS_MCEERR_AR 4
  /* hardware memory error detected in process but not consumed: action optional*/
  #define BUS_MCEERR_AO 5
  #define NSIGBUS               5
  #define TRAP_TRACE    2       /* process trace trap */
  #define TRAP_BRANCH     3     /* process taken branch trap */
  #define TRAP_HWBKPT     4     /* hardware breakpoint/watchpoint */
 -#ifdef __bfin__
 -# define TRAP_STEP    1       /* single-step breakpoint */
 -# define TRAP_TRACEFLOW       2       /* trace buffer overflow */
 -# define TRAP_WATCHPT 3       /* watchpoint match */
 -# define TRAP_ILLTRAP 4       /* illegal trap */
 -#endif
  #define NSIGTRAP      4
  
  /*
This page took 0.081595 seconds and 4 git commands to generate.