diff options
| author | Ingo Molnar <mingo@kernel.org> | 2018-10-09 02:50:10 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2018-10-09 02:50:10 -0400 |
| commit | fc8eaa85681fa72dc6a4e46f01c92e4fba83d0ab (patch) | |
| tree | b044fab426f2167ceeb37ed6fe58f7f11b10cebd /arch/powerpc/lib/code-patching.c | |
| parent | 2cc81c6992248ea37d0241bc325977bab310bc3b (diff) | |
| parent | 49e00eee00612b1357596fed8a88b621a7648c14 (diff) | |
Merge branch 'x86/urgent' into x86/cache, to pick up dependent fix
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/powerpc/lib/code-patching.c')
| -rw-r--r-- | arch/powerpc/lib/code-patching.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c index 850f3b8f4da5..5ffee298745f 100644 --- a/arch/powerpc/lib/code-patching.c +++ b/arch/powerpc/lib/code-patching.c | |||
| @@ -142,7 +142,7 @@ static inline int unmap_patch_area(unsigned long addr) | |||
| 142 | return 0; | 142 | return 0; |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | int patch_instruction(unsigned int *addr, unsigned int instr) | 145 | static int do_patch_instruction(unsigned int *addr, unsigned int instr) |
| 146 | { | 146 | { |
| 147 | int err; | 147 | int err; |
| 148 | unsigned int *patch_addr = NULL; | 148 | unsigned int *patch_addr = NULL; |
| @@ -182,12 +182,22 @@ out: | |||
| 182 | } | 182 | } |
| 183 | #else /* !CONFIG_STRICT_KERNEL_RWX */ | 183 | #else /* !CONFIG_STRICT_KERNEL_RWX */ |
| 184 | 184 | ||
| 185 | int patch_instruction(unsigned int *addr, unsigned int instr) | 185 | static int do_patch_instruction(unsigned int *addr, unsigned int instr) |
| 186 | { | 186 | { |
| 187 | return raw_patch_instruction(addr, instr); | 187 | return raw_patch_instruction(addr, instr); |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | #endif /* CONFIG_STRICT_KERNEL_RWX */ | 190 | #endif /* CONFIG_STRICT_KERNEL_RWX */ |
| 191 | |||
| 192 | int patch_instruction(unsigned int *addr, unsigned int instr) | ||
| 193 | { | ||
| 194 | /* Make sure we aren't patching a freed init section */ | ||
| 195 | if (init_mem_is_free && init_section_contains(addr, 4)) { | ||
| 196 | pr_debug("Skipping init section patching addr: 0x%px\n", addr); | ||
| 197 | return 0; | ||
| 198 | } | ||
| 199 | return do_patch_instruction(addr, instr); | ||
| 200 | } | ||
| 191 | NOKPROBE_SYMBOL(patch_instruction); | 201 | NOKPROBE_SYMBOL(patch_instruction); |
| 192 | 202 | ||
| 193 | int patch_branch(unsigned int *addr, unsigned long target, int flags) | 203 | int patch_branch(unsigned int *addr, unsigned long target, int flags) |
