From 884d3ae479d14dce918fd41fd492ba2f7659eaf9 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" <ldv@altlinux.org> Date: Thu, 29 Mar 2018 16:00:18 +0000 Subject: [PATCH] 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. --- defs.h | 4 ---- ldt.c | 2 +- syscall.c | 11 ++++------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/defs.h b/defs.h index 4f000eec..abe81c33 100644 --- a/defs.h +++ b/defs.h @@ -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 diff --git a/ldt.c b/ldt.c index 682847ed..104abc31 100644 --- a/ldt.c +++ b/ldt.c @@ -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) diff --git a/syscall.c b/syscall.c index 367e955d..363ac74c 100644 --- a/syscall.c +++ b/syscall.c @@ -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)) -- 2.40.0