You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Sreekanth Ramakrishnan (JIRA)" <ji...@apache.org> on 2009/03/11 11:41:50 UTC

[jira] Created: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Glibc double free exception thrown when chown syscall fails.
------------------------------------------------------------

                 Key: HADOOP-5462
                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
             Project: Hadoop Core
          Issue Type: Bug
            Reporter: Sreekanth Ramakrishnan


When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Posted by "Sreekanth Ramakrishnan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sreekanth Ramakrishnan updated HADOOP-5462:
-------------------------------------------

    Attachment: hadoop-5462-2.patch

Incorporated Hemanths comment:

* Moved TT root checking before switching user.
* Initialized the structure in configuration.c so that values are initalized properly.

> Glibc double free exception thrown when chown syscall fails.
> ------------------------------------------------------------
>
>                 Key: HADOOP-5462
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: mapred
>    Affects Versions: 0.21.0
>            Reporter: Sreekanth Ramakrishnan
>            Assignee: Sreekanth Ramakrishnan
>         Attachments: hadoop-5462-1.patch, hadoop-5462-2.patch, HADOOP-5462.patch
>
>
> When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Posted by "Hemanth Yamijala (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hemanth Yamijala updated HADOOP-5462:
-------------------------------------

          Component/s: mapred
    Affects Version/s: 0.21.0

> Glibc double free exception thrown when chown syscall fails.
> ------------------------------------------------------------
>
>                 Key: HADOOP-5462
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: mapred
>    Affects Versions: 0.21.0
>            Reporter: Sreekanth Ramakrishnan
>            Assignee: Sreekanth Ramakrishnan
>         Attachments: HADOOP-5462.patch
>
>
> When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Posted by "Hemanth Yamijala (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12697031#action_12697031 ] 

Hemanth Yamijala commented on HADOOP-5462:
------------------------------------------

The core test failures are not related. I just committed this to trunk. Thanks, Sreekanth !

> Glibc double free exception thrown when chown syscall fails.
> ------------------------------------------------------------
>
>                 Key: HADOOP-5462
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: mapred
>    Affects Versions: 0.21.0
>            Reporter: Sreekanth Ramakrishnan
>            Assignee: Sreekanth Ramakrishnan
>             Fix For: 0.21.0
>
>         Attachments: hadoop-5462-1.patch, hadoop-5462-2.patch, HADOOP-5462.patch
>
>
> When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12696768#action_12696768 ] 

Hadoop QA commented on HADOOP-5462:
-----------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12404806/hadoop-5462-2.patch
  against trunk revision 762885.

    +1 @author.  The patch does not contain any @author tags.

    -1 tests included.  The patch doesn't appear to include any new or modified tests.
                        Please justify why no tests are needed for this patch.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs warnings.

    -1 Eclipse classpath. The patch causes the Eclipse classpath to differ from the contents of the lib directories.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    -1 core tests.  The patch failed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/160/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/160/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/160/artifact/trunk/build/test/checkstyle-errors.html
Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/160/console

This message is automatically generated.

> Glibc double free exception thrown when chown syscall fails.
> ------------------------------------------------------------
>
>                 Key: HADOOP-5462
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: mapred
>    Affects Versions: 0.21.0
>            Reporter: Sreekanth Ramakrishnan
>            Assignee: Sreekanth Ramakrishnan
>         Attachments: hadoop-5462-1.patch, hadoop-5462-2.patch, HADOOP-5462.patch
>
>
> When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Posted by "Sreekanth Ramakrishnan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sreekanth Ramakrishnan updated HADOOP-5462:
-------------------------------------------

    Status: Patch Available  (was: Open)

> Glibc double free exception thrown when chown syscall fails.
> ------------------------------------------------------------
>
>                 Key: HADOOP-5462
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: mapred
>    Affects Versions: 0.21.0
>            Reporter: Sreekanth Ramakrishnan
>            Assignee: Sreekanth Ramakrishnan
>         Attachments: hadoop-5462-1.patch, hadoop-5462-2.patch, HADOOP-5462.patch
>
>
> When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Posted by "Hemanth Yamijala (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12695993#action_12695993 ] 

Hemanth Yamijala commented on HADOOP-5462:
------------------------------------------

Few comments on the patch:

- run_task_as_user: variable task_script is unused.
- run_task_as_user: when the pid_path variable is freed, it would be good to set it to NULL. Same holds for task_script_path if execlp fails.
- run_task_as_user: Regarding the removal of chown, though the call is not necessary, I am thinking a better idea is to actually do this *after* switching the user. I don't see why root privileges are required to do this operation. This way, the file would be written as owned by the child, with the right permissions (so, no need for the chmod as well).
- kill_user_task: Like above, I think we can have the reading of the pid file happen after switching the user. Coupled with that change, since the file will be written as the user itself, it can be read back by him as well.
- run_task_as_user: We are doing an fclose of LOGFILE (both explicitly and by the fcloseall call) before execlp, but afterwards, we are writing to it in some error conditions. Maybe we can just remove these prints. Coupled with the above changes to do more operations after switching the user, it may mean that we cannot log in even more cases. Because the error codes are indicative enough, I think this is fine though.


