* [PATCH] selftests: breakpoints: Fix wrong argument of ptrace() when single step
@ 2021-02-03 8:39 Tiezhu Yang
2021-02-03 18:30 ` Shuah Khan
0 siblings, 1 reply; 3+ messages in thread
From: Tiezhu Yang @ 2021-02-03 8:39 UTC (permalink / raw)
To: Shuah Khan; +Cc: linux-kselftest, linux-kernel
According to the error message, the first argument of ptrace() should be
PTRACE_SINGLESTEP instead of PTRACE_CONT when ptrace single step.
Fixes: f43365ee17f8 ("selftests: arm64: add test for unaligned/inexact watchpoint handling")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
tools/testing/selftests/breakpoints/breakpoint_test_arm64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c b/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c
index ad41ea6..2f4d4d6 100644
--- a/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c
+++ b/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c
@@ -143,7 +143,7 @@ static bool run_test(int wr_size, int wp_size, int wr, int wp)
if (!set_watchpoint(pid, wp_size, wp))
return false;
- if (ptrace(PTRACE_CONT, pid, NULL, NULL) < 0) {
+ if (ptrace(PTRACE_SINGLESTEP, pid, NULL, NULL) < 0) {
ksft_print_msg(
"ptrace(PTRACE_SINGLESTEP) failed: %s\n",
strerror(errno));
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] selftests: breakpoints: Fix wrong argument of ptrace() when single step 2021-02-03 8:39 [PATCH] selftests: breakpoints: Fix wrong argument of ptrace() when single step Tiezhu Yang @ 2021-02-03 18:30 ` Shuah Khan 2021-02-04 2:36 ` Tiezhu Yang 0 siblings, 1 reply; 3+ messages in thread From: Shuah Khan @ 2021-02-03 18:30 UTC (permalink / raw) To: Tiezhu Yang, Shuah Khan; +Cc: linux-kselftest, linux-kernel, Shuah Khan On 2/3/21 1:39 AM, Tiezhu Yang wrote: > According to the error message, the first argument of ptrace() should be > PTRACE_SINGLESTEP instead of PTRACE_CONT when ptrace single step. > > Fixes: f43365ee17f8 ("selftests: arm64: add test for unaligned/inexact watchpoint handling") > Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> > --- > tools/testing/selftests/breakpoints/breakpoint_test_arm64.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c b/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c > index ad41ea6..2f4d4d6 100644 > --- a/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c > +++ b/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c > @@ -143,7 +143,7 @@ static bool run_test(int wr_size, int wp_size, int wr, int wp) > if (!set_watchpoint(pid, wp_size, wp)) > return false; > > - if (ptrace(PTRACE_CONT, pid, NULL, NULL) < 0) { > + if (ptrace(PTRACE_SINGLESTEP, pid, NULL, NULL) < 0) { > ksft_print_msg( > "ptrace(PTRACE_SINGLESTEP) failed: %s\n", > strerror(errno)); > Right before this it does a set_watchpoint(). PTRACE_CONT is what makes sense to me. Error might be the one that is incorrect here? thanks, -- Shuah ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests: breakpoints: Fix wrong argument of ptrace() when single step 2021-02-03 18:30 ` Shuah Khan @ 2021-02-04 2:36 ` Tiezhu Yang 0 siblings, 0 replies; 3+ messages in thread From: Tiezhu Yang @ 2021-02-04 2:36 UTC (permalink / raw) To: Shuah Khan, Shuah Khan; +Cc: linux-kselftest, linux-kernel On 02/04/2021 02:30 AM, Shuah Khan wrote: > On 2/3/21 1:39 AM, Tiezhu Yang wrote: >> According to the error message, the first argument of ptrace() should be >> PTRACE_SINGLESTEP instead of PTRACE_CONT when ptrace single step. >> >> Fixes: f43365ee17f8 ("selftests: arm64: add test for >> unaligned/inexact watchpoint handling") >> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> >> --- >> tools/testing/selftests/breakpoints/breakpoint_test_arm64.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git >> a/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c >> b/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c >> index ad41ea6..2f4d4d6 100644 >> --- a/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c >> +++ b/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c >> @@ -143,7 +143,7 @@ static bool run_test(int wr_size, int wp_size, >> int wr, int wp) >> if (!set_watchpoint(pid, wp_size, wp)) >> return false; >> - if (ptrace(PTRACE_CONT, pid, NULL, NULL) < 0) { >> + if (ptrace(PTRACE_SINGLESTEP, pid, NULL, NULL) < 0) { >> ksft_print_msg( >> "ptrace(PTRACE_SINGLESTEP) failed: %s\n", >> strerror(errno)); >> > > Right before this it does a set_watchpoint(). PTRACE_CONT is what > makes sense to me. Error might be the one that is incorrect here? What do you think the following change? If it is OK, I will send v2 soon. diff --git a/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c b/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c index ad41ea6..e704181 100644 --- a/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c +++ b/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c @@ -145,7 +145,7 @@ static bool run_test(int wr_size, int wp_size, int wr, int wp) if (ptrace(PTRACE_CONT, pid, NULL, NULL) < 0) { ksft_print_msg( - "ptrace(PTRACE_SINGLESTEP) failed: %s\n", + "ptrace(PTRACE_CONT) failed: %s\n", strerror(errno)); return false; } @@ -159,7 +159,7 @@ static bool run_test(int wr_size, int wp_size, int wr, int wp) } alarm(0); if (WIFEXITED(status)) { - ksft_print_msg("child did not single-step\n"); + ksft_print_msg("child exited prematurely\n"); return false; } if (!WIFSTOPPED(status)) { Thanks, Tiezhu > > thanks, > -- Shuah ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-04 2:37 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-02-03 8:39 [PATCH] selftests: breakpoints: Fix wrong argument of ptrace() when single step Tiezhu Yang 2021-02-03 18:30 ` Shuah Khan 2021-02-04 2:36 ` Tiezhu Yang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox