Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull arm64 fixes from Catalin Marinas:
"Main changes:
- AArch64 Linux compilation fixes following 3.7-rc1 changes
(MODULES_USE_ELF_RELA, update_vsyscall() prototype)
- Unnecessary register setting in start_thread() (thanks to Al Viro)
- ptrace fixes"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64:
arm64: fix alignment padding in assembly code
arm64: ptrace: use HW_BREAKPOINT_EMPTY type for disabled breakpoints
arm64: ptrace: make structure padding explicit for debug registers
arm64: No need to set the x0-x2 registers in start_thread()
arm64: Ignore memory blocks below PHYS_OFFSET
arm64: Fix the update_vsyscall() prototype
arm64: Select MODULES_USE_ELF_RELA
arm64: Remove duplicate inclusion of mmu_context.h in smp.c

+82 -44
+1
arch/arm64/Kconfig
··· 22 22 select HAVE_PERF_EVENTS 23 23 select HAVE_SPARSE_IRQ 24 24 select IRQ_DOMAIN 25 + select MODULES_USE_ELF_RELA 25 26 select NO_BOOTMEM 26 27 select OF 27 28 select OF_EARLY_FLATTREE
-1
arch/arm64/include/asm/Kbuild
··· 18 18 generic-y += irq_regs.h 19 19 generic-y += kdebug.h 20 20 generic-y += kmap_types.h 21 - generic-y += linkage.h 22 21 generic-y += local.h 23 22 generic-y += local64.h 24 23 generic-y += mman.h
+7
arch/arm64/include/asm/linkage.h
··· 1 + #ifndef __ASM_LINKAGE_H 2 + #define __ASM_LINKAGE_H 3 + 4 + #define __ALIGN .align 4 5 + #define __ALIGN_STR ".align 4" 6 + 7 + #endif
-10
arch/arm64/include/asm/processor.h
··· 92 92 static inline void start_thread(struct pt_regs *regs, unsigned long pc, 93 93 unsigned long sp) 94 94 { 95 - unsigned long *stack = (unsigned long *)sp; 96 - 97 95 start_thread_common(regs, pc); 98 96 regs->pstate = PSR_MODE_EL0t; 99 97 regs->sp = sp; 100 - regs->regs[2] = stack[2]; /* x2 (envp) */ 101 - regs->regs[1] = stack[1]; /* x1 (argv) */ 102 - regs->regs[0] = stack[0]; /* x0 (argc) */ 103 98 } 104 99 105 100 #ifdef CONFIG_COMPAT 106 101 static inline void compat_start_thread(struct pt_regs *regs, unsigned long pc, 107 102 unsigned long sp) 108 103 { 109 - unsigned int *stack = (unsigned int *)sp; 110 - 111 104 start_thread_common(regs, pc); 112 105 regs->pstate = COMPAT_PSR_MODE_USR; 113 106 if (pc & 1) 114 107 regs->pstate |= COMPAT_PSR_T_BIT; 115 108 regs->compat_sp = sp; 116 - regs->regs[2] = stack[2]; /* x2 (envp) */ 117 - regs->regs[1] = stack[1]; /* x1 (argv) */ 118 - regs->regs[0] = stack[0]; /* x0 (argc) */ 119 109 } 120 110 #endif 121 111
+2 -1
arch/arm64/include/uapi/asm/ptrace.h
··· 79 79 80 80 struct user_hwdebug_state { 81 81 __u32 dbg_info; 82 + __u32 pad; 82 83 struct { 83 84 __u64 addr; 84 85 __u32 ctrl; 86 + __u32 pad; 85 87 } dbg_regs[16]; 86 88 }; 87 - 88 89 89 90 #endif /* __ASSEMBLY__ */ 90 91
+50 -21
arch/arm64/kernel/ptrace.c
··· 234 234 struct arch_hw_breakpoint_ctrl ctrl, 235 235 struct perf_event_attr *attr) 236 236 { 237 - int err, len, type; 237 + int err, len, type, disabled = !ctrl.enabled; 238 238 239 - err = arch_bp_generic_fields(ctrl, &len, &type); 240 - if (err) 241 - return err; 239 + if (disabled) { 240 + len = 0; 241 + type = HW_BREAKPOINT_EMPTY; 242 + } else { 243 + err = arch_bp_generic_fields(ctrl, &len, &type); 244 + if (err) 245 + return err; 242 246 243 - switch (note_type) { 244 - case NT_ARM_HW_BREAK: 245 - if ((type & HW_BREAKPOINT_X) != type) 247 + switch (note_type) { 248 + case NT_ARM_HW_BREAK: 249 + if ((type & HW_BREAKPOINT_X) != type) 250 + return -EINVAL; 251 + break; 252 + case NT_ARM_HW_WATCH: 253 + if ((type & HW_BREAKPOINT_RW) != type) 254 + return -EINVAL; 255 + break; 256 + default: 246 257 return -EINVAL; 247 - break; 248 - case NT_ARM_HW_WATCH: 249 - if ((type & HW_BREAKPOINT_RW) != type) 250 - return -EINVAL; 251 - break; 252 - default: 253 - return -EINVAL; 258 + } 254 259 } 255 260 256 261 attr->bp_len = len; 257 262 attr->bp_type = type; 258 - attr->disabled = !ctrl.enabled; 263 + attr->disabled = disabled; 259 264 260 265 return 0; 261 266 } ··· 377 372 378 373 #define PTRACE_HBP_ADDR_SZ sizeof(u64) 379 374 #define PTRACE_HBP_CTRL_SZ sizeof(u32) 380 - #define PTRACE_HBP_REG_OFF sizeof(u32) 375 + #define PTRACE_HBP_PAD_SZ sizeof(u32) 381 376 382 377 static int hw_break_get(struct task_struct *target, 383 378 const struct user_regset *regset, ··· 385 380 void *kbuf, void __user *ubuf) 386 381 { 387 382 unsigned int note_type = regset->core_note_type; 388 - int ret, idx = 0, offset = PTRACE_HBP_REG_OFF, limit; 383 + int ret, idx = 0, offset, limit; 389 384 u32 info, ctrl; 390 385 u64 addr; 391 386 ··· 394 389 if (ret) 395 390 return ret; 396 391 397 - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &info, 0, 4); 392 + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &info, 0, 393 + sizeof(info)); 394 + if (ret) 395 + return ret; 396 + 397 + /* Pad */ 398 + offset = offsetof(struct user_hwdebug_state, pad); 399 + ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, offset, 400 + offset + PTRACE_HBP_PAD_SZ); 398 401 if (ret) 399 402 return ret; 400 403 401 404 /* (address, ctrl) registers */ 405 + offset = offsetof(struct user_hwdebug_state, dbg_regs); 402 406 limit = regset->n * regset->size; 403 407 while (count && offset < limit) { 404 408 ret = ptrace_hbp_get_addr(note_type, target, idx, &addr); ··· 427 413 if (ret) 428 414 return ret; 429 415 offset += PTRACE_HBP_CTRL_SZ; 416 + 417 + ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, 418 + offset, 419 + offset + PTRACE_HBP_PAD_SZ); 420 + if (ret) 421 + return ret; 422 + offset += PTRACE_HBP_PAD_SZ; 430 423 idx++; 431 424 } 432 425 ··· 446 425 const void *kbuf, const void __user *ubuf) 447 426 { 448 427 unsigned int note_type = regset->core_note_type; 449 - int ret, idx = 0, offset = PTRACE_HBP_REG_OFF, limit; 428 + int ret, idx = 0, offset, limit; 450 429 u32 ctrl; 451 430 u64 addr; 452 431 453 - /* Resource info */ 454 - ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 0, 4); 432 + /* Resource info and pad */ 433 + offset = offsetof(struct user_hwdebug_state, dbg_regs); 434 + ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 0, offset); 455 435 if (ret) 456 436 return ret; 457 437 ··· 476 454 if (ret) 477 455 return ret; 478 456 offset += PTRACE_HBP_CTRL_SZ; 457 + 458 + ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 459 + offset, 460 + offset + PTRACE_HBP_PAD_SZ); 461 + if (ret) 462 + return ret; 463 + offset += PTRACE_HBP_PAD_SZ; 479 464 idx++; 480 465 } 481 466
+12
arch/arm64/kernel/setup.c
··· 170 170 171 171 void __init early_init_dt_add_memory_arch(u64 base, u64 size) 172 172 { 173 + base &= PAGE_MASK; 173 174 size &= PAGE_MASK; 175 + if (base + size < PHYS_OFFSET) { 176 + pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", 177 + base, base + size); 178 + return; 179 + } 180 + if (base < PHYS_OFFSET) { 181 + pr_warning("Ignoring memory range 0x%llx - 0x%llx\n", 182 + base, PHYS_OFFSET); 183 + size -= PHYS_OFFSET - base; 184 + base = PHYS_OFFSET; 185 + } 174 186 memblock_add(base, size); 175 187 } 176 188
-1
arch/arm64/kernel/smp.c
··· 46 46 #include <asm/sections.h> 47 47 #include <asm/tlbflush.h> 48 48 #include <asm/ptrace.h> 49 - #include <asm/mmu_context.h> 50 49 51 50 /* 52 51 * as from 2.5, kernels no longer have an init_tasks structure
+10 -10
arch/arm64/kernel/vdso.c
··· 28 28 #include <linux/sched.h> 29 29 #include <linux/signal.h> 30 30 #include <linux/slab.h> 31 + #include <linux/timekeeper_internal.h> 31 32 #include <linux/vmalloc.h> 32 33 33 34 #include <asm/cacheflush.h> ··· 223 222 /* 224 223 * Update the vDSO data page to keep in sync with kernel timekeeping. 225 224 */ 226 - void update_vsyscall(struct timespec *ts, struct timespec *wtm, 227 - struct clocksource *clock, u32 mult) 225 + void update_vsyscall(struct timekeeper *tk) 228 226 { 229 227 struct timespec xtime_coarse; 230 - u32 use_syscall = strcmp(clock->name, "arch_sys_counter"); 228 + u32 use_syscall = strcmp(tk->clock->name, "arch_sys_counter"); 231 229 232 230 ++vdso_data->tb_seq_count; 233 231 smp_wmb(); ··· 237 237 vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec; 238 238 239 239 if (!use_syscall) { 240 - vdso_data->cs_cycle_last = clock->cycle_last; 241 - vdso_data->xtime_clock_sec = ts->tv_sec; 242 - vdso_data->xtime_clock_nsec = ts->tv_nsec; 243 - vdso_data->cs_mult = mult; 244 - vdso_data->cs_shift = clock->shift; 245 - vdso_data->wtm_clock_sec = wtm->tv_sec; 246 - vdso_data->wtm_clock_nsec = wtm->tv_nsec; 240 + vdso_data->cs_cycle_last = tk->clock->cycle_last; 241 + vdso_data->xtime_clock_sec = tk->xtime_sec; 242 + vdso_data->xtime_clock_nsec = tk->xtime_nsec >> tk->shift; 243 + vdso_data->cs_mult = tk->mult; 244 + vdso_data->cs_shift = tk->shift; 245 + vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; 246 + vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; 247 247 } 248 248 249 249 smp_wmb();