|
From: Stephane D. <ste...@ex...> - 2003-04-30 07:13:57
|
Hello,
when using the following system call (which is legal, according to the
accept(2) man page), valgrind 1.9.5 complains about the parameters being
NULL:
for (;;) {
fd = accept(server, NULL, NULL);
if (fd != -1) {
/* Success. */
break;
}
==32217== Syscall param socketcall.accept(addrlen_in) contains
uninitialised or
unaddressable byte(s)
==32217== at 0x4073ADE6: __libc_accept (in /lib/i686/libc-2.3.1.so)
==32217== by 0x401755B9: accept (vg_intercept.c:142)
==32217== by 0x8049B10: (within /tmp/test)
==32217== Address 0x0 is not stack'd, malloc'd or free'd
==32217==
==32217== Syscall param socketcall.accept(addrlen_out) contains
uninitialised or
unaddressable byte(s)
==32217== at 0x4073ADE6: __libc_accept (in /lib/i686/libc-2.3.1.so)
==32217== by 0x401755B9: accept (vg_intercept.c:142)
==32217== by 0x8049B10: (within /tmp/test)
==32217== Address 0x0 is not stack'd, malloc'd or free'd
is it possible to patch the syscall wrappers so that they accept legal
NULL values in their parameters ? I tried to find out how to do that,
but I think I need some help to understant the many levels of
indirections in the wrapper invocation.
Thanks in advance
Stephane Donze
|
|
From: Tom H. <th...@cy...> - 2003-04-30 07:34:09
|
In message <105...@ma...>
Stephane Donze <ste...@ex...> wrote:
> is it possible to patch the syscall wrappers so that they accept legal
> NULL values in their parameters ? I tried to find out how to do that,
> but I think I need some help to understant the many levels of
> indirections in the wrapper invocation.
This should do the trick:
--- valgrind-20030428/coregrind/vg_syscalls.c.accept 2003-04-30 08:31:09.000000000 +0100
+++ valgrind-20030428/coregrind/vg_syscalls.c 2003-04-30 08:32:02.000000000 +0100
@@ -2949,12 +2949,14 @@
{
Addr addr_p = ((UInt*)arg2)[1];
Addr addrlen_p = ((UInt*)arg2)[2];
- buf_and_len_pre_check ( tst, addr_p, addrlen_p,
- "socketcall.accept(addr)",
- "socketcall.accept(addrlen_in)" );
- KERNEL_DO_SYSCALL(tid,res);
- buf_and_len_post_check ( tst, res, addr_p, addrlen_p,
- "socketcall.accept(addrlen_out)" );
+ if (addr_p)
+ buf_and_len_pre_check ( tst, addr_p, addrlen_p,
+ "socketcall.accept(addr)",
+ "socketcall.accept(addrlen_in)" );
+ KERNEL_DO_SYSCALL(tid,res);
+ if (addr_p)
+ buf_and_len_post_check ( tst, res, addr_p, addrlen_p,
+ "socketcall.accept(addrlen_out)" );
}
break;
}
Tom
--
Tom Hughes (th...@cy...)
Software Engineer, Cyberscience Corporation
http://www.cyberscience.com/
|
|
From: Nicholas N. <nj...@ca...> - 2003-05-02 16:02:57
|
On 30 Apr 2003, Tom Hughes wrote: > > is it possible to patch the syscall wrappers so that they accept legal > > NULL values in their parameters ? I tried to find out how to do that, > > but I think I need some help to understant the many levels of > > indirections in the wrapper invocation. > > This should do the trick: Committed to CVS HEAD, thanks. N |