diff options
Diffstat (limited to 'arch/x86/kernel/step.c')
-rw-r--r-- | arch/x86/kernel/step.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c index f55c003f5b63..21ea22fda5fc 100644 --- a/arch/x86/kernel/step.c +++ b/arch/x86/kernel/step.c | |||
@@ -169,9 +169,14 @@ static void enable_step(struct task_struct *child, bool block) | |||
169 | */ | 169 | */ |
170 | if (enable_single_step(child) && block) { | 170 | if (enable_single_step(child) && block) { |
171 | set_tsk_thread_flag(child, TIF_DEBUGCTLMSR); | 171 | set_tsk_thread_flag(child, TIF_DEBUGCTLMSR); |
172 | write_debugctlmsr(child, DEBUGCTLMSR_BTF); | 172 | write_debugctlmsr(child, |
173 | } else if (test_and_clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR)) { | 173 | child->thread.debugctlmsr | DEBUGCTLMSR_BTF); |
174 | write_debugctlmsr(child, 0); | 174 | } else { |
175 | write_debugctlmsr(child, | ||
176 | child->thread.debugctlmsr & ~TIF_DEBUGCTLMSR); | ||
177 | |||
178 | if (!child->thread.debugctlmsr) | ||
179 | clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR); | ||
175 | } | 180 | } |
176 | } | 181 | } |
177 | 182 | ||
@@ -190,8 +195,11 @@ void user_disable_single_step(struct task_struct *child) | |||
190 | /* | 195 | /* |
191 | * Make sure block stepping (BTF) is disabled. | 196 | * Make sure block stepping (BTF) is disabled. |
192 | */ | 197 | */ |
193 | if (test_and_clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR)) | 198 | write_debugctlmsr(child, |
194 | write_debugctlmsr(child, 0); | 199 | child->thread.debugctlmsr & ~TIF_DEBUGCTLMSR); |
200 | |||
201 | if (!child->thread.debugctlmsr) | ||
202 | clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR); | ||
195 | 203 | ||
196 | /* Always clear TIF_SINGLESTEP... */ | 204 | /* Always clear TIF_SINGLESTEP... */ |
197 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); | 205 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); |