}
}
-PRE(mount)
+PRE(sys_mount)
{
- // int mount(const char *source, const char *target,
- // const char *filesystemtype, unsigned long mountflags,
- // const void *data);
- PRINT( "mount( %p, %p, %p, %p, %p )" ,arg1,arg2,arg3);
- PRE_MEM_RASCIIZ( "mount(specialfile)", arg1);
- PRE_MEM_RASCIIZ( "mount(dir)", arg2);
- PRE_MEM_RASCIIZ( "mount(filesystemtype)", arg3);
+ // Nb: depending on 'flags', the 'type' and 'data' args may be ignored.
+ // We are conservative and check everything, except the memory pointed to
+ // by 'data'.
+ PRINT( "sys_mount( %p, %p, %p, %p, %p )" ,arg1,arg2,arg3);
+ PRE_REG_READ5(long, "mount",
+ char __user *, source, char __user *, target,
+ char __user *, type, unsigned long, flags,
+ void __user *, data);
+ PRE_MEM_RASCIIZ( "mount(source)", arg1);
+ PRE_MEM_RASCIIZ( "mount(target)", arg2);
+ PRE_MEM_RASCIIZ( "mount(type)", arg3);
}
PRE(umount)
PRINT("getgid32 ()");
}
-PRE(getpid)
+PRE(sys_getpid)
{
- /* pid_t getpid(void); */
- PRINT("getpid ()");
+ PRINT("sys_getpid ()");
+ PRE_REG_READ0(long, "getpid");
}
PRE(getpgid)
PRINT("getpgrp ()");
}
-PRE(getppid)
+PRE(sys_getppid)
{
- /* pid_t getppid(void); */
- PRINT("getppid ()");
+ PRINT("sys_getppid ()");
+ PRE_REG_READ0(long, "getppid");
}
PRE(getresgid)
static const struct sys_info sys_info[] = {
SYSBA(ptrace, 0),
- SYSB_(mount, MayBlock),
+ SYSX_(__NR_mount, sys_mount, MayBlock),
SYSB_(umount, 0),
SYSB_(setresgid, 0),
SYSB_(getegid32, 0),
SYSB_(getgid, 0),
SYSB_(getgid32, 0),
- SYSB_(getpid, 0),
+ SYSX_(__NR_getpid, sys_getpid, 0),
SYSB_(getpgid, 0),
SYSB_(getpgrp, 0),
- SYSB_(getppid, 0),
+ SYSX_(__NR_getppid, sys_getppid, 0),
SYSBA(getresgid, 0),
SYSBA(getresgid32, 0),
SYSBA(getresuid, 0),
// meaningful with the syscalls.
void GO(char* s) {
- fprintf(stderr, "---------- %s ----------\n", s);
+ fprintf(stderr, "---------- %s\n", s);
}
int main(void)
// __NR_break 17
// __NR_oldstat 18
// __NR_lseek 19
- // __NR_getpid 20
+ // __NR_getpid 20 --> sys_getpid()
+ GO("__NR_getpid, 0 errors");
+ syscall(__NR_getpid);
+
// __NR_mount 21
+ GO("__NR_mount, 4 scalar errors, 3 memory errors");
+ syscall(__NR_mount, s0, s0, s0, i0, s0);
+
// __NR_umount 22
// __NR_setuid 23
// __NR_getuid 24
// __NR_chroot 61
// __NR_ustat 62
// __NR_dup2 63
+
// __NR_getppid 64
+ GO("__NR_getppid, 0 errors");
+ syscall(__NR_getppid);
+
// __NR_getpgrp 65
// __NR_setsid 66
// __NR_sigaction 67
----------- __NR_read, 1+3 scalar errors ----------
+---------- __NR_read, 1+3 scalar errors
Syscall param (syscallno) contains uninitialised byte(s)
at 0x........: syscall (in /...libc...)
by 0x........: __libc_start_main (...libc...)
at 0x........: syscall (in /...libc...)
by 0x........: __libc_start_main (...libc...)
by 0x........: ...
----------- __NR_write, 3 scalar errors, 1 memory error ----------
+---------- __NR_write, 3 scalar errors, 1 memory error
Syscall param write(fd) contains uninitialised 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
----------- __NR_open(2), 2 scalar errors, 1 memory error ----------
+---------- __NR_open(2), 2 scalar errors, 1 memory error
Syscall param open(filename) contains uninitialised 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
----------- __NR_open(3), 1 scalar error ----------
+---------- __NR_open(3), 1 scalar error
Syscall param open(mode) contains uninitialised byte(s)
at 0x........: syscall (in /...libc...)
by 0x........: __libc_start_main (...libc...)
by 0x........: ...
----------- __NR_exit, 1 scalar error ----------
+---------- __NR_getpid, 0 errors
+---------- __NR_mount, 4 scalar errors, 3 memory errors
+
+Syscall param mount(source) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+
+Syscall param mount(target) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+
+Syscall param mount(type) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+
+Syscall param mount(flags) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+
+Syscall param mount(data) contains uninitialised byte(s)
+ at 0x........: syscall (in /...libc...)
+ by 0x........: __libc_start_main (...libc...)
+ by 0x........: ...
+
+Syscall param mount(source) 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
+
+Syscall param mount(target) 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
+
+Syscall param mount(type) 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
+---------- __NR_getppid, 0 errors
+---------- __NR_exit, 1 scalar error
Syscall param exit(error_code) contains uninitialised byte(s)
at 0x........: syscall (in /...libc...)