Treat RVAL_DECIMAL the same way as RVAL_UDECIMAL
Assuming that syscalls may return negative values only as error codes, always print non-error syscall return codes as unsigned. * defs.h (RVAL_UDECIMAL): Remove. (RVAL_DECIMAL): Rename to RVAL_UDECIMAL. * syscall.c (syscall_exiting_trace) <case RVAL_DECIMAL>: Remove. * clone.c (SYS_FUNC(fork)): Remove RVAL_UDECIMAL. * lseek.c (SYS_FUNC(lseek)): Likewise. * prctl.c (SYS_FUNC(prctl)): Likewise. * uid.c (SYS_FUNC(getuid), SYS_FUNC(setfsuid)): Likewise. * times.c (SYS_FUNC(times)): Always return 0. * tests/inject-nf.c (main): Update expected output.
This commit is contained in:
parent
fc56ecefd1
commit
92d7499fbf
2
clone.c
2
clone.c
@ -161,5 +161,5 @@ SYS_FUNC(unshare)
|
||||
|
||||
SYS_FUNC(fork)
|
||||
{
|
||||
return RVAL_DECODED | RVAL_UDECIMAL;
|
||||
return RVAL_DECODED;
|
||||
}
|
||||
|
3
defs.h
3
defs.h
@ -320,10 +320,9 @@ extern const struct xlat tcp_states[];
|
||||
extern const struct xlat whence_codes[];
|
||||
|
||||
/* Format of syscall return values */
|
||||
#define RVAL_DECIMAL 000 /* decimal format */
|
||||
#define RVAL_UDECIMAL 000 /* unsigned decimal format */
|
||||
#define RVAL_HEX 001 /* hex format */
|
||||
#define RVAL_OCTAL 002 /* octal format */
|
||||
#define RVAL_UDECIMAL 003 /* unsigned decimal format */
|
||||
#define RVAL_FD 010 /* file descriptor */
|
||||
#define RVAL_MASK 013 /* mask for these values */
|
||||
|
||||
|
2
lseek.c
2
lseek.c
@ -62,7 +62,7 @@ SYS_FUNC(lseek)
|
||||
|
||||
printxval(whence_codes, tcp->u_arg[2], "SEEK_???");
|
||||
|
||||
return RVAL_DECODED | RVAL_UDECIMAL;
|
||||
return RVAL_DECODED;
|
||||
}
|
||||
|
||||
/* llseek syscall takes explicitly two ulong arguments hi, lo,
|
||||
|
2
prctl.c
2
prctl.c
@ -373,7 +373,7 @@ SYS_FUNC(prctl)
|
||||
return 0;
|
||||
tcp->auxstr = xlookup(pr_mce_kill_policy,
|
||||
(kernel_ulong_t) tcp->u_rval);
|
||||
return tcp->auxstr ? RVAL_STR : RVAL_UDECIMAL;
|
||||
return RVAL_STR;
|
||||
|
||||
case PR_SET_FP_MODE:
|
||||
tprints(", ");
|
||||
|
10
syscall.c
10
syscall.c
@ -935,16 +935,6 @@ syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res)
|
||||
tprintf("= %" PRI_klu, tcp->u_rval);
|
||||
}
|
||||
break;
|
||||
case RVAL_DECIMAL:
|
||||
#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG
|
||||
if (current_klongsize < sizeof(tcp->u_rval)) {
|
||||
tprintf("= %d", (int) tcp->u_rval);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
tprintf("= %" PRI_kld, tcp->u_rval);
|
||||
}
|
||||
break;
|
||||
case RVAL_FD:
|
||||
if (show_fd_path) {
|
||||
tprints("= ");
|
||||
|
@ -76,8 +76,8 @@ main(int ac, char **av)
|
||||
(unsigned long long) err);
|
||||
|
||||
if (ac == 2) {
|
||||
printf("%s() = %lld (INJECTED)\n",
|
||||
SC_NAME, sign_extend_unsigned_to_ll(rc));
|
||||
printf("%s() = %llu (INJECTED)\n",
|
||||
SC_NAME, (unsigned long long) rc);
|
||||
|
||||
puts("+++ exited with 0 +++");
|
||||
}
|
||||
|
7
times.c
7
times.c
@ -42,10 +42,7 @@ SYS_FUNC(times)
|
||||
{
|
||||
tms_t tbuf;
|
||||
|
||||
if (entering(tcp))
|
||||
return 0;
|
||||
|
||||
if (!umove_or_printaddr(tcp, tcp->u_arg[0], &tbuf)) {
|
||||
if (exiting(tcp) && !umove_or_printaddr(tcp, tcp->u_arg[0], &tbuf)) {
|
||||
tprintf("{tms_utime=%llu, tms_stime=%llu, ",
|
||||
zero_extend_signed_to_ull(tbuf.tms_utime),
|
||||
zero_extend_signed_to_ull(tbuf.tms_stime));
|
||||
@ -54,5 +51,5 @@ SYS_FUNC(times)
|
||||
zero_extend_signed_to_ull(tbuf.tms_cstime));
|
||||
}
|
||||
|
||||
return syserror(tcp) ? RVAL_DECIMAL : RVAL_UDECIMAL;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user