Skip to contentSkip to conversation

ptrace: restore the previous single step reporting behavior

PATCH Applied Yuxuan Shui 4 participants 5 messages Jan 23, 2021 – Jan 28, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ptrace: restore the previous single step reporting behavior

Commit 64eb35f701f04b30706e21d1b02636b5d31a37d2 changed when single step is reported.

Specifically, the report_single_step is changed so that single steps are only reported when both SYSCALL_EMU and _TIF_SINGLESTEP are set, while previously they are reported when _TIF_SINGLESTEP is set without _TIF_SYSCALL_EMU being set.

This behavior change breaks rr [1]

This commit restores the old behavior.

[1]: https://github.com/rr-debugger/rr/issues/2793

---
 kernel/entry/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/entry/common.c +1 -1
index 90533f34ea99c..ad3b17fcde782 100644
@@ -220,7 +220,7 @@ static inline bool rep:ort_single_step(unsigned long work)
  */
 static inline bool report_single_step(unsigned long work)
 {
-	if (!(work & SYSCALL_WORK_SYSCALL_EMU))
+	if (!!(work & SYSCALL_WORK_SYSCALL_EMU))
 		return false;
 
 	return !!(current_thread_info()->flags & _TIF_SINGLESTEP);
Signature · 1 line
2.30.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Yuxuan Shui

Commit 64eb35f701f04b30706e21d1b02636b5d31a37d2 changed when single step is reported.

Specifically, the report_single_step is changed so that single steps are only reported when both SYSCALL_EMU and _TIF_SINGLESTEP are set, while previously they are reported when _TIF_SINGLESTEP is set without _TIF_SYSCALL_EMU being set.

Quoted 7 lines

This behavior change breaks rr [1]

This commit restores the old behavior.

[1]: https://github.com/rr-debugger/rr/issues/2793

Looks correct to me.

To gather the right attention, you should directly CC the correct maintainers.

Fixes 64eb35f701f0 ("ptrace: Migrate TIF_SYSCALL_EMU to use SYSCALL_WORK flag")
Signature · 1 line
Gabriel Krisman Bertazi
#2 lore raw

Hi,

Quoted 15 lines · Gabriel Krisman Bertazi
Quoted 12 lines · Yuxuan Shui

Commit 64eb35f701f04b30706e21d1b02636b5d31a37d2 changed when single step is reported.

Specifically, the report_single_step is changed so that single steps are only reported when both SYSCALL_EMU and _TIF_SINGLESTEP are set, while previously they are reported when _TIF_SINGLESTEP is set without _TIF_SYSCALL_EMU being set.

This behavior change breaks rr [1]

This commit restores the old behavior.

Quoted 7 lines
Quoted 3 lines

[1]: https://github.com/rr-debugger/rr/issues/2793

Looks correct to me.

To gather the right attention, you should directly CC the correct maintainers.

Thanks, will do.

Quoted 6 lines
Fixes 64eb35f701f0 ("ptrace: Migrate TIF_SYSCALL_EMU to use SYSCALL_WORK flag")

--
Gabriel Krisman Bertazi

Signature · 2 lines
Regards
Yuxuan Shui
merge bot Applied
#4 lore raw

[tip: core/urgent] entry: Unbreak single step reporting behaviour

In reply to Yuxuan Shui
The following commit has been merged into the core/urgent branch of tip:

The following commit has been merged into the core/urgent branch of tip:

Commit-ID:     41c1a06d1d1544bed9692ba72a5692454eee1945
Gitweb:        https://git.kernel.org/tip/41c1a06d1d1544bed9692ba72a5692454eee1945
Author:        Yuxuan Shui <[email protected]>
AuthorDate:    Sat, 23 Jan 2021 03:21:32 -08:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Thu, 28 Jan 2021 13:46:55 +01:00

entry: Unbreak single step reporting behaviour

The move of TIF_SYSCALL_EMU to SYSCALL_WORK_SYSCALL_EMU broke single step reporting. The original code reported the single step when TIF_SINGLESTEP was set and TIF_SYSCALL_EMU was not set. The SYSCALL_WORK conversion got the logic wrong and now the reporting only happens when both bits are set.

Restore the original behaviour.

[ tglx: Massaged changelog and dropped the pointless double negation ]

Fixes 64eb35f701f0 ("ptrace: Migrate TIF_SYSCALL_EMU to use SYSCALL_WORK flag")
---
 kernel/entry/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/entry/common.c +1 -1
index 3783416..6dd82be 100644
@@ -222,7 +222,7 @@ static inline bool report_single_step(unsigned long work)
  */
 static inline bool report_single_step(unsigned long work)
 {
-	if (!(work & SYSCALL_WORK_SYSCALL_EMU))
+	if (work & SYSCALL_WORK_SYSCALL_EMU)
 		return false;
 
 	return !!(current_thread_info()->flags & _TIF_SINGLESTEP);