Remove RVAL_PRINT_ERR_VAL

* defs.h (RVAL_PRINT_ERR_VAL): Remove.
* ldt.c (SYS_FUNC(modify_ldt)): Return 0.
* syscall.c (syscall_exiting_trace): When printing an error,
always print struct tcb.u_rval as if RVAL_PRINT_ERR_VAL was set.
This commit is contained in:
Дмитрий Левин 2018-03-29 16:00:18 +00:00
parent 92d7499fbf
commit 884d3ae479
3 changed files with 5 additions and 12 deletions

4
defs.h
View File

@ -332,10 +332,6 @@ extern const struct xlat whence_codes[];
#define RVAL_DECODED 0100 /* syscall decoding finished */
#define RVAL_IOCTL_DECODED 0200 /* ioctl sub-parser successfully decoded
the argument */
#define RVAL_PRINT_ERR_VAL 0400 /* Print decoded error code along with
syscall return value. Needed for modify_ldt
that for some reason decides to return
an error with higher bits set to 0. */
#define IOCTL_NUMBER_UNKNOWN 0
#define IOCTL_NUMBER_HANDLED 1

2
ldt.c
View File

@ -155,7 +155,7 @@ SYS_FUNC(modify_ldt)
tcp->u_error = -(unsigned int) tcp->u_rval;
return RVAL_PRINT_ERR_VAL;
return 0;
}
SYS_FUNC(set_thread_area)

View File

@ -821,7 +821,6 @@ syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res)
tprints(") ");
tabto();
unsigned long u_error = tcp->u_error;
kernel_long_t u_rval;
if (raw(tcp)) {
if (u_error) {
@ -889,15 +888,13 @@ syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res)
tprints("= ? ERESTART_RESTARTBLOCK (Interrupted by signal)");
break;
default:
u_rval = sys_res & RVAL_PRINT_ERR_VAL ?
tcp->u_rval : -1;
u_error_str = err_name(u_error);
if (u_error_str)
tprintf("= %" PRI_kld " %s (%s)",
u_rval, u_error_str, strerror(u_error));
tprintf("= %" PRI_kld " %s (%s)", tcp->u_rval,
u_error_str, strerror(u_error));
else
tprintf("= %" PRI_kld " %lu (%s)",
u_rval, u_error, strerror(u_error));
tprintf("= %" PRI_kld " %lu (%s)", tcp->u_rval,
u_error, strerror(u_error));
break;
}
if (syscall_tampered(tcp))