Bug 1254503 - fuse: check return value of setuid
fuse: check return value of setuid
Status: CLOSED CURRENTRELEASE
Product: GlusterFS
Classification: Community
Component: fuse (Show other bugs)
3.7.3
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Prasanna Kumar Kalever
:
Depends On: 1221490
Blocks: 1254488
  Show dependency treegraph
 
Reported: 2015-08-18 05:32 EDT by Prasanna Kumar Kalever
Modified: 2015-09-09 05:40 EDT (History)
3 users (show)

See Also:
Fixed In Version: glusterfs-3.7.4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1221490
Environment:
Last Closed: 2015-09-09 05:40:07 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Prasanna Kumar Kalever 2015-08-18 05:32:49 EDT
+++ This bug was initially created as a clone of Bug #1221490 +++

Description of problem:

setuid() sets the effective user ID of the calling process.  If the effective UID of the caller is root, the real UID and saved set-user-ID are also set.
On success, zero is returned.  On error, -1 is returned, and errno is set appropriately.

Note: there are cases where setuid() can fail even when the caller is UID 0; it is a grave security error to omit checking for a failure return from setuid().
if an environment limits the number of processes a user can have, setuid() might fail if the target uid already is at the limit.


Version-Release number of selected component (if applicable):

mainline

--- Additional comment from Anand Avati on 2015-05-14 04:53:38 EDT ---

REVIEW: http://review.gluster.org/10780 (fuse: fix return value check for setuid) posted (#1) for review on master by Prasanna Kumar Kalever

--- Additional comment from Anand Avati on 2015-05-14 05:08:10 EDT ---

REVIEW: http://review.gluster.org/10780 (fuse: fix return value check for setuid) posted (#2) for review on master by Prasanna Kumar Kalever

--- Additional comment from Niels de Vos on 2015-05-15 14:24:51 EDT ---

Assigning the bug to the owner of the patch, and moving the status to POST. Please do so for your own patches next time.

--- Additional comment from Anand Avati on 2015-05-15 15:26:59 EDT ---

REVIEW: http://review.gluster.org/10780 (fuse: fix return value check for setuid) posted (#3) for review on master by Prasanna Kumar Kalever

--- Additional comment from Anand Avati on 2015-05-16 03:19:20 EDT ---

COMMIT: http://review.gluster.org/10780 committed in master by Niels de Vos (ndevos@redhat.com) 
------
commit b5ceb1a9de9af563b0f91e2a3138fa5a95cad9f6
Author: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Date:   Thu May 14 12:10:01 2015 +0530

    fuse: fix return value check for setuid
    
    setuid() sets the effective user ID of the calling process. If the
    effective UID of the caller is root, the real UID and saved set-user-ID
    are also set. On success, zero is returned.  On error, -1 is returned,
    and errno is set appropriately.
    
    there are cases where setuid() can fail even when the caller is UID 0;
    it is a grave security error to omit checking for a failure return from
    setuid(). if an environment limits the number of processes a user can
    have, setuid() might fail if the target uid already is at the limit.
    
    Fix is to check return value of setuid.
    
    Change-Id: I7aa5ab5e347603c69dc93188417cc4f4c81ffc75
    BUG: 1221490
    Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
    Reviewed-on: http://review.gluster.org/10780
    Reviewed-by: Prasanna Kumar Kalever
    Tested-by: Prasanna Kumar Kalever
    Reviewed-by: Niels de Vos <ndevos@redhat.com>
    Tested-by: Gluster Build System <jenkins@build.gluster.com>
    Reviewed-by: Gaurav Kumar Garg <ggarg@redhat.com>
Comment 1 Niels de Vos 2015-08-18 07:37:23 EDT
Backport posted: http://review.gluster.org/11950
Comment 2 Anand Avati 2015-08-29 00:47:01 EDT
REVIEW: http://review.gluster.org/11950 (fuse: fix return value check for setuid) posted (#5) for review on release-3.7 by Niels de Vos (ndevos@redhat.com)
Comment 3 Anand Avati 2015-08-29 13:02:20 EDT
COMMIT: http://review.gluster.org/11950 committed in release-3.7 by Niels de Vos (ndevos@redhat.com) 
------
commit 5137feb6e0ab6c9b0aad1e8410397243e9f2619c
Author: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Date:   Thu May 14 12:10:01 2015 +0530

    fuse: fix return value check for setuid
    
    setuid() sets the effective user ID of the calling process. If the
    effective UID of the caller is root, the real UID and saved set-user-ID
    are also set. On success, zero is returned.  On error, -1 is returned,
    and errno is set appropriately.
    
    there are cases where setuid() can fail even when the caller is UID 0;
    it is a grave security error to omit checking for a failure return from
    setuid(). if an environment limits the number of processes a user can
    have, setuid() might fail if the target uid already is at the limit.
    
    Fix is to check return value of setuid.
    
    Backport:
    >Change-Id: I7aa5ab5e347603c69dc93188417cc4f4c81ffc75
    >BUG: 1221490
    >Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
    >Reviewed-on: http://review.gluster.org/10780
    >Reviewed-by: Prasanna Kumar Kalever
    >Tested-by: Prasanna Kumar Kalever
    >Reviewed-by: Niels de Vos <ndevos@redhat.com>
    >Tested-by: Gluster Build System <jenkins@build.gluster.com>
    >Reviewed-by: Gaurav Kumar Garg <ggarg@redhat.com>
    >(cherry picked from commit b5ceb1a9de9af563b0f91e2a3138fa5a95cad9f6)
    
    Change-Id: I5643ccecb56ea1d3c16de57bace3f5481931a539
    BUG: 1254503
    Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
    Reviewed-on: http://review.gluster.org/11950
    Reviewed-by: Niels de Vos <ndevos@redhat.com>
    Tested-by: Gluster Build System <jenkins@build.gluster.com>
    Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Comment 4 Kaushal 2015-09-09 05:40:07 EDT
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.7.4, please open a new bug report.

glusterfs-3.7.4 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/12496
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user

Note You need to log in before you can comment on or make changes to this bug.