Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6C97B200B3C for ; Wed, 29 Jun 2016 02:24:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6B4C2160A56; Wed, 29 Jun 2016 00:24:12 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B8839160A6E for ; Wed, 29 Jun 2016 02:24:11 +0200 (CEST) Received: (qmail 70267 invoked by uid 500); 29 Jun 2016 00:24:10 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 70076 invoked by uid 99); 29 Jun 2016 00:24:10 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jun 2016 00:24:10 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 6994B2C028C for ; Wed, 29 Jun 2016 00:24:10 +0000 (UTC) Date: Wed, 29 Jun 2016 00:24:10 +0000 (UTC) From: "Andrew Wang (JIRA)" To: common-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HADOOP-12345) Credential length in CredentialsSys.java incorrect MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 29 Jun 2016 00:24:12 -0000 [ https://issues.apache.org/jira/browse/HADOOP-12345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15353974#comment-15353974 ] Andrew Wang commented on HADOOP-12345: -------------------------------------- Looked at the PR. Can we add a test for the length % 4 == 0 case? I think the current code is not quite right: {code} + int padding = 0; + // we do not need compute padding if the hostname is already a multiple of 4 + if (mHostName.getBytes(Charsets.UTF_8).length != 0) { + padding = 4 - (mHostName.getBytes(Charsets.UTF_8).length % 4); + } {code} I think you meant to check that the len % 4 != 0. I think it'd be even better though if we just {{%4}} the padding one more time, saves the if statement. Also we only need that comment about the padding once, can delete the second one. > Credential length in CredentialsSys.java incorrect > -------------------------------------------------- > > Key: HADOOP-12345 > URL: https://issues.apache.org/jira/browse/HADOOP-12345 > Project: Hadoop Common > Issue Type: Bug > Components: nfs > Affects Versions: 2.6.0, 2.7.0 > Reporter: Pradeep Nayak Udupi Kadbet > Priority: Critical > Attachments: HADOOP-12345.patch > > > Hi - > There is a bug in the way hadoop-nfs sets the credential length in "Credentials" field of the NFS RPC packet when using AUTH_SYS > In CredentialsSys.java, when we are writing the creds in to XDR object, we set the length as follows: > // mStamp + mHostName.length + mHostName + mUID + mGID + mAuxGIDs.count > 96 mCredentialsLength = 20 + mHostName.getBytes().length; > (20 corresponds to 4 bytes for mStamp, 4 bytes for mUID, 4 bytes for mGID, 4 bytes for length field of hostname, 4 bytes for number of aux 4 gids) and this is okay. > However when we add the length of the hostname to this, we are not adding the extra padded bytes for the hostname (If the length is not a multiple of 4) and thus when the NFS server reads the packet, it returns GARBAGE_ARGS because it doesn't read the uid field when it is expected to read. I can reproduce this issue constantly on machines where the hostname length is not a multiple of 4. > A possible fix is to do something this: > int pad = mHostName.getBytes().length % 4; > // mStamp + mHostName.length + mHostName + mUID + mGID + mAuxGIDs.count > mCredentialsLength = 20 + mHostName.getBytes().length + pad; > I would be happy to submit the patch but I need some help to commit into mainline. I haven't committed into Hadoop yet. > Cheers! > Pradeep -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-issues-help@hadoop.apache.org