]> granicus.if.org Git - strace/commitdiff
Do not truncate return value of get{,e}[ug]id and setfs[ug]id syscalls
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 27 Dec 2015 00:18:03 +0000 (00:18 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 27 Dec 2015 00:18:03 +0000 (00:18 +0000)
This should not be a user visible change unless the kernel does
something completely unexpected.  In the latter case, let user see
what is going on.

* uid.c (SYS_FUNC(getuid), SYS_FUNC(setfsuid)): Do not truncate
tcp->u_rval to uid_t on exiting syscall, return RVAL_DECODED.

uid.c

diff --git a/uid.c b/uid.c
index ef55070e9e0a978349dc30c866840e77cca73502..c8723924966816e602eba4a25a149dc69a3599bd 100644 (file)
--- a/uid.c
+++ b/uid.c
 
 SYS_FUNC(getuid)
 {
-       if (exiting(tcp))
-               tcp->u_rval = (uid_t) tcp->u_rval;
-       return RVAL_UDECIMAL;
+       return RVAL_UDECIMAL | RVAL_DECODED;
 }
 
 SYS_FUNC(setfsuid)
 {
        if (entering(tcp))
                tprintf("%u", (uid_t) tcp->u_arg[0]);
-       else
-               tcp->u_rval = (uid_t) tcp->u_rval;
-       return RVAL_UDECIMAL;
+
+       return RVAL_UDECIMAL | RVAL_DECODED;
 }
 
 SYS_FUNC(setuid)