From: Steve Dickson <steved@redhat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH] rpc.gssd: truncates 32-bit UIDs/GIDs to 16 bits architectures.
Date: Wed, 18 Jul 2018 08:11:07 -0400 [thread overview]
Message-ID: <20180718121107.16838-1-steved@redhat.com> (raw)
utils/gssd_proc.c uses SYS_setresuid and SYS_setresgid in
change_identity when it should use SYS_setresuid32 and
SYS_setresgid32 instead. This causes it to truncate
UIDs/GIDs > 65536.
Fixes: https://bugs.launchpad.net/ubuntu/+source/nfs-utils/+bug/1779962
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1595927
Tested-by: James Ettle <theholyettlz@googlemail.com>
Tested-by: Sree <Sree@gmail.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
utils/gssd/gssd_proc.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
index 8767e26..7a57c4e 100644
--- a/utils/gssd/gssd_proc.c
+++ b/utils/gssd/gssd_proc.c
@@ -434,6 +434,7 @@ static int
change_identity(uid_t uid)
{
struct passwd *pw;
+ int res;
/* drop list of supplimentary groups first */
if (syscall(SYS_setgroups, 0, 0) != 0) {
@@ -459,14 +460,23 @@ change_identity(uid_t uid)
* send a signal to all other threads to synchronize the uid in all
* other threads. To bypass this, we have to call syscall() directly.
*/
- if (syscall(SYS_setresgid, pw->pw_gid, pw->pw_gid, pw->pw_gid) != 0) {
+#ifdef __NR_setresuid32
+ res = syscall(SYS_setresgid32, pw->pw_gid, pw->pw_gid, pw->pw_gid);
+#else
+ res = syscall(SYS_setresgid, pw->pw_gid, pw->pw_gid, pw->pw_gid);
+#endif
+ if (res != 0) {
printerr(0, "WARNING: failed to set gid to %u!\n", pw->pw_gid);
return errno;
}
- if (syscall(SYS_setresuid, uid, uid, uid) != 0) {
- printerr(0, "WARNING: Failed to setuid for user with uid %u\n",
- uid);
+#ifdef __NR_setresuid32
+ res = syscall(SYS_setresuid32, uid, uid, uid);
+#else
+ res = syscall(SYS_setresuid, uid, uid, uid);
+#endif
+ if (res != 0) {
+ printerr(0, "WARNING: Failed to setuid for user with uid %u\n", uid);
return errno;
}
--
2.17.1
next reply other threads:[~2018-07-18 12:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 12:11 Steve Dickson [this message]
2018-07-18 12:33 ` [PATCH] rpc.gssd: truncates 32-bit UIDs/GIDs to 16 bits architectures Christoph Hellwig
2018-07-18 14:26 ` Steve Dickson
2018-07-18 15:27 ` Steve Dickson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180718121107.16838-1-steved@redhat.com \
--to=steved@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox