linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ptrace: restore the previous single step reporting behavior
@ 2021-01-23 11:21 Yuxuan Shui
  2021-01-27 23:55 ` Gabriel Krisman Bertazi
  2021-01-28 12:49 ` [tip: core/urgent] entry: Unbreak single step reporting behaviour tip-bot2 for Yuxuan Shui
  0 siblings, 2 replies; 5+ messages in thread
From: Yuxuan Shui @ 2021-01-23 11:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: krisman, linux-arch, kernel, yshuiv7

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]

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

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
---
 kernel/entry/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/entry/common.c b/kernel/entry/common.c
index 90533f34ea99c..ad3b17fcde782 100644
--- a/kernel/entry/common.c
+++ b/kernel/entry/common.c
@@ -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);
-- 
2.30.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ptrace: restore the previous single step reporting behavior
  2021-01-23 11:21 [PATCH] ptrace: restore the previous single step reporting behavior Yuxuan Shui
@ 2021-01-27 23:55 ` Gabriel Krisman Bertazi
  2021-01-28  0:16   ` Yuxuan Shui
  2021-01-28 12:40   ` Thomas Gleixner
  2021-01-28 12:49 ` [tip: core/urgent] entry: Unbreak single step reporting behaviour tip-bot2 for Yuxuan Shui
  1 sibling, 2 replies; 5+ messages in thread
From: Gabriel Krisman Bertazi @ 2021-01-27 23:55 UTC (permalink / raw)
  To: Yuxuan Shui; +Cc: linux-kernel, linux-arch, kernel

Yuxuan Shui <yshuiv7@gmail.com> writes:

> 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
>
> Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

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")
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>

-- 
Gabriel Krisman Bertazi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ptrace: restore the previous single step reporting behavior
  2021-01-27 23:55 ` Gabriel Krisman Bertazi
@ 2021-01-28  0:16   ` Yuxuan Shui
  2021-01-28 12:40   ` Thomas Gleixner
  1 sibling, 0 replies; 5+ messages in thread
From: Yuxuan Shui @ 2021-01-28  0:16 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi
  Cc: linux-kernel, linux-arch, kernel, tglx, peterz, luto

Hi,

On Wed, Jan 27, 2021 at 11:55 PM Gabriel Krisman Bertazi
<krisman@collabora.com> wrote:
>
> Yuxuan Shui <yshuiv7@gmail.com> writes:
>
> > 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
> >
> > Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
>
> Looks correct to me.
>
> To gather the right attention, you should directly CC the correct maintainers.

Thanks, will do.

>
> Fixes: 64eb35f701f0 ("ptrace: Migrate TIF_SYSCALL_EMU to use SYSCALL_WORK flag")
> Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>
>
> --
> Gabriel Krisman Bertazi



-- 

Regards
Yuxuan Shui

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ptrace: restore the previous single step reporting behavior
  2021-01-27 23:55 ` Gabriel Krisman Bertazi
  2021-01-28  0:16   ` Yuxuan Shui
@ 2021-01-28 12:40   ` Thomas Gleixner
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2021-01-28 12:40 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi, Yuxuan Shui
  Cc: linux-kernel, linux-arch, kernel, x86

On Wed, Jan 27 2021 at 20:55, Gabriel Krisman Bertazi wrote:
> Yuxuan Shui <yshuiv7@gmail.com> writes:
>
> To gather the right attention, you should directly CC the correct
> maintainers.

You could have cc'ed them on your reply ....

> Fixes: 64eb35f701f0 ("ptrace: Migrate TIF_SYSCALL_EMU to use SYSCALL_WORK flag")
> Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip: core/urgent] entry: Unbreak single step reporting behaviour
  2021-01-23 11:21 [PATCH] ptrace: restore the previous single step reporting behavior Yuxuan Shui
  2021-01-27 23:55 ` Gabriel Krisman Bertazi
@ 2021-01-28 12:49 ` tip-bot2 for Yuxuan Shui
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot2 for Yuxuan Shui @ 2021-01-28 12:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Yuxuan Shui, Thomas Gleixner, Gabriel Krisman Bertazi, x86, linux-kernel

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 <yshuiv7@gmail.com>
AuthorDate:    Sat, 23 Jan 2021 03:21:32 -08:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
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")
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Link: https://lore.kernel.org/r/877do3gaq9.fsf@m5Zedd9JOGzJrf0
---
 kernel/entry/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/entry/common.c b/kernel/entry/common.c
index 3783416..6dd82be 100644
--- a/kernel/entry/common.c
+++ b/kernel/entry/common.c
@@ -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);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-28 12:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-23 11:21 [PATCH] ptrace: restore the previous single step reporting behavior Yuxuan Shui
2021-01-27 23:55 ` Gabriel Krisman Bertazi
2021-01-28  0:16   ` Yuxuan Shui
2021-01-28 12:40   ` Thomas Gleixner
2021-01-28 12:49 ` [tip: core/urgent] entry: Unbreak single step reporting behaviour tip-bot2 for Yuxuan Shui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).