mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
Bug 462830 - WARNING: unhandled amd64-freebsd syscall: 474
Add syscall wrappers for sctp_generic_recvmsg and sctp_generic_sendmsg on FreeBSD.
This commit is contained in:
parent
35bb01dd45
commit
5b52408406
2
.gitignore
vendored
2
.gitignore
vendored
@ -1349,6 +1349,8 @@
|
||||
/memcheck/tests/freebsd/452275
|
||||
/memcheck/tests/freebsd/errno_aligned_allocs
|
||||
/memcheck/tests/freebsd/setproctitle
|
||||
/memcheck/tests/freebsd/sctp
|
||||
/memcheck/tests/freebsd/sctp2
|
||||
|
||||
# /memcheck/tests/amd64-freebsd
|
||||
/memcheck/tests/amd64-freebsd/*.stderr.diff
|
||||
|
||||
1
NEWS
1
NEWS
@ -26,6 +26,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
|
||||
351857 confusing error message about valid command line option
|
||||
444110 priv/guest_ppc_toIR.c:36198:31: warning: duplicated 'if' condition.
|
||||
459476 vgdb: allow address reuse to avoid "address already in use" errorsuse" errors
|
||||
462830 WARNING: unhandled amd64-freebsd syscall: 474
|
||||
|
||||
To see details of a given bug, visit
|
||||
https://bugs.kde.org/show_bug.cgi?id=XXXXXX
|
||||
|
||||
@ -419,6 +419,8 @@ DECL_TEMPLATE(freebsd, sys_abort2) // 463
|
||||
DECL_TEMPLATE(freebsd, sys_thr_set_name) // 464
|
||||
DECL_TEMPLATE(freebsd, sys_aio_fsync) // 465
|
||||
DECL_TEMPLATE(freebsd, sys_rtprio_thread) // 466
|
||||
DECL_TEMPLATE(freebsd, sys_sctp_generic_sendmsg) // 472
|
||||
DECL_TEMPLATE(freebsd, sys_sctp_generic_recvmsg) // 474
|
||||
DECL_TEMPLATE(freebsd, sys_pread) // 475
|
||||
DECL_TEMPLATE(freebsd, sys_pwrite) // 476
|
||||
DECL_TEMPLATE(freebsd, sys_mmap) // 477
|
||||
|
||||
@ -86,6 +86,9 @@ ML_(notify_core_and_tool_of_munmap) ( Addr a, SizeT len );
|
||||
extern void
|
||||
ML_(notify_core_and_tool_of_mprotect) ( Addr a, SizeT len, Int prot );
|
||||
|
||||
extern void
|
||||
ML_(pre_mem_read_sockaddr) ( ThreadId tid, const HChar *description,
|
||||
struct vki_sockaddr *sa, UInt salen );
|
||||
extern void
|
||||
ML_(buf_and_len_pre_check) ( ThreadId tid, Addr buf_p, Addr buflen_p,
|
||||
const HChar* buf_s, const HChar* buflen_s );
|
||||
|
||||
@ -325,14 +325,15 @@ PRE(sys_preadv)
|
||||
PRINT("sys_preadv ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %"
|
||||
FMT_REGWORD "d, %" FMT_REGWORD "d )", SARG1, ARG2, SARG3, SARG4);
|
||||
PRE_REG_READ4(ssize_t, "preadv",
|
||||
int, fd, const struct iovec *, iovr,
|
||||
int, fd, const struct iovec *, iov,
|
||||
int, iovcnt, vki_off_t, offset);
|
||||
if (!ML_(fd_allowed)(ARG1, "preadv", tid, False)) {
|
||||
SET_STATUS_Failure( VKI_EBADF );
|
||||
} else {
|
||||
if ((Int)ARG3 >= 0)
|
||||
if ((Int)ARG3 > 0)
|
||||
PRE_MEM_READ( "preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec) );
|
||||
|
||||
// @todo PJF improve this like readv
|
||||
if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) {
|
||||
vec = (struct vki_iovec *)(Addr)ARG2;
|
||||
for (i = 0; i < (Int)ARG3; i++)
|
||||
|
||||
@ -4770,11 +4770,28 @@ POST(sys_rtprio_thread)
|
||||
// int sctp_peeloff(int s, sctp_assoc_t id);
|
||||
// @todo
|
||||
|
||||
|
||||
// SYS_sctp_generic_sendmsg 472
|
||||
// int sctp_generic_sendmsg(int s, void *msg, int msglen, struct sockaddr *to,
|
||||
// socklen_t len, struct sctp_sndrcvinfo *sinfo, int flags);
|
||||
// @tdo
|
||||
//
|
||||
// Not called directly from libc
|
||||
PRE(sys_sctp_generic_sendmsg)
|
||||
{
|
||||
*flags |= SfMayBlock;
|
||||
PRINT("sys_sctp_generic_sendmsg ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "d )",SARG1,ARG2,ARG3,ARG4,SARG5,ARG6,SARG7);
|
||||
PRE_REG_READ7(ssize_t, "sctp_generic_sendmsg",
|
||||
int, s, void *, msg, int, msglen,
|
||||
struct sockaddr *, to, socklen_t, len,
|
||||
struct sctp_sndrcvinfo *, sinfo, int, flags);
|
||||
|
||||
PRE_MEM_READ( "sctp_generic_sendmsg(msg)", ARG2, ARG3);
|
||||
|
||||
ML_(pre_mem_read_sockaddr) (tid, "sctp_generic_sendmsg(to)", (struct vki_sockaddr *)ARG4, ARG5);
|
||||
|
||||
if (ARG6 != (Addr)NULL)
|
||||
PRE_MEM_READ( "sctp_generic_sendmsg(sinfo)", ARG6, sizeof(struct vki_sctp_sndrcvinfo));
|
||||
}
|
||||
|
||||
// SYS_sctp_generic_sendmsg_iov 473
|
||||
// int sctp_generic_sendmsg_iov(int s, struct iovec *iov, int iovlen,
|
||||
@ -4785,7 +4802,56 @@ POST(sys_rtprio_thread)
|
||||
// int sctp_generic_recvmsg(int s, struct iovec *iov, int iovlen,
|
||||
// struct sockaddr *from, socklen_t *fromlen,
|
||||
// struct sctp_sndrcvinfo *sinfo, int *msgflags);
|
||||
// @todo
|
||||
//
|
||||
// Not called directly from libc
|
||||
PRE(sys_sctp_generic_recvmsg)
|
||||
{
|
||||
*flags |= SfMayBlock;
|
||||
PRINT("sys_sctp_generic_recvmsg ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )",SARG1,ARG2,SARG3,ARG4,ARG5,ARG6,ARG7);
|
||||
PRE_REG_READ7(ssize_t, "sctp_generic_recvmsg",
|
||||
int, s, struct iovec *, iov, int, iovlen,
|
||||
struct sockaddr *, from, socklen_t *, fromlen,
|
||||
struct sctp_sndrcvinfo *, sinfo, int *, msgflags);
|
||||
|
||||
// in the sctp_recvmsg libc wrapper this is always 1
|
||||
if ((Int)ARG3 > 0) {
|
||||
PRE_MEM_READ( "sctp_generic_recvmsg(iov)", ARG2, ARG3 * sizeof(struct vki_iovec) );
|
||||
}
|
||||
if (ML_(safe_to_deref)((const void*)ARG2, ARG3 * sizeof(struct vki_iovec))) {
|
||||
struct vki_iovec* iovec = (struct vki_iovec*)ARG2;
|
||||
PRE_MEM_WRITE("sctp_generic_recvmsg(iov.iov_base)", (Addr)iovec->iov_base, iovec->iov_len);
|
||||
}
|
||||
|
||||
if (ARG4 != (Addr)NULL)
|
||||
ML_(buf_and_len_pre_check) (tid, ARG4, ARG5,
|
||||
"sctp_generic_recvmsg(from)",
|
||||
"sctp_generic_recvmsg(fromlen_in)");
|
||||
|
||||
if (ARG6 != (Addr)NULL)
|
||||
PRE_MEM_WRITE("sctp_generic_recvmsg(sinfo)", ARG6, sizeof(struct vki_sctp_sndrcvinfo));
|
||||
|
||||
if (ARG7 != (Addr)NULL)
|
||||
PRE_MEM_WRITE("sctp_generic_recvmsg(msgflags)", ARG7, sizeof(int));
|
||||
}
|
||||
|
||||
POST(sys_sctp_generic_recvmsg)
|
||||
{
|
||||
vg_assert(SUCCESS);
|
||||
struct vki_iovec* iovec = (struct vki_iovec*)ARG2;
|
||||
POST_MEM_WRITE((Addr)iovec->iov_base, iovec->iov_len);
|
||||
|
||||
POST_MEM_WRITE( ARG2, ARG3*sizeof(struct vki_iovec) );
|
||||
|
||||
if (ARG4 != (Addr)NULL)
|
||||
ML_(buf_and_len_post_check) (tid, VG_(mk_SysRes_Success)(RES), ARG4, ARG5,
|
||||
"sctp_generic_recvmsg(fromlen_out)");
|
||||
|
||||
if (ARG6 != (Addr)NULL)
|
||||
POST_MEM_WRITE(ARG6, sizeof(struct vki_sctp_sndrcvinfo));
|
||||
|
||||
if (ARG7 != (Addr)NULL)
|
||||
POST_MEM_WRITE(ARG7, sizeof(int));
|
||||
}
|
||||
|
||||
// SYS_pread 475
|
||||
// x86/amd64
|
||||
@ -7000,10 +7066,9 @@ const SyscallTableEntry ML_(syscall_table)[] = {
|
||||
BSDXY(__NR_rtprio_thread, sys_rtprio_thread), // 466
|
||||
|
||||
// unimpl sctp_peeloff 471
|
||||
|
||||
// unimpl sctp_generic_sendmsg 472
|
||||
BSDX_(__NR_sctp_generic_sendmsg, sys_sctp_generic_sendmsg), // 472
|
||||
// unimpl sctp_generic_sendmsg_iov 473
|
||||
// unimpl sctp_generic_recvmsg 474
|
||||
BSDXY(__NR_sctp_generic_recvmsg, sys_sctp_generic_recvmsg), // 474
|
||||
BSDXY(__NR_pread, sys_pread), // 475
|
||||
|
||||
BSDX_(__NR_pwrite, sys_pwrite), // 476
|
||||
|
||||
@ -1121,10 +1121,9 @@ static void check_cmsg_for_fds(ThreadId tid, struct vki_msghdr *msg)
|
||||
}
|
||||
|
||||
/* GrP kernel ignores sa_len (at least on Darwin); this checks the rest */
|
||||
static
|
||||
void pre_mem_read_sockaddr ( ThreadId tid,
|
||||
const HChar *description,
|
||||
struct vki_sockaddr *sa, UInt salen )
|
||||
void ML_(pre_mem_read_sockaddr) ( ThreadId tid,
|
||||
const HChar *description,
|
||||
struct vki_sockaddr *sa, UInt salen )
|
||||
{
|
||||
HChar outmsg[VG_(strlen)( description ) + 30]; // large enough
|
||||
struct vki_sockaddr_un* saun = (struct vki_sockaddr_un *)sa;
|
||||
@ -1524,7 +1523,7 @@ ML_(generic_PRE_sys_bind) ( ThreadId tid,
|
||||
{
|
||||
/* int bind(int sockfd, struct sockaddr *my_addr,
|
||||
int addrlen); */
|
||||
pre_mem_read_sockaddr(
|
||||
ML_(pre_mem_read_sockaddr) (
|
||||
tid, "socketcall.bind(my_addr.%s)",
|
||||
(struct vki_sockaddr *) arg1, arg2
|
||||
);
|
||||
@ -1580,7 +1579,7 @@ ML_(generic_PRE_sys_sendto) ( ThreadId tid,
|
||||
PRE_MEM_READ( "socketcall.sendto(msg)",
|
||||
arg1, /* msg */
|
||||
arg2 /* len */ );
|
||||
pre_mem_read_sockaddr(
|
||||
ML_(pre_mem_read_sockaddr) (
|
||||
tid, "socketcall.sendto(to.%s)",
|
||||
(struct vki_sockaddr *) arg4, arg5
|
||||
);
|
||||
@ -1673,7 +1672,7 @@ ML_(generic_PRE_sys_connect) ( ThreadId tid,
|
||||
{
|
||||
/* int connect(int sockfd,
|
||||
struct sockaddr *serv_addr, int addrlen ); */
|
||||
pre_mem_read_sockaddr( tid,
|
||||
ML_(pre_mem_read_sockaddr) ( tid,
|
||||
"socketcall.connect(serv_addr.%s)",
|
||||
(struct vki_sockaddr *) arg1, arg2);
|
||||
}
|
||||
|
||||
@ -750,13 +750,13 @@ PRE(sys_preadv)
|
||||
PRINT("sys_preadv ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %"
|
||||
FMT_REGWORD "d, %llu )", SARG1, ARG2, SARG3, MERGE64(ARG4,ARG5));
|
||||
PRE_REG_READ5(ssize_t, "preadv",
|
||||
int, fd, const struct iovec *, iovr,
|
||||
int, fd, const struct iovec *, iov,
|
||||
int, iovcnt, vki_uint32_t, MERGE64_FIRST(offset),
|
||||
vki_uint32_t, MERGE64_SECOND(offset));
|
||||
if (!ML_(fd_allowed)(ARG1, "preadv", tid, False)) {
|
||||
SET_STATUS_Failure( VKI_EBADF );
|
||||
} else {
|
||||
if ((Int)ARG3 >= 0)
|
||||
if ((Int)ARG3 > 0)
|
||||
PRE_MEM_READ( "preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec) );
|
||||
|
||||
if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) {
|
||||
|
||||
@ -771,6 +771,28 @@ struct vki_sockaddr_in6 {
|
||||
vki_uint32_t sin6_scope_id; /* scope id (new in RFC2553) */
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// From netinet/sctp_uio.h
|
||||
//----------------------------------------------------------------------
|
||||
#define VKI_SCTP_ALIGN_RESV_PAD 92
|
||||
|
||||
typedef vki_uint32_t vki_sctp_assoc_t;
|
||||
|
||||
struct vki_sctp_sndrcvinfo {
|
||||
vki_uint16_t sinfo_stream;
|
||||
vki_uint16_t sinfo_ssn;
|
||||
vki_uint16_t sinfo_flags;
|
||||
vki_uint32_t sinfo_ppid;
|
||||
vki_uint32_t sinfo_context;
|
||||
vki_uint32_t sinfo_timetolive;
|
||||
vki_uint32_t sinfo_tsn;
|
||||
vki_uint32_t sinfo_cumtsn;
|
||||
vki_sctp_assoc_t sinfo_assoc_id;
|
||||
vki_uint16_t sinfo_keynumber;
|
||||
vki_uint16_t sinfo_keynumber_valid;
|
||||
vki_uint8_t __reserve_pad[VKI_SCTP_ALIGN_RESV_PAD];
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// From sys/un.h
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
@ -84,7 +84,13 @@ EXTRA_DIST = \
|
||||
errno_aligned_allocs.stderr.exp \
|
||||
setproctitle.vgtest \
|
||||
setproctitle.stderr.exp \
|
||||
setproctitle.stdout.exp
|
||||
setproctitle.stdout.exp \
|
||||
sctp.vgtest \
|
||||
sctp.stderr.exp \
|
||||
sctp.stdout.exp \
|
||||
sctp2.vgtest \
|
||||
sctp2.stderr.exp \
|
||||
sctp2.stdout.exp
|
||||
|
||||
check_PROGRAMS = \
|
||||
statfs pdfork_pdkill getfsstat inlinfo inlinfo_nested.so extattr \
|
||||
@ -92,7 +98,7 @@ check_PROGRAMS = \
|
||||
linkat scalar_fork scalar_thr_exit scalar_abort2 scalar_pdfork \
|
||||
scalar_vfork stat file_locking_wait6 utimens access chmod_chown \
|
||||
misc get_set_context utimes static_allocs fexecve errno_aligned_allocs \
|
||||
setproctitle
|
||||
setproctitle sctp sctp2
|
||||
|
||||
AM_CFLAGS += $(AM_FLAG_M3264_PRI)
|
||||
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
|
||||
|
||||
@ -1571,11 +1571,27 @@ int main(void)
|
||||
// sctp_peeloff 471
|
||||
|
||||
// sctp_generic_sendmsg 472
|
||||
GO(SYS_sctp_generic_sendmsg, "7s 1m");
|
||||
SY(SYS_sctp_generic_sendmsg, x0+1, x0+2, x0+3, x0+4, x0+5, x0+6, x0+7); FAIL;
|
||||
|
||||
// sctp_generic_sendmsg_iov 473
|
||||
|
||||
// sctp_generic_recvmsg 474
|
||||
GO(SYS_sctp_generic_recvmsg, "7s 4m");
|
||||
SY(SYS_sctp_generic_recvmsg, x0+1, x0+2, x0+300, x0+4, x0+5, x0+6, x0+7); FAIL;
|
||||
|
||||
{
|
||||
socklen_t fromlen = 64;
|
||||
struct iovec iov;
|
||||
GO(SYS_sctp_generic_recvmsg, "6s 4m");
|
||||
SY(SYS_sctp_generic_recvmsg, x0+1, x0+2, x0+300, x0+4, &fromlen, x0+6, x0+7); FAIL;
|
||||
|
||||
iov.iov_base = x0+8;
|
||||
iov.iov_len = x0+9;
|
||||
|
||||
GO(SYS_sctp_generic_recvmsg, "6s 6m");
|
||||
SY(SYS_sctp_generic_recvmsg, x0+1, &iov, 1, x0+4, x0+5, x0+6, x0+7); FAIL;
|
||||
}
|
||||
|
||||
/* SYS_pread 475 */
|
||||
GO(SYS_pread, "4s 1m");
|
||||
|
||||
@ -2030,7 +2030,7 @@ Syscall param lutimes(times) points to unaddressable byte(s)
|
||||
Syscall param preadv(fd) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param preadv(iovr) contains uninitialised byte(s)
|
||||
Syscall param preadv(iov) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param preadv(iovcnt) contains uninitialised byte(s)
|
||||
@ -3680,6 +3680,149 @@ Syscall param rtprio_thread(rtp#set) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
---------------------------------------------------------
|
||||
472:SYS_sctp_generic_sendmsg 7s 1m
|
||||
---------------------------------------------------------
|
||||
Syscall param sctp_generic_sendmsg(s) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(msg) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(msglen) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(to) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(len) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(sinfo) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(flags) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(sinfo) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
---------------------------------------------------------
|
||||
474:SYS_sctp_generic_recvmsg 7s 4m
|
||||
---------------------------------------------------------
|
||||
Syscall param sctp_generic_recvmsg(s) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iov) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iovlen) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(from) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(fromlen) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(sinfo) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(msgflags) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iov) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(fromlen_in) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(sinfo) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(msgflags) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
---------------------------------------------------------
|
||||
474:SYS_sctp_generic_recvmsg 6s 4m
|
||||
---------------------------------------------------------
|
||||
Syscall param sctp_generic_recvmsg(s) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iov) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iovlen) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(from) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(sinfo) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(msgflags) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iov) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(from) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(sinfo) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(msgflags) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
---------------------------------------------------------
|
||||
474:SYS_sctp_generic_recvmsg 6s 6m
|
||||
---------------------------------------------------------
|
||||
Syscall param sctp_generic_recvmsg(s) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(from) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(fromlen) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(sinfo) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(msgflags) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iov) points to uninitialised byte(s)
|
||||
...
|
||||
Address 0x........ is on thread 1's stack
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iov.iov_base) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(fromlen_in) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(sinfo) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(msgflags) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
---------------------------------------------------------
|
||||
475: SYS_pread 4s 1m
|
||||
---------------------------------------------------------
|
||||
|
||||
@ -3689,6 +3689,149 @@ Syscall param rtprio_thread(rtp#set) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
---------------------------------------------------------
|
||||
472:SYS_sctp_generic_sendmsg 7s 1m
|
||||
---------------------------------------------------------
|
||||
Syscall param sctp_generic_sendmsg(s) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(msg) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(msglen) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(to) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(len) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(sinfo) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(flags) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_sendmsg(sinfo) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
---------------------------------------------------------
|
||||
474:SYS_sctp_generic_recvmsg 7s 4m
|
||||
---------------------------------------------------------
|
||||
Syscall param sctp_generic_recvmsg(s) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iov) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iovlen) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(from) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(fromlen) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(sinfo) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(msgflags) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iov) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(fromlen_in) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(sinfo) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(msgflags) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
---------------------------------------------------------
|
||||
474:SYS_sctp_generic_recvmsg 6s 4m
|
||||
---------------------------------------------------------
|
||||
Syscall param sctp_generic_recvmsg(s) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iov) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iovlen) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(from) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(sinfo) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(msgflags) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iov) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(from) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(sinfo) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(msgflags) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
---------------------------------------------------------
|
||||
474:SYS_sctp_generic_recvmsg 6s 6m
|
||||
---------------------------------------------------------
|
||||
Syscall param sctp_generic_recvmsg(s) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(from) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(fromlen) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(sinfo) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(msgflags) contains uninitialised byte(s)
|
||||
...
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iov) points to uninitialised byte(s)
|
||||
...
|
||||
Address 0x........ is on thread 1's stack
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iov.iov_base) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(fromlen_in) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(sinfo) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
Syscall param sctp_generic_recvmsg(msgflags) points to unaddressable byte(s)
|
||||
...
|
||||
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
||||
|
||||
---------------------------------------------------------
|
||||
475: SYS_pread 4s 1m
|
||||
---------------------------------------------------------
|
||||
|
||||
122
memcheck/tests/freebsd/sctp.c
Normal file
122
memcheck/tests/freebsd/sctp.c
Normal file
@ -0,0 +1,122 @@
|
||||
/* This is based on /src/tools/test/stress2/misc/sctp.sh
|
||||
* but it uses fork and the server exits rather than
|
||||
* loops indefinitely */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <libgen.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/sctp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static int my_port_num = 62324;
|
||||
|
||||
static void
|
||||
die(const char *s)
|
||||
{
|
||||
perror(s);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
server(void)
|
||||
{
|
||||
struct sctp_sndrcvinfo sndrcvinfo;
|
||||
struct sockaddr_in servaddr = {
|
||||
.sin_family = AF_INET,
|
||||
.sin_addr.s_addr = htonl(INADDR_ANY),
|
||||
.sin_port = htons(my_port_num),
|
||||
};
|
||||
struct sctp_initmsg initmsg = {
|
||||
.sinit_num_ostreams = 5,
|
||||
.sinit_max_instreams = 5,
|
||||
.sinit_max_attempts = 4,
|
||||
};
|
||||
int listen_fd, conn_fd, flags, ret, in;
|
||||
|
||||
listen_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP);
|
||||
if (listen_fd < 0)
|
||||
die("socket");
|
||||
|
||||
ret = bind(listen_fd, (struct sockaddr *) &servaddr, sizeof(servaddr));
|
||||
if (ret < 0)
|
||||
die("bind");
|
||||
|
||||
ret = setsockopt(listen_fd, IPPROTO_SCTP, SCTP_INITMSG, &initmsg,
|
||||
sizeof(initmsg));
|
||||
if (ret < 0)
|
||||
die("setsockopt");
|
||||
|
||||
ret = listen(listen_fd, initmsg.sinit_max_instreams);
|
||||
if (ret < 0)
|
||||
die("listen");
|
||||
|
||||
char buffer[1024];
|
||||
|
||||
printf("Waiting for connection\n");
|
||||
fflush(stdout);
|
||||
|
||||
conn_fd = accept(listen_fd, (struct sockaddr *) NULL, NULL);
|
||||
if(conn_fd < 0)
|
||||
die("accept()");
|
||||
|
||||
printf("New client connected\n");
|
||||
fflush(stdout);
|
||||
|
||||
/* Note that flags is uninitialized here */
|
||||
in = sctp_recvmsg(conn_fd, buffer, sizeof(buffer), NULL, 0,
|
||||
&sndrcvinfo, &flags);
|
||||
if (in > 0) {
|
||||
printf("Received data: %s\n", buffer);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
close(conn_fd);
|
||||
}
|
||||
|
||||
static void
|
||||
client(void)
|
||||
{
|
||||
struct sockaddr_in servaddr = {
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons(my_port_num),
|
||||
.sin_addr.s_addr = inet_addr("127.0.0.1"),
|
||||
};
|
||||
int conn_fd, ret;
|
||||
const char *msg = "Hello, Server!";
|
||||
|
||||
conn_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP);
|
||||
if (conn_fd < 0)
|
||||
die("socket()");
|
||||
|
||||
ret = connect(conn_fd, (struct sockaddr *) &servaddr, sizeof(servaddr));
|
||||
if (ret < 0)
|
||||
die("connect()");
|
||||
|
||||
ret = sctp_sendmsg(conn_fd, (void *) msg, strlen(msg) + 1, NULL, 0, 0, 0, 0, 0, 0 );
|
||||
if (ret < 0)
|
||||
die("sctp_sendmsg");
|
||||
|
||||
close(conn_fd);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc __unused, char *argv[])
|
||||
{
|
||||
switch (fork())
|
||||
{
|
||||
case 0:
|
||||
sleep(1);
|
||||
client();
|
||||
exit(EXIT_SUCCESS);
|
||||
default:
|
||||
server();
|
||||
exit(EXIT_SUCCESS);
|
||||
case -1:
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
0
memcheck/tests/freebsd/sctp.stderr.exp
Normal file
0
memcheck/tests/freebsd/sctp.stderr.exp
Normal file
3
memcheck/tests/freebsd/sctp.stdout.exp
Normal file
3
memcheck/tests/freebsd/sctp.stdout.exp
Normal file
@ -0,0 +1,3 @@
|
||||
Waiting for connection
|
||||
New client connected
|
||||
Received data: Hello, Server!
|
||||
3
memcheck/tests/freebsd/sctp.vgtest
Normal file
3
memcheck/tests/freebsd/sctp.vgtest
Normal file
@ -0,0 +1,3 @@
|
||||
prereq: kldstat -m sctp > /dev/null
|
||||
vgopts: -q --trace-children=yes
|
||||
prog: sctp
|
||||
42
memcheck/tests/freebsd/sctp2.c
Normal file
42
memcheck/tests/freebsd/sctp2.c
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <libgen.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/sctp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "../../memcheck.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int conn_fd;
|
||||
char msg[10];
|
||||
char buffer[10];
|
||||
struct sockaddr to;
|
||||
socklen_t tolen = sizeof (struct sockaddr);
|
||||
uint32_t ppid;
|
||||
uint32_t flags;
|
||||
uint16_t stream_no;
|
||||
uint32_t timetolive;
|
||||
uint32_t context;
|
||||
struct sctp_sndrcvinfo sinfo;
|
||||
int rflags;
|
||||
size_t undef_size = 10U;
|
||||
|
||||
VALGRIND_MAKE_MEM_UNDEFINED(&undef_size, sizeof(undef_size));
|
||||
VALGRIND_MAKE_MEM_UNDEFINED(&tolen, sizeof(tolen));
|
||||
|
||||
sctp_sendmsg(conn_fd, msg, undef_size, &to, tolen, ppid, flags, stream_no, timetolive, context);
|
||||
|
||||
VALGRIND_MAKE_MEM_NOACCESS(&to, sizeof(to));
|
||||
VALGRIND_MAKE_MEM_UNDEFINED(&tolen, sizeof(tolen));
|
||||
VALGRIND_MAKE_MEM_NOACCESS(&sinfo, sizeof(sinfo));
|
||||
VALGRIND_MAKE_MEM_NOACCESS(&rflags, sizeof(rflags));
|
||||
|
||||
sctp_recvmsg(conn_fd, buffer, undef_size, &to, &tolen, &sinfo, &rflags);
|
||||
}
|
||||
75
memcheck/tests/freebsd/sctp2.stderr.exp
Normal file
75
memcheck/tests/freebsd/sctp2.stderr.exp
Normal file
@ -0,0 +1,75 @@
|
||||
|
||||
Syscall param sctp_generic_sendmsg(s) contains uninitialised byte(s)
|
||||
...
|
||||
by 0x........: main (sctp2.c:34)
|
||||
|
||||
Syscall param sctp_generic_sendmsg(msglen) contains uninitialised byte(s)
|
||||
...
|
||||
by 0x........: main (sctp2.c:34)
|
||||
|
||||
Syscall param sctp_generic_sendmsg(len) contains uninitialised byte(s)
|
||||
...
|
||||
by 0x........: main (sctp2.c:34)
|
||||
|
||||
Syscall param sctp_generic_sendmsg(msg) points to uninitialised byte(s)
|
||||
...
|
||||
by 0x........: main (sctp2.c:34)
|
||||
Address 0x........ is on thread 1's stack
|
||||
in frame #2, created by main (sctp2.c:16)
|
||||
|
||||
Syscall param sctp_generic_sendmsg(to) points to uninitialised byte(s)
|
||||
...
|
||||
by 0x........: main (sctp2.c:34)
|
||||
Address 0x........ is on thread 1's stack
|
||||
in frame #2, created by main (sctp2.c:16)
|
||||
|
||||
Syscall param sctp_generic_sendmsg(sinfo) points to uninitialised byte(s)
|
||||
...
|
||||
by 0x........: main (sctp2.c:34)
|
||||
Address 0x........ is on thread 1's stack
|
||||
in frame #1, created by sctp_sendmsg (???:)
|
||||
|
||||
Syscall param sctp_generic_recvmsg(s) contains uninitialised byte(s)
|
||||
...
|
||||
by 0x........: main (sctp2.c:41)
|
||||
|
||||
Syscall param sctp_generic_recvmsg(iov) points to uninitialised byte(s)
|
||||
...
|
||||
by 0x........: main (sctp2.c:41)
|
||||
Address 0x........ is on thread 1's stack
|
||||
in frame #1, created by sctp_recvmsg (???:)
|
||||
|
||||
Syscall param sctp_generic_recvmsg(fromlen_in) points to uninitialised byte(s)
|
||||
...
|
||||
by 0x........: main (sctp2.c:41)
|
||||
Address 0x........ is on thread 1's stack
|
||||
in frame #2, created by main (sctp2.c:16)
|
||||
|
||||
Syscall param sctp_generic_recvmsg(from) points to unaddressable byte(s)
|
||||
...
|
||||
by 0x........: main (sctp2.c:41)
|
||||
Address 0x........ is on thread 1's stack
|
||||
in frame #2, created by main (sctp2.c:16)
|
||||
|
||||
Syscall param sctp_generic_recvmsg(sinfo) points to unaddressable byte(s)
|
||||
...
|
||||
by 0x........: main (sctp2.c:41)
|
||||
Address 0x........ is on thread 1's stack
|
||||
in frame #2, created by main (sctp2.c:16)
|
||||
|
||||
Syscall param sctp_generic_recvmsg(msgflags) points to unaddressable byte(s)
|
||||
...
|
||||
by 0x........: main (sctp2.c:41)
|
||||
Address 0x........ is on thread 1's stack
|
||||
in frame #2, created by main (sctp2.c:16)
|
||||
|
||||
|
||||
HEAP SUMMARY:
|
||||
in use at exit: 0 bytes in 0 blocks
|
||||
total heap usage: 0 allocs, 0 frees, 0 bytes allocated
|
||||
|
||||
For a detailed leak analysis, rerun with: --leak-check=full
|
||||
|
||||
Use --track-origins=yes to see where uninitialised values come from
|
||||
For lists of detected and suppressed errors, rerun with: -s
|
||||
ERROR SUMMARY: 14 errors from 12 contexts (suppressed: 0 from 0)
|
||||
0
memcheck/tests/freebsd/sctp2.stdout.exp
Normal file
0
memcheck/tests/freebsd/sctp2.stdout.exp
Normal file
2
memcheck/tests/freebsd/sctp2.vgtest
Normal file
2
memcheck/tests/freebsd/sctp2.vgtest
Normal file
@ -0,0 +1,2 @@
|
||||
prereq: kldstat -m sctp > /dev/null
|
||||
prog: sctp2
|
||||
Loading…
x
Reference in New Issue
Block a user