Commit dcb30e659287a6b40dafed1362532da42ec27229

Authored by Linus Torvalds

Merge tag 'arm64-stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64

Pull ARM64 fixes from Catalin Marinas:
 - Compat register fault reporting fix
 - Documentation clarification on tagged pointers
 - hwcap widened to 64-bit (user space already reading it as 64-bit)

* tag 'arm64-stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64:
  arm64: Widen hwcap to be 64 bit
  arm64: Correctly report LR and SP for compat tasks
  arm64: documentation: tighten up tagged pointer documentation
  arm64: Make do_bad_area() function static

Showing 5 changed files Side-by-side Diff

Documentation/arm64/tagged-pointers.txt
... ... @@ -18,17 +18,17 @@
18 18 parameters containing user virtual addresses *must* have
19 19 their top byte cleared before trapping to the kernel.
20 20  
21   - (2) Tags are not guaranteed to be preserved when delivering
22   - signals. This means that signal handlers in applications
23   - making use of tags cannot rely on the tag information for
24   - user virtual addresses being maintained for fields inside
25   - siginfo_t. One exception to this rule is for signals raised
26   - in response to debug exceptions, where the tag information
  21 + (2) Non-zero tags are not preserved when delivering signals.
  22 + This means that signal handlers in applications making use
  23 + of tags cannot rely on the tag information for user virtual
  24 + addresses being maintained for fields inside siginfo_t.
  25 + One exception to this rule is for signals raised in response
  26 + to watchpoint debug exceptions, where the tag information
27 27 will be preserved.
28 28  
29 29 (3) Special care should be taken when using tagged pointers,
30 30 since it is likely that C compilers will not hazard two
31   - addresses differing only in the upper bits.
  31 + virtual addresses differing only in the upper byte.
32 32  
33 33 The architecture prevents the use of a tagged PC, so the upper byte will
34 34 be set to a sign-extension of bit 55 on exception return.
arch/arm64/include/asm/hwcap.h
... ... @@ -43,7 +43,7 @@
43 43 COMPAT_HWCAP_VFPv3|COMPAT_HWCAP_VFPv4|\
44 44 COMPAT_HWCAP_NEON|COMPAT_HWCAP_IDIV)
45 45  
46   -extern unsigned int elf_hwcap;
  46 +extern unsigned long elf_hwcap;
47 47 #endif
48 48 #endif
arch/arm64/kernel/process.c
... ... @@ -143,15 +143,26 @@
143 143  
144 144 void __show_regs(struct pt_regs *regs)
145 145 {
146   - int i;
  146 + int i, top_reg;
  147 + u64 lr, sp;
147 148  
  149 + if (compat_user_mode(regs)) {
  150 + lr = regs->compat_lr;
  151 + sp = regs->compat_sp;
  152 + top_reg = 12;
  153 + } else {
  154 + lr = regs->regs[30];
  155 + sp = regs->sp;
  156 + top_reg = 29;
  157 + }
  158 +
148 159 show_regs_print_info(KERN_DEFAULT);
149 160 print_symbol("PC is at %s\n", instruction_pointer(regs));
150   - print_symbol("LR is at %s\n", regs->regs[30]);
  161 + print_symbol("LR is at %s\n", lr);
151 162 printk("pc : [<%016llx>] lr : [<%016llx>] pstate: %08llx\n",
152   - regs->pc, regs->regs[30], regs->pstate);
153   - printk("sp : %016llx\n", regs->sp);
154   - for (i = 29; i >= 0; i--) {
  163 + regs->pc, lr, regs->pstate);
  164 + printk("sp : %016llx\n", sp);
  165 + for (i = top_reg; i >= 0; i--) {
155 166 printk("x%-2d: %016llx ", i, regs->regs[i]);
156 167 if (i % 2 == 0)
157 168 printk("\n");
arch/arm64/kernel/setup.c
... ... @@ -57,7 +57,7 @@
57 57 unsigned int processor_id;
58 58 EXPORT_SYMBOL(processor_id);
59 59  
60   -unsigned int elf_hwcap __read_mostly;
  60 +unsigned long elf_hwcap __read_mostly;
61 61 EXPORT_SYMBOL_GPL(elf_hwcap);
62 62  
63 63 static const char *cpu_name;
arch/arm64/mm/fault.c
... ... @@ -130,7 +130,7 @@
130 130 force_sig_info(sig, &si, tsk);
131 131 }
132 132  
133   -void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *regs)
  133 +static void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *regs)
134 134 {
135 135 struct task_struct *tsk = current;
136 136 struct mm_struct *mm = tsk->active_mm;