> Glibc double free exception thrown when chown syscall fails.
> ------------------------------------------------------------
>
>                 Key: HADOOP-5462
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: mapred
>    Affects Versions: 0.21.0
>            Reporter: Sreekanth Ramakrishnan
>            Assignee: Sreekanth Ramakrishnan
>         Attachments: HADOOP-5462.patch
>
>
> When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Posted by "Hemanth Yamijala (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12696414#action_12696414 ] 

Hemanth Yamijala commented on HADOOP-5462:
------------------------------------------

After the above comments are implemented, I think it is good to go. So make this patch available after that.

> Glibc double free exception thrown when chown syscall fails.
> ------------------------------------------------------------
>
>                 Key: HADOOP-5462
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: mapred
>    Affects Versions: 0.21.0
>            Reporter: Sreekanth Ramakrishnan
>            Assignee: Sreekanth Ramakrishnan
>         Attachments: hadoop-5462-1.patch, HADOOP-5462.patch
>
>
> When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Posted by "Hemanth Yamijala (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680875#action_12680875 ] 

Hemanth Yamijala commented on HADOOP-5462:
------------------------------------------

bq. When setuid script's chown call fails ...

This could happen if deployment of the setuid executable is not done correctly as we discovered during a deployment exercise.



> Glibc double free exception thrown when chown syscall fails.
> ------------------------------------------------------------
>
>                 Key: HADOOP-5462
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: mapred
>    Affects Versions: 0.21.0
>            Reporter: Sreekanth Ramakrishnan
>            Assignee: Sreekanth Ramakrishnan
>         Attachments: HADOOP-5462.patch
>
>
> When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Posted by "Sreekanth Ramakrishnan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sreekanth Ramakrishnan updated HADOOP-5462:
-------------------------------------------

    Attachment: hadoop-5462-1.patch

Removed chown and chmod calls in the run_task_as_user.

Changed the way binary switches user, now binary immediately switches to the passed user and then writes out the .pid file, so chown and chmod calls is no longer required.

Removed fprintf statements which were called after switching the user. Removed appropriate error codes.

> Glibc double free exception thrown when chown syscall fails.
> ------------------------------------------------------------
>
>                 Key: HADOOP-5462
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: mapred
>    Affects Versions: 0.21.0
>            Reporter: Sreekanth Ramakrishnan
>            Assignee: Sreekanth Ramakrishnan
>         Attachments: hadoop-5462-1.patch, HADOOP-5462.patch
>
>
> When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Posted by "Sreekanth Ramakrishnan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sreekanth Ramakrishnan reassigned HADOOP-5462:
----------------------------------------------

    Assignee: Sreekanth Ramakrishnan

> Glibc double free exception thrown when chown syscall fails.
> ------------------------------------------------------------
>
>                 Key: HADOOP-5462
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
>             Project: Hadoop Core
>          Issue Type: Bug
>            Reporter: Sreekanth Ramakrishnan
>            Assignee: Sreekanth Ramakrishnan
>         Attachments: HADOOP-5462.patch
>
>
> When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Posted by "Hemanth Yamijala (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hemanth Yamijala updated HADOOP-5462:
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 0.21.0
     Hadoop Flags: [Reviewed]
           Status: Resolved  (was: Patch Available)

> Glibc double free exception thrown when chown syscall fails.
> ------------------------------------------------------------
>
>                 Key: HADOOP-5462
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: mapred
>    Affects Versions: 0.21.0
>            Reporter: Sreekanth Ramakrishnan
>            Assignee: Sreekanth Ramakrishnan
>             Fix For: 0.21.0
>
>         Attachments: hadoop-5462-1.patch, hadoop-5462-2.patch, HADOOP-5462.patch
>
>
> When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Posted by "Sreekanth Ramakrishnan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sreekanth Ramakrishnan updated HADOOP-5462:
-------------------------------------------

    Attachment: HADOOP-5462.patch

Attaching patch which fixes this issue.

> Glibc double free exception thrown when chown syscall fails.
> ------------------------------------------------------------
>
>                 Key: HADOOP-5462
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
>             Project: Hadoop Core
>          Issue Type: Bug
>            Reporter: Sreekanth Ramakrishnan
>         Attachments: HADOOP-5462.patch
>
>
> When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-5462) Glibc double free exception thrown when chown syscall fails.

Posted by "Hemanth Yamijala (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12696412#action_12696412 ] 

Hemanth Yamijala commented on HADOOP-5462:
------------------------------------------

Looking good.

Minor points:

I think the setuid exe should work if the task-controller.cfg file is readable only by root. Hence, it makes sense to change the user after loading the configuration which happens after the first call to check_tt_root.
Another problem with the current code is that if the setuid operation fails, then we are freeing up the configuration. But the config struct is not memset to 0. Hence it might have garbage values and fail. I think it is better to initialize this to a zero'ed structure.

> Glibc double free exception thrown when chown syscall fails.
> ------------------------------------------------------------
>
>                 Key: HADOOP-5462
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5462
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: mapred
>    Affects Versions: 0.21.0
>            Reporter: Sreekanth Ramakrishnan
>            Assignee: Sreekanth Ramakrishnan
>         Attachments: hadoop-5462-1.patch, HADOOP-5462.patch
>
>
> When setuid script's chown call fails, a glibc double free exception is thrown. The reason for this is that file_handle which was opened to write the pid file is already closed and the cleanup: label tries to close it once again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.