-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bionic bionic-unit-tests-static tsts result #16
Comments
Open
qemu not support hw watch point register?? tst failed info: (the following error can be reproduced by adding the follow kernel and bionic-xxx-xxx-xxx-static patches)
add tst code in kernel_common: diff --git a/arch/loongarch/kernel/ptrace.c b/arch/loongarch/kernel/ptrace.c
index b819b12275..3f842c7465 100644
--- a/arch/loongarch/kernel/ptrace.c
+++ b/arch/loongarch/kernel/ptrace.c
@@ -603,10 +603,16 @@ static int ptrace_set_watch_regs(struct task_struct *child,
unsigned long maskt[NUM_WATCH_REGS];
unsigned char irwt[NUM_WATCH_REGS];
+ printk("The unsigned value is: %llu, -- %u\n", cpu_has_watch, boot_cpu_data.watch_reg_use_cnt);
if (!cpu_has_watch || boot_cpu_data.watch_reg_use_cnt == 0)
+ {
return -EIO;
+ }
+ printk("The unsigned value is: %ld\n", access_ok(addr, sizeof(struct pt_watch_regs)));
if (!access_ok(addr, sizeof(struct pt_watch_regs)))
+ {
return -EIO;
+ }
__get_user(cnt, &addr->max_valid);
cnt = min(boot_cpu_data.watch_reg_use_cnt, cnt);
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index aab480e24b..f57f88df32 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -1268,9 +1268,11 @@ int ptrace_request(struct task_struct *child, long request,
SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr,
unsigned long, data)
{
+
struct task_struct *child;
long ret;
+ printk("ttttttttttttttttttt\n");
if (request == PTRACE_TRACEME) {
ret = ptrace_traceme();
if (!ret)
@@ -1415,9 +1417,11 @@ int compat_ptrace_request(struct task_struct *child, compat_long_t request,
COMPAT_SYSCALL_DEFINE4(ptrace, compat_long_t, request, compat_long_t, pid,
compat_long_t, addr, compat_long_t, data)
{
+
struct task_struct *child;
long ret;
+ printk("ttttttttttttttttttt\n");
if (request == PTRACE_TRACEME) {
ret = ptrace_traceme();
goto out;
try to add support of sys_ptrace.*, the code are as follows: diff --git a/tests/sys_ptrace_test.cpp b/tests/sys_ptrace_test.cpp
index 168c84072..6d98a0760 100644
--- a/tests/sys_ptrace_test.cpp
+++ b/tests/sys_ptrace_test.cpp
@@ -130,6 +130,17 @@ static void set_watchpoint(pid_t child, uintptr_t address, size_t size) {
ASSERT_EQ(0, ptrace(PTRACE_SETREGSET, child, NT_ARM_HW_WATCH, &iov)) << strerror(errno);
#endif
+#elif defined(__loongarch64)
+
+ pt_watch_regs dreg_state;
+ memset(&dreg_state, 0, sizeof dreg_state);
+ dreg_state.max_valid = 1;
+ dreg_state.style = pt_watch_style_la64;
+ dreg_state.la64[0].addr = reinterpret_cast<uintptr_t>(address);
+ dreg_state.la64[0].irw = LA_WATCH_W; // todo fix
+
+ ASSERT_EQ(0, ptrace(PTRACE_SET_WATCH_REGS, child, &dreg_state, nullptr)) << strerror(errno);
+ UNUSED(size);
#elif defined(__i386__) || defined(__x86_64__)
ASSERT_EQ(0, ptrace(PTRACE_POKEUSER, child, offsetof(user, u_debugreg[0]), address)) << strerror(errno);
errno = 0;
@@ -232,13 +243,13 @@ TEST(sys_ptrace, watchpoint_stress) {
for (size_t cpu = 0; cpu < CPU_SETSIZE; ++cpu) {
if (!CPU_ISSET(cpu, &available_cpus)) continue;
- run_watchpoint_stress<uint8_t>(cpu);
+ // run_watchpoint_stress<uint8_t>(cpu);
if (::testing::Test::IsSkipped()) {
// Only check first case, since all others would skip for same reason.
return;
}
- run_watchpoint_stress<uint16_t>(cpu);
- run_watchpoint_stress<uint32_t>(cpu);
+ // run_watchpoint_stress<uint16_t>(cpu);
+ // run_watchpoint_stress<uint32_t>(cpu);
#if defined(__LP64__)
run_watchpoint_stress<uint64_t>(cpu);
#endif
@@ -318,6 +329,17 @@ static void set_breakpoint(pid_t child) {
ASSERT_EQ(0, ptrace(PTRACE_SETREGSET, child, NT_ARM_HW_BREAK, &iov)) << strerror(errno);
#endif
+#elif defined(__loongarch64)
+ address &= ~3; // todo need or not?
+
+ pt_watch_regs dreg_state;
+ memset(&dreg_state, 0, sizeof dreg_state);
+ dreg_state.max_valid = 1;
+ dreg_state.style = pt_watch_style_la64;
+ dreg_state.la64[0].addr = reinterpret_cast<uintptr_t>(address);
+ dreg_state.la64[0].irw = LA_WATCH_I; // todo fix
+
+ ASSERT_EQ(0, ptrace(PTRACE_SET_WATCH_REGS, child, &dreg_state, nullptr)) << strerror(errno);
#elif defined(__i386__) || defined(__x86_64__)
ASSERT_EQ(0, ptrace(PTRACE_POKEUSER, child, offsetof(user, u_debugreg[0]), address))
<< strerror(errno); |
目前上游的qemu确实不支持硬件watchpoint,这部分需要在真机上测试,可以先更测试代码,我随后在真机试试 |
oy456xd
pushed a commit
that referenced
this issue
Mar 4, 2024
These codes need to be further tested and verified on a real device. See: #16 (comment)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
qemu android loongarch full system
command : run bionic-unit-tests-static directly
fenv.feenableexcept_fegetexcept
See #8 (comment)
如下3 fails: 测试代码对应函数中没有larch实现支持, 暂不能说明bionic相关功能存在问题
[ FAILED ] sys_ptrace.watchpoint_stress
[ FAILED ] sys_ptrace.watchpoint_imprecise
[ FAILED ] sys_ptrace.hardware_breakpoint
set_breakpoint 和 set_watchpoint 等(?).
qemu not support hw watch point register ???
kernel ptrace code:
the cpu_has_watch and boot_cpu_data.watch_reg_use_cnt are both 0, which cause EIO error.
See #16 (comment)
The text was updated successfully, but these errors were encountered: