Hadoop HDFS
  1. Hadoop HDFS
  2. HDFS-6582

Missing null check in RpcProgramNfs3#read(XDR, SecurityHandler)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.6.0
    • Component/s: nfs
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Around line 691:

              FSDataInputStream fis = clientCache.getDfsInputStream(userName,
                  Nfs3Utils.getFileIdPath(handle));
      
              try {
                readCount = fis.read(offset, readbuffer, 0, count);
      

      fis may be null, leading to NullPointerException

      1. HDFS-6582.patch
        2 kB
        Abhiraj Butala

        Activity

        Hide
        Abhiraj Butala added a comment -

        Attaching a patch which checks fis and returns NFS3ERR_ACCES if its null. Also updated the corresponding unit test.

        Though I am not sure if there are any other conditions (apart from user not having permission) that can cause FSDataInputStream to be null. How did you hit this issue Ted Yu?

        Let me know what you guys think. Thanks!

        Show
        Abhiraj Butala added a comment - Attaching a patch which checks fis and returns NFS3ERR_ACCES if its null. Also updated the corresponding unit test. Though I am not sure if there are any other conditions (apart from user not having permission) that can cause FSDataInputStream to be null. How did you hit this issue Ted Yu ? Let me know what you guys think. Thanks!
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12660100/HDFS-6582.patch
        against trunk revision .

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

        +1 tests included. The patch appears to include 1 new or modified test files.

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

        +1 javadoc. There were no new javadoc warning messages.

        +1 eclipse:eclipse. The patch built with eclipse:eclipse.

        +1 findbugs. The patch does not introduce any new Findbugs (version 2.0.3) warnings.

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

        -1 core tests. The patch failed these unit tests in hadoop-hdfs-project/hadoop-hdfs-nfs:

        org.apache.hadoop.hdfs.nfs.TestMountd
        org.apache.hadoop.hdfs.nfs.nfs3.TestExportsTable
        org.apache.hadoop.hdfs.nfs.nfs3.TestClientAccessPrivilege
        org.apache.hadoop.hdfs.nfs.nfs3.TestReaddir
        org.apache.hadoop.hdfs.nfs.nfs3.TestWrites
        org.apache.hadoop.hdfs.nfs.nfs3.TestRpcProgramNfs3

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

        Test results: https://builds.apache.org/job/PreCommit-HDFS-Build/7571//testReport/
        Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/7571//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12660100/HDFS-6582.patch against trunk revision . +1 @author . The patch does not contain any @author tags. +1 tests included . The patch appears to include 1 new or modified test files. +1 javac . The applied patch does not increase the total number of javac compiler warnings. +1 javadoc . There were no new javadoc warning messages. +1 eclipse:eclipse . The patch built with eclipse:eclipse. +1 findbugs . The patch does not introduce any new Findbugs (version 2.0.3) warnings. +1 release audit . The applied patch does not increase the total number of release audit warnings. -1 core tests . The patch failed these unit tests in hadoop-hdfs-project/hadoop-hdfs-nfs: org.apache.hadoop.hdfs.nfs.TestMountd org.apache.hadoop.hdfs.nfs.nfs3.TestExportsTable org.apache.hadoop.hdfs.nfs.nfs3.TestClientAccessPrivilege org.apache.hadoop.hdfs.nfs.nfs3.TestReaddir org.apache.hadoop.hdfs.nfs.nfs3.TestWrites org.apache.hadoop.hdfs.nfs.nfs3.TestRpcProgramNfs3 +1 contrib tests . The patch passed contrib unit tests. Test results: https://builds.apache.org/job/PreCommit-HDFS-Build/7571//testReport/ Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/7571//console This message is automatically generated.
        Hide
        Abhiraj Butala added a comment -

        The failures seem unrelated to the patch. These tests pass for me locally. There is some issue in cluster setup in automation:

        Error Message
        
        asf901.ygridcore.net: asf901.ygridcore.net
        Stacktrace
        
        java.net.UnknownHostException: asf901.ygridcore.net: asf901.ygridcore.net
        	at java.net.InetAddress.getLocalHost(InetAddress.java:1402)
        	at org.apache.hadoop.security.SecurityUtil.getLocalHostName(SecurityUtil.java:187)
        	at org.apache.hadoop.security.SecurityUtil.login(SecurityUtil.java:207)
        	at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1936)
        	at org.apache.hadoop.hdfs.MiniDFSCluster.startDataNodes(MiniDFSCluster.java:1337)
        	at org.apache.hadoop.hdfs.MiniDFSCluster.initMiniDFSCluster(MiniDFSCluster.java:728)
        	at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:378)
        	at org.apache.hadoop.hdfs.MiniDFSCluster$Builder.build(MiniDFSCluster.java:359)
        	at org.apache.hadoop.hdfs.nfs.TestMountd.testStart(TestMountd.java:42)
        
        
        Show
        Abhiraj Butala added a comment - The failures seem unrelated to the patch. These tests pass for me locally. There is some issue in cluster setup in automation: Error Message asf901.ygridcore.net: asf901.ygridcore.net Stacktrace java.net.UnknownHostException: asf901.ygridcore.net: asf901.ygridcore.net at java.net.InetAddress.getLocalHost(InetAddress.java:1402) at org.apache.hadoop.security.SecurityUtil.getLocalHostName(SecurityUtil.java:187) at org.apache.hadoop.security.SecurityUtil.login(SecurityUtil.java:207) at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1936) at org.apache.hadoop.hdfs.MiniDFSCluster.startDataNodes(MiniDFSCluster.java:1337) at org.apache.hadoop.hdfs.MiniDFSCluster.initMiniDFSCluster(MiniDFSCluster.java:728) at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:378) at org.apache.hadoop.hdfs.MiniDFSCluster$Builder.build(MiniDFSCluster.java:359) at org.apache.hadoop.hdfs.nfs.TestMountd.testStart(TestMountd.java:42)
        Hide
        Brandon Li added a comment -

        +1

        Show
        Brandon Li added a comment - +1
        Hide
        Brandon Li added a comment -

        I've committed the patch. Thank you, Abhiraj Butala, for the contribution!

        Show
        Brandon Li added a comment - I've committed the patch. Thank you, Abhiraj Butala , for the contribution!
        Hide
        Hudson added a comment -

        FAILURE: Integrated in Hadoop-trunk-Commit #6048 (See https://builds.apache.org/job/Hadoop-trunk-Commit/6048/)
        HDFS-6582. Missing null check in RpcProgramNfs3#read(XDR, SecurityHandler). Contributed by Abhiraj Butala (brandonli: http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1617366)

        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java
        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/test/java/org/apache/hadoop/hdfs/nfs/nfs3/TestRpcProgramNfs3.java
        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        Show
        Hudson added a comment - FAILURE: Integrated in Hadoop-trunk-Commit #6048 (See https://builds.apache.org/job/Hadoop-trunk-Commit/6048/ ) HDFS-6582 . Missing null check in RpcProgramNfs3#read(XDR, SecurityHandler). Contributed by Abhiraj Butala (brandonli: http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1617366 ) /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/test/java/org/apache/hadoop/hdfs/nfs/nfs3/TestRpcProgramNfs3.java /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        Hide
        Hudson added a comment -

        SUCCESS: Integrated in Hadoop-Yarn-trunk #643 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/643/)
        HDFS-6582. Missing null check in RpcProgramNfs3#read(XDR, SecurityHandler). Contributed by Abhiraj Butala (brandonli: http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1617366)

        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java
        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/test/java/org/apache/hadoop/hdfs/nfs/nfs3/TestRpcProgramNfs3.java
        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        Show
        Hudson added a comment - SUCCESS: Integrated in Hadoop-Yarn-trunk #643 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/643/ ) HDFS-6582 . Missing null check in RpcProgramNfs3#read(XDR, SecurityHandler). Contributed by Abhiraj Butala (brandonli: http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1617366 ) /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/test/java/org/apache/hadoop/hdfs/nfs/nfs3/TestRpcProgramNfs3.java /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        Hide
        Hudson added a comment -

        SUCCESS: Integrated in Hadoop-Mapreduce-trunk #1861 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/1861/)
        HDFS-6582. Missing null check in RpcProgramNfs3#read(XDR, SecurityHandler). Contributed by Abhiraj Butala (brandonli: http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1617366)

        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java
        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/test/java/org/apache/hadoop/hdfs/nfs/nfs3/TestRpcProgramNfs3.java
        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        Show
        Hudson added a comment - SUCCESS: Integrated in Hadoop-Mapreduce-trunk #1861 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/1861/ ) HDFS-6582 . Missing null check in RpcProgramNfs3#read(XDR, SecurityHandler). Contributed by Abhiraj Butala (brandonli: http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1617366 ) /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/test/java/org/apache/hadoop/hdfs/nfs/nfs3/TestRpcProgramNfs3.java /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        Hide
        Hudson added a comment -

        FAILURE: Integrated in Hadoop-Hdfs-trunk #1835 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/1835/)
        HDFS-6582. Missing null check in RpcProgramNfs3#read(XDR, SecurityHandler). Contributed by Abhiraj Butala (brandonli: http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1617366)

        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java
        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/test/java/org/apache/hadoop/hdfs/nfs/nfs3/TestRpcProgramNfs3.java
        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        Show
        Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk #1835 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/1835/ ) HDFS-6582 . Missing null check in RpcProgramNfs3#read(XDR, SecurityHandler). Contributed by Abhiraj Butala (brandonli: http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1617366 ) /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/test/java/org/apache/hadoop/hdfs/nfs/nfs3/TestRpcProgramNfs3.java /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

          People

          • Assignee:
            Abhiraj Butala
            Reporter:
            Ted Yu
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development