|
From: Nicholas N. <nj...@ca...> - 2004-11-12 18:20:23
|
CVS commit by nethercote:
converted some more
M +49 -54 coregrind/vg_syscalls.c 1.184
M +37 -12 memcheck/tests/scalar.c 1.15
M +101 -0 memcheck/tests/scalar.stderr.exp 1.14
--- valgrind/coregrind/vg_syscalls.c #1.183:1.184
@@ -1065,4 +1065,9 @@ static Bool fd_allowed(Int fd, const Cha
ambiguity.
+ Note that we use our own vki_* types. The one exception is in
+ PRE_REG_READn calls, where pointer types haven't been changed, because
+ they don't need to be -- eg. for "foo*" to be used, the type foo need not
+ be visible.
+
XXX: some of these are arch-specific, and should be factored out.
*/
@@ -1939,5 +1944,5 @@ PREx(sys_alarm, NBRunInLWP)
}
-PRE(brk)
+PREx(sys_brk, Special)
{
Addr brk_limit = VG_(brk_limit);
@@ -1958,5 +1963,6 @@ PRE(brk)
Both will seg fault if you shrink it back into a text segment.
*/
- PRINT("brk ( %p )",arg1);
+ PRINT("sys_brk ( %p )", arg1);
+ PRE_REG_READ1(unsigned long, "brk", unsigned long, end_data_segment);
set_result( do_brk(arg1) );
@@ -2050,13 +2056,14 @@ POST(dup2)
}
-PRE(fcntl)
+PREx(sys_fcntl, 0)
{
- /* int fcntl(int fd, int cmd, int arg); */
- PRINT("fcntl ( %d, %d, %d )",arg1,arg2,arg3);
+ PRINT("sys_fcntl ( %d, %d, %d )", arg1,arg2,arg3);
+ PRE_REG_READ3(long, "fcntl",
+ unsigned int, fd, unsigned int, cmd, unsigned long, arg);
if (arg2 == VKI_F_SETLKW)
tst->sys_flags |= MayBlock;
}
-POST(fcntl)
+POST(sys_fcntl)
{
if (arg2 == VKI_F_DUPFD) {
@@ -2909,17 +2916,10 @@ POST(ipc)
}
-PRE(ioctl)
+PREx(sys_ioctl, MayBlock)
{
- /* int ioctl(int d, int request, ...)
- [The "third" argument is traditionally char *argp,
- and will be so named for this discussion.]
- */
- /*
- VG_(message)(
- Vg_DebugMsg,
- "is an IOCTL, request = 0x%x, d = %d, argp = 0x%x",
- arg2,arg1,arg3);
- */
- PRINT("ioctl ( %d, 0x%x, %p )",arg1,arg2,arg3);
+ PRINT("sys_ioctl ( %d, 0x%x, %p )",arg1,arg2,arg3);
+ PRE_REG_READ3(long, "ioctl",
+ unsigned int, fd, unsigned int, request, unsigned long, arg);
+
switch (arg2 /* request */) {
case VKI_TCSETS:
@@ -3510,17 +3510,6 @@ PRE(ioctl)
}
-POST(ioctl)
+POST(sys_ioctl)
{
- /* int ioctl(int d, int request, ...)
- [The "third" argument is traditionally char *argp,
- and will be so named for this discussion.]
- */
- /*
- VG_(message)(
- Vg_DebugMsg,
- "is an IOCTL, request = 0x%x, d = %d, argp = 0x%x",
- arg2,arg1,arg3);
- */
- PRINT("ioctl ( %d, 0x%x, %p )",arg1,arg2,arg3);
switch (arg2 /* request */) {
case VKI_TCSETS:
@@ -4499,8 +4488,14 @@ PRE(setfsgid32)
}
-PRE(setgid)
+PREx(sys_setgid16, 0)
{
- /* int setgid(gid_t gid); */
- PRINT("setgid ( %d )", arg1);
+ PRINT("sys_setgid16 ( %d )", arg1);
+ PRE_REG_READ1(long, "setgid16", vki_old_gid_t, gid);
+}
+
+PREx(sys_setgid, 0)
+{
+ PRINT("sys_setgid ( %d )", arg1);
+ PRE_REG_READ1(long, "setgid", vki_gid_t, gid);
}
@@ -4523,11 +4518,11 @@ PRE(setgroups)
PREALIAS(setgroups32, setgroups);
-PRE(setpgid)
+PREx(sys_setpgid, 0)
{
- /* int setpgid(pid_t pid, pid_t pgid); */
PRINT("setpgid ( %d, %d )", arg1, arg2);
+ PRE_REG_READ2(long, "setpgid", vki_pid_t, pid, vki_pid_t, pgid);
}
-POST(setpgid)
+POST(sys_setpgid)
{
VG_(main_pgrp) = VG_(getpgrp)();
@@ -5068,12 +5063,12 @@ POST(sys_time)
}
-PRE(times)
+PREx(sys_times, 0)
{
- /* clock_t times(struct tms *buf); */
- PRINT("times ( %p )",arg1);
+ PRINT("sys_times ( %p )", arg1);
+ PRE_REG_READ1(long, "times", struct tms *, buf);
PRE_MEM_WRITE( "times(buf)", arg1, sizeof(struct vki_tms) );
}
-POST(times)
+POST(sys_times)
{
if (arg1 != (UWord)NULL) {
@@ -5089,8 +5084,8 @@ PRE(truncate)
}
-PRE(umask)
+PREx(sys_umask, 0)
{
- /* mode_t umask(mode_t mask); */
- PRINT("umask ( %d )", arg1);
+ PRINT("sys_umask ( %d )", arg1);
+ PRE_REG_READ1(long, "umask", int, mask);
}
@@ -5873,9 +5868,9 @@ static const struct sys_info sys_info[]
SYSXY(__NR_dup, sys_dup), // 41 * P
SYSXY(__NR_pipe, sys_pipe), // 42 (x86) P
- SYSBA(times, 0), // 43 sys_times *
+ SYSXY(__NR_times, sys_times), // 43 * P
SYSX_(__NR_prof, sys_ni_syscall), // 44 * P -- unimplemented
- SYSB_(brk, Special), // 45 sys_brk *
- SYSB_(setgid, 0), // 46 sys_setgid16 ##
+ SYSX_(__NR_brk, sys_brk), // 45 * non-P
+ SYSX_(__NR_setgid, sys_setgid16), // 46 ## (SVr4,SVID)
SYSX_(__NR_getgid, sys_getgid16), // 47 ## P
// (__NR_signal, sys_signal), // 48 * (ANSI C?)
@@ -5886,13 +5881,13 @@ static const struct sys_info sys_info[]
SYSX_(__NR_umount2, sys_umount), // 52 * L
SYSX_(__NR_lock, sys_ni_syscall), // 53 * P -- unimplemented
- SYSBA(ioctl, MayBlock), // 54 sys_ioctl *
+ SYSXY(__NR_ioctl, sys_ioctl), // 54 * (varying)
- SYSBA(fcntl, 0), // 55 sys_fcntl *
+ SYSXY(__NR_fcntl, sys_fcntl), // 55 * (P...complex)
SYSX_(__NR_mpx, sys_ni_syscall), // 56 * P -- unimplemented
- SYSBA(setpgid, 0), // 57 sys_setpgid *
+ SYSXY(__NR_setpgid, sys_setpgid), // 57 * P
SYSX_(__NR_ulimit, sys_ni_syscall), // 58 * P -- unimplemented
// (__NR_oldolduname, sys_olduname), // 59 (?) L -- obsolete
- SYSB_(umask, 0), // 60 sys_umask *
+ SYSX_(__NR_umask, sys_umask), // 60 * P
SYSB_(chroot, 0), // 61 sys_chroot *
// (__NR_ustat, sys_ustat) // 62 * (SVr4, deprecated)
@@ -6081,5 +6076,5 @@ static const struct sys_info sys_info[]
SYSB_(chown32, 0), // 212 sys_chown *
SYSX_(__NR_setuid32, sys_setuid), // 213 *
- SYSB_(setgid32, 0), // 214 sys_setgid *
+ SYSX_(__NR_setgid32, sys_setgid), // 214 * (SVr4,SVID)
SYSB_(setfsuid32, 0), // 215 sys_setfsuid *
--- valgrind/memcheck/tests/scalar.c #1.14:1.15
@@ -13,4 +13,7 @@ int main(void)
// All __NR_xxx numbers are taken from x86
+ // __NR_restart_syscall 1 XXX ???
+ // (see below)
+
// __NR_exit 1
// (see below)
@@ -144,5 +147,5 @@ int main(void)
SY(__NR_access, s0, i0);
- // __NR_nice 34
+ // __NR_nice 34 --> sys_nice()
GO(__NR_nice, "1s 0m");
SY(__NR_nice, i0);
@@ -156,29 +159,31 @@ int main(void)
SY(__NR_sync);
- // __NR_kill 37
+ // __NR_kill 37 --> sys_kill()
GO(__NR_kill, "2s 0m");
SY(__NR_kill, i0, i0);
- // __NR_rename 38
+ // __NR_rename 38 --> sys_rename()
GO(__NR_rename, "2s 2m");
SY(__NR_rename, s0, s0);
- // __NR_mkdir 39
+ // __NR_mkdir 39 --> sys_mkdir()
GO(__NR_mkdir, "2s 1m");
SY(__NR_mkdir, s0, i0);
- // __NR_rmdir 40
+ // __NR_rmdir 40 --> sys_rmdir()
GO(__NR_rmdir, "1s 1m");
SY(__NR_rmdir, s0);
- // __NR_dup 41
+ // __NR_dup 41 --> sys_dup()
GO(__NR_dup, "1s 0m");
SY(__NR_dup, i0);
- // __NR_pipe 42
+ // __NR_pipe 42 --> arch/sys_pipe()
GO(__NR_pipe, "1s 1m");
SY(__NR_pipe, s0);
- // __NR_times 43
+ // __NR_times 43 --> sys_times()
+ GO(__NR_times, "1s 1m");
+ SY(__NR_times, s0);
// __NR_prof 44 --> sys_ni_syscall()
@@ -186,6 +191,11 @@ int main(void)
SY(__NR_prof);
- // __NR_brk 45
- // __NR_setgid 46
+ // __NR_brk 45 --> sys_brk()
+ GO(__NR_brk, "1s 0m");
+ SY(__NR_brk, i0);
+
+ // __NR_setgid 46 --> sys_setgid16()
+ GO(__NR_setgid, "1s 0m");
+ SY(__NR_setgid);
// __NR_getgid 47 --> sys_getgid16()
@@ -194,4 +204,5 @@ int main(void)
// __NR_signal 48
+ // (Not yet handled by Valgrind)
// __NR_geteuid 49 --> sys_geteuid16()
@@ -215,6 +226,12 @@ int main(void)
SY(__NR_lock);
- // __NR_ioctl 54
- // __NR_fcntl 55
+ // __NR_ioctl 54 --> sys_ioctl()
+ #include <asm/ioctls.h>
+ GO(__NR_ioctl, "3s 1m");
+ SY(__NR_ioctl, i0, i0+TCSETS, s0);
+
+ // __NR_fcntl 55 --> sys_fcntl()
+ GO(__NR_fcntl, "3s 0m");
+ SY(__NR_fcntl, i0, i0, i0);
// __NR_mpx 56 --> sys_ni_syscall()
@@ -223,4 +240,6 @@ int main(void)
// __NR_setpgid 57
+ GO(__NR_setpgid, "2s 0m");
+ SY(__NR_setpgid, i0, i0);
// __NR_ulimit 58 --> sys_ni_syscall()
@@ -232,4 +251,7 @@ int main(void)
// __NR_umask 60
+ GO(__NR_umask, "1s 0m");
+ SY(__NR_umask, i0);
+
// __NR_chroot 61
// __NR_ustat 62
@@ -450,4 +472,7 @@ int main(void)
// __NR_setgid32 214
+ GO(__NR_setgid32, "1s 0m");
+ SY(__NR_setgid32);
+
// __NR_setfsuid32 215
// __NR_setfsgid32 216
--- valgrind/memcheck/tests/scalar.stderr.exp #1.13:1.14
@@ -557,7 +557,37 @@
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
+ 43: __NR_times 1s 1m
+-----------------------------------------------------
+
+Syscall param times(buf) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+
+Syscall param times(buf) points to unaddressable byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
44: __NR_prof 0e
-----------------------------------------------------
-----------------------------------------------------
+ 45: __NR_brk 1s 0m
+-----------------------------------------------------
+
+Syscall param brk(end_data_segment) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+-----------------------------------------------------
+ 46: __NR_setgid 1s 0m
+-----------------------------------------------------
+
+Syscall param setgid16(gid) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+-----------------------------------------------------
47: __NR_getgid 0e
-----------------------------------------------------
@@ -605,10 +635,73 @@
-----------------------------------------------------
-----------------------------------------------------
+ 54: __NR_ioctl 3s 1m
+-----------------------------------------------------
+
+Syscall param ioctl(fd) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+
+Syscall param ioctl(request) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+
+Syscall param ioctl(arg) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+
+Syscall param ioctl(TCSET{S,SW,SF}) points to unaddressable byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
+ 55: __NR_fcntl 3s 0m
+-----------------------------------------------------
+
+Syscall param fcntl(fd) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+
+Syscall param fcntl(cmd) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+
+Syscall param fcntl(arg) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+-----------------------------------------------------
56: __NR_mpx 0e
-----------------------------------------------------
-----------------------------------------------------
+ 57: __NR_setpgid 2s 0m
+-----------------------------------------------------
+
+Syscall param setpgid(pid) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+
+Syscall param setpgid(pgid) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+-----------------------------------------------------
58: __NR_ulimit 0e
-----------------------------------------------------
-----------------------------------------------------
+ 60: __NR_umask 1s 0m
+-----------------------------------------------------
+
+Syscall param umask(mask) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+-----------------------------------------------------
64: __NR_getppid 0e
-----------------------------------------------------
@@ -675,4 +768,12 @@
by 0x........: ...
-----------------------------------------------------
+214: __NR_setgid32 1s 0m
+-----------------------------------------------------
+
+Syscall param setgid(gid) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+-----------------------------------------------------
222: 222 0e
-----------------------------------------------------
|