I'm getting closer to reviving Valgrind on FreeBSD. One of the last blocker issues that I have are with a sysctl in rtld.
The scenario is that the Valgrind host code has completed phase 1 and it has started to execute client code. The first thing that it does is load and execute rtld. The problem code (in rtld) is
Remember, this code isn't being executed natively, it's being JIT interpreted by Valgrind.
sysctlnametomib() should be getting values of 6,7 in the mib, but I'm seeing 6,2147482929
this is causing the call to sysctl() to fail and the client exits.
Actually I see the same thing on amd64, but it doesn't seem to pose any problem.
2147482929 is 0x7FFFFD31, somewhere towards the upper end of positive values for an int.
I've stepped though the Valgrind code down to the assembly level and I see the same values there, so it isn't a problem of propagating the values within the Valgrind client. This is occurring on the very first client syscall (the host has already done plenty). Subsequent syscalls don't seem to have a problem.
Does anyone have any idea why this syscall is misbehaving under Valgrind?
The scenario is that the Valgrind host code has completed phase 1 and it has started to execute client code. The first thing that it does is load and execute rtld. The problem code (in rtld) is
Code:
if (sysctlnametomib("hw.pagesizes", mib, &len) == 0)
size = sizeof(psa);
else
; // snipped
if (sysctl(mib, len, psa, &size, NULL, 0) == -1) {
_rtld_error("sysctl for hw.pagesize(s) failed");
rtld_die();
?
}
Remember, this code isn't being executed natively, it's being JIT interpreted by Valgrind.
sysctlnametomib() should be getting values of 6,7 in the mib, but I'm seeing 6,2147482929
this is causing the call to sysctl() to fail and the client exits.
Actually I see the same thing on amd64, but it doesn't seem to pose any problem.
2147482929 is 0x7FFFFD31, somewhere towards the upper end of positive values for an int.
I've stepped though the Valgrind code down to the assembly level and I see the same values there, so it isn't a problem of propagating the values within the Valgrind client. This is occurring on the very first client syscall (the host has already done plenty). Subsequent syscalls don't seem to have a problem.
Does anyone have any idea why this syscall is misbehaving under Valgrind?
Last edited: