diff options
| -rw-r--r-- | arch/arm64/kernel/debug-monitors.c | 23 | ||||
| -rw-r--r-- | arch/arm64/kernel/insn.c | 6 | ||||
| -rw-r--r-- | arch/arm64/kernel/setup.c | 2 | ||||
| -rw-r--r-- | arch/arm64/mm/fault.c | 1 |
4 files changed, 18 insertions, 14 deletions
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c index cebf78661a55..253021ef2769 100644 --- a/arch/arm64/kernel/debug-monitors.c +++ b/arch/arm64/kernel/debug-monitors.c | |||
| @@ -201,7 +201,7 @@ void unregister_step_hook(struct step_hook *hook) | |||
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | /* | 203 | /* |
| 204 | * Call registered single step handers | 204 | * Call registered single step handlers |
| 205 | * There is no Syndrome info to check for determining the handler. | 205 | * There is no Syndrome info to check for determining the handler. |
| 206 | * So we call all the registered handlers, until the right handler is | 206 | * So we call all the registered handlers, until the right handler is |
| 207 | * found which returns zero. | 207 | * found which returns zero. |
| @@ -271,20 +271,21 @@ static int single_step_handler(unsigned long addr, unsigned int esr, | |||
| 271 | * Use reader/writer locks instead of plain spinlock. | 271 | * Use reader/writer locks instead of plain spinlock. |
| 272 | */ | 272 | */ |
| 273 | static LIST_HEAD(break_hook); | 273 | static LIST_HEAD(break_hook); |
| 274 | static DEFINE_RWLOCK(break_hook_lock); | 274 | static DEFINE_SPINLOCK(break_hook_lock); |
| 275 | 275 | ||
| 276 | void register_break_hook(struct break_hook *hook) | 276 | void register_break_hook(struct break_hook *hook) |
| 277 | { | 277 | { |
| 278 | write_lock(&break_hook_lock); | 278 | spin_lock(&break_hook_lock); |
| 279 | list_add(&hook->node, &break_hook); | 279 | list_add_rcu(&hook->node, &break_hook); |
| 280 | write_unlock(&break_hook_lock); | 280 | spin_unlock(&break_hook_lock); |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | void unregister_break_hook(struct break_hook *hook) | 283 | void unregister_break_hook(struct break_hook *hook) |
| 284 | { | 284 | { |
| 285 | write_lock(&break_hook_lock); | 285 | spin_lock(&break_hook_lock); |
| 286 | list_del(&hook->node); | 286 | list_del_rcu(&hook->node); |
| 287 | write_unlock(&break_hook_lock); | 287 | spin_unlock(&break_hook_lock); |
| 288 | synchronize_rcu(); | ||
| 288 | } | 289 | } |
| 289 | 290 | ||
| 290 | static int call_break_hook(struct pt_regs *regs, unsigned int esr) | 291 | static int call_break_hook(struct pt_regs *regs, unsigned int esr) |
| @@ -292,11 +293,11 @@ static int call_break_hook(struct pt_regs *regs, unsigned int esr) | |||
| 292 | struct break_hook *hook; | 293 | struct break_hook *hook; |
| 293 | int (*fn)(struct pt_regs *regs, unsigned int esr) = NULL; | 294 | int (*fn)(struct pt_regs *regs, unsigned int esr) = NULL; |
| 294 | 295 | ||
| 295 | read_lock(&break_hook_lock); | 296 | rcu_read_lock(); |
| 296 | list_for_each_entry(hook, &break_hook, node) | 297 | list_for_each_entry_rcu(hook, &break_hook, node) |
| 297 | if ((esr & hook->esr_mask) == hook->esr_val) | 298 | if ((esr & hook->esr_mask) == hook->esr_val) |
| 298 | fn = hook->fn; | 299 | fn = hook->fn; |
| 299 | read_unlock(&break_hook_lock); | 300 | rcu_read_unlock(); |
| 300 | 301 | ||
| 301 | return fn ? fn(regs, esr) : DBG_HOOK_ERROR; | 302 | return fn ? fn(regs, esr) : DBG_HOOK_ERROR; |
| 302 | } | 303 | } |
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c index f341866aa810..c08b9ad6f429 100644 --- a/arch/arm64/kernel/insn.c +++ b/arch/arm64/kernel/insn.c | |||
| @@ -85,7 +85,7 @@ bool aarch64_insn_is_branch_imm(u32 insn) | |||
| 85 | aarch64_insn_is_bcond(insn)); | 85 | aarch64_insn_is_bcond(insn)); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | static DEFINE_SPINLOCK(patch_lock); | 88 | static DEFINE_RAW_SPINLOCK(patch_lock); |
| 89 | 89 | ||
| 90 | static void __kprobes *patch_map(void *addr, int fixmap) | 90 | static void __kprobes *patch_map(void *addr, int fixmap) |
| 91 | { | 91 | { |
| @@ -131,13 +131,13 @@ static int __kprobes __aarch64_insn_write(void *addr, u32 insn) | |||
| 131 | unsigned long flags = 0; | 131 | unsigned long flags = 0; |
| 132 | int ret; | 132 | int ret; |
| 133 | 133 | ||
| 134 | spin_lock_irqsave(&patch_lock, flags); | 134 | raw_spin_lock_irqsave(&patch_lock, flags); |
| 135 | waddr = patch_map(addr, FIX_TEXT_POKE0); | 135 | waddr = patch_map(addr, FIX_TEXT_POKE0); |
| 136 | 136 | ||
| 137 | ret = probe_kernel_write(waddr, &insn, AARCH64_INSN_SIZE); | 137 | ret = probe_kernel_write(waddr, &insn, AARCH64_INSN_SIZE); |
| 138 | 138 | ||
| 139 | patch_unmap(FIX_TEXT_POKE0); | 139 | patch_unmap(FIX_TEXT_POKE0); |
| 140 | spin_unlock_irqrestore(&patch_lock, flags); | 140 | raw_spin_unlock_irqrestore(&patch_lock, flags); |
| 141 | 141 | ||
| 142 | return ret; | 142 | return ret; |
| 143 | } | 143 | } |
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 6bab21f84a9f..232247945b1c 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c | |||
| @@ -364,6 +364,8 @@ static void __init relocate_initrd(void) | |||
| 364 | to_free = ram_end - orig_start; | 364 | to_free = ram_end - orig_start; |
| 365 | 365 | ||
| 366 | size = orig_end - orig_start; | 366 | size = orig_end - orig_start; |
| 367 | if (!size) | ||
| 368 | return; | ||
| 367 | 369 | ||
| 368 | /* initrd needs to be relocated completely inside linear mapping */ | 370 | /* initrd needs to be relocated completely inside linear mapping */ |
| 369 | new_start = memblock_find_in_range(0, PFN_PHYS(max_pfn), | 371 | new_start = memblock_find_in_range(0, PFN_PHYS(max_pfn), |
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index aba9ead1384c..9fadf6d7039b 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c | |||
| @@ -287,6 +287,7 @@ retry: | |||
| 287 | * starvation. | 287 | * starvation. |
| 288 | */ | 288 | */ |
| 289 | mm_flags &= ~FAULT_FLAG_ALLOW_RETRY; | 289 | mm_flags &= ~FAULT_FLAG_ALLOW_RETRY; |
| 290 | mm_flags |= FAULT_FLAG_TRIED; | ||
| 290 | goto retry; | 291 | goto retry; |
| 291 | } | 292 | } |
| 292 | } | 293 | } |
