You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Alexey Serbin (Code Review)" <ge...@cloudera.org> on 2022/02/11 04:57:12 UTC

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Alexey Serbin has uploaded this change for review. ( http://gerrit.cloudera.org:8080/18223


Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................

KUDU-3352 fix handling sockaddr_in in Sockaddr

Since the Sockaddr class has been updated to handle various address
families, an issue with uninitialized memory in the storage_.in.sin_zero
started affecting the behavior of the Sockaddr::HashCode() method.
As the result, ReactorThread::FindOrStartConnection() could create a new
connection to the specified remote even if a connection with the
required credentials policy had already been established.

This patch addresses the issue by zeroing the padding 'sin_zero' field
of the sockaddr_in structure stored in the Sockaddr::storage_ field for
sockets of the AF_INET family.  I also added a new test scenario to
reproduce the issue, verifying that the scenario fails if not applying
the corresponding part of this patch to src/kudu/util/net/sockaddr.cc:

  [ RUN      ] SockaddrHashTest.ZeroPadding
  src/kudu/util/net/socket-test.cc:68: Failure
  Expected equality of these values:
    s_in.HashCode()
      Which is: 4164645418
    s_un.HashCode()
      Which is: 3759279765
  [  FAILED  ] SockaddrHashTest.ZeroPadding (1 ms)

Credit goes to Wenzhe Zhou for detecting and troubleshooting the issue.

This is a follow-up to 79079b6b64295b06c5a0f05ed200a55d89bccc47.

Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
---
M src/kudu/util/net/sockaddr.cc
M src/kudu/util/net/socket-test.cc
2 files changed, 52 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/23/18223/1
-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/18223 )

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................


Patch Set 5: Verified+1

unrelated test failure in DnsAliasITest.Kudu1885


-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 5
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Comment-Date: Fri, 11 Feb 2022 20:13:09 +0000
Gerrit-HasComments: No

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Attila Bukor, Kudu Jenkins, Abhishek Chennaka, Wenzhe Zhou, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/18223

to look at the new patch set (#4).

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................

KUDU-3352 fix handling sockaddr_in in Sockaddr

Since the Sockaddr class has been updated to handle various address
families, an issue with uninitialized memory in the storage_.in.sin_zero
started affecting the behavior of the BytewiseCompare() and HashCode()
methods.  As the result, ReactorThread::FindOrStartConnection() could
create a new connection to the specified remote even if a connection
with the required credentials policy had already been established.

This patch addresses the issue by not counting the padding 'sin_zero'
field of the sockaddr_in structure in the length of Sockaddr::storage_
which is passed to Sockaddr::{BytewiseCompare,HashCode}().

I also added a new test scenario to reproduce the issue, verifying that
the scenario fails if not applying the corresponding part of this patch
to src/kudu/util/net/sockaddr.cc:

  [ RUN      ] SockaddrHashTest.ZeroPadding
  src/kudu/util/net/socket-test.cc:69: Failure
  Expected equality of these values:
    s_in.HashCode()
      Which is: 2868988679
    s_un.HashCode()
      Which is: 1786951233
  [  FAILED  ] SockaddrHashTest.ZeroPadding (0 ms)

Credit goes to Wenzhe Zhou for detecting and troubleshooting the issue.

This is a follow-up to 79079b6b64295b06c5a0f05ed200a55d89bccc47.

Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
---
M src/kudu/util/net/sockaddr.cc
M src/kudu/util/net/sockaddr.h
M src/kudu/util/net/socket-test.cc
3 files changed, 75 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/23/18223/4
-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 4
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Wenzhe Zhou (Code Review)" <ge...@cloudera.org>.
Wenzhe Zhou has posted comments on this change. ( http://gerrit.cloudera.org:8080/18223 )

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................


Patch Set 3:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/18223/3/src/kudu/util/net/sockaddr.cc
File src/kudu/util/net/sockaddr.cc:

http://gerrit.cloudera.org:8080/#/c/18223/3/src/kudu/util/net/sockaddr.cc@110
PS3, Line 110: HashCode()
Except function HashCode(), it also affects function BytewiseCompare().


http://gerrit.cloudera.org:8080/#/c/18223/3/src/kudu/util/net/sockaddr.cc@188
PS3, Line 188: sizeof(addr)
set length as offsetof(struct sockaddr_in, sin_zero))



-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 3
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Comment-Date: Fri, 11 Feb 2022 17:48:47 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Attila Bukor, Kudu Jenkins, Abhishek Chennaka, Wenzhe Zhou, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/18223

to look at the new patch set (#5).

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................

KUDU-3352 fix handling sockaddr_in in Sockaddr

Since the Sockaddr class has been updated to handle various address
families, an issue with uninitialized memory in the storage_.in.sin_zero
started affecting the behavior of the BytewiseCompare() and HashCode()
methods.  As the result, ReactorThread::FindOrStartConnection() could
create a new connection to the specified remote even if a connection
with the required credentials policy had already been established.

This patch addresses the issue by not counting the padding 'sin_zero'
field of the sockaddr_in structure in the length of Sockaddr::storage_
which is passed to Sockaddr::{BytewiseCompare,HashCode}().

I also added a new test scenario to reproduce the issue, verifying that
the scenario fails if not applying the corresponding part of this patch
to src/kudu/util/net/sockaddr.cc:

  [ RUN      ] SockaddrHashTest.ZeroPadding
  src/kudu/util/net/socket-test.cc:69: Failure
  Expected equality of these values:
    s_in.HashCode()
      Which is: 2868988679
    s_un.HashCode()
      Which is: 1786951233
  [  FAILED  ] SockaddrHashTest.ZeroPadding (0 ms)

Credit goes to Wenzhe Zhou for detecting and troubleshooting the issue.

This is a follow-up to 79079b6b64295b06c5a0f05ed200a55d89bccc47.

Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
---
M src/kudu/util/net/sockaddr.cc
M src/kudu/util/net/sockaddr.h
M src/kudu/util/net/socket-test.cc
3 files changed, 79 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/23/18223/5
-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 5
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Wenzhe Zhou (Code Review)" <ge...@cloudera.org>.
Wenzhe Zhou has posted comments on this change. ( http://gerrit.cloudera.org:8080/18223 )

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................


Patch Set 1: Code-Review+1


-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Comment-Date: Fri, 11 Feb 2022 05:15:04 +0000
Gerrit-HasComments: No

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/18223 )

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................

KUDU-3352 fix handling sockaddr_in in Sockaddr

Since the Sockaddr class has been updated to handle various address
families, an issue with uninitialized memory in the storage_.in.sin_zero
started affecting the behavior of the BytewiseCompare() and HashCode()
methods.  As the result, ReactorThread::FindOrStartConnection() could
create a new connection to the specified remote even if a connection
with the required credentials policy had already been established.

This patch addresses the issue by not counting the padding 'sin_zero'
field of the sockaddr_in structure in the length of Sockaddr::storage_
which is passed to Sockaddr::{BytewiseCompare,HashCode}().

I also added a new test scenario to reproduce the issue, verifying that
the scenario fails if not applying the corresponding part of this patch
to src/kudu/util/net/sockaddr.cc:

  [ RUN      ] SockaddrHashTest.ZeroPadding
  src/kudu/util/net/socket-test.cc:69: Failure
  Expected equality of these values:
    s_in.HashCode()
      Which is: 2868988679
    s_un.HashCode()
      Which is: 1786951233
  [  FAILED  ] SockaddrHashTest.ZeroPadding (0 ms)

Credit goes to Wenzhe Zhou for detecting and troubleshooting the issue.

This is a follow-up to 79079b6b64295b06c5a0f05ed200a55d89bccc47.

Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Reviewed-on: http://gerrit.cloudera.org:8080/18223
Tested-by: Alexey Serbin <as...@cloudera.com>
Reviewed-by: Wenzhe Zhou <wz...@cloudera.com>
Reviewed-by: Attila Bukor <ab...@apache.org>
---
M src/kudu/util/net/sockaddr.cc
M src/kudu/util/net/sockaddr.h
M src/kudu/util/net/socket-test.cc
3 files changed, 79 insertions(+), 6 deletions(-)

Approvals:
  Alexey Serbin: Verified
  Wenzhe Zhou: Looks good to me, but someone else must approve
  Attila Bukor: Looks good to me, approved

-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 6
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Attila Bukor has posted comments on this change. ( http://gerrit.cloudera.org:8080/18223 )

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................


Patch Set 5: Code-Review+2


-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 5
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Comment-Date: Mon, 14 Feb 2022 20:42:40 +0000
Gerrit-HasComments: No

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Attila Bukor has posted comments on this change. ( http://gerrit.cloudera.org:8080/18223 )

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/18223/2/src/kudu/util/net/sockaddr.cc
File src/kudu/util/net/sockaddr.cc:

http://gerrit.cloudera.org:8080/#/c/18223/2/src/kudu/util/net/sockaddr.cc@90
PS2, Line 90:   // but the HashCode() might be provided with length of the
nit: missed a word? (here and below)



-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Comment-Date: Fri, 11 Feb 2022 08:23:12 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Attila Bukor, Kudu Jenkins, Abhishek Chennaka, Wenzhe Zhou, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/18223

to look at the new patch set (#3).

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................

KUDU-3352 fix handling sockaddr_in in Sockaddr

Since the Sockaddr class has been updated to handle various address
families, an issue with uninitialized memory in the storage_.in.sin_zero
started affecting the behavior of the Sockaddr::HashCode() method.
As the result, ReactorThread::FindOrStartConnection() could create a new
connection to the specified remote even if a connection with the
required credentials policy had already been established.

This patch addresses the issue by not counting the padding 'sin_zero'
field of the sockaddr_in structure in the length of Sockaddr::storage_
which is passed to Sockaddr::HashCode().

I also added a new test scenario to reproduce the issue, verifying that
the scenario fails if not applying the corresponding part of this patch
to src/kudu/util/net/sockaddr.cc:

  [ RUN      ] SockaddrHashTest.ZeroPadding
  src/kudu/util/net/socket-test.cc:69: Failure
  Expected equality of these values:
    s_in.HashCode()
      Which is: 2868988679
    s_un.HashCode()
      Which is: 1786951233
  [  FAILED  ] SockaddrHashTest.ZeroPadding (0 ms)

Credit goes to Wenzhe Zhou for detecting and troubleshooting the issue.

This is a follow-up to 79079b6b64295b06c5a0f05ed200a55d89bccc47.

Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
---
M src/kudu/util/net/sockaddr.cc
M src/kudu/util/net/sockaddr.h
M src/kudu/util/net/socket-test.cc
3 files changed, 68 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/23/18223/3
-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 3
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/18223 )

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/18223/2/src/kudu/util/net/sockaddr.cc
File src/kudu/util/net/sockaddr.cc:

http://gerrit.cloudera.org:8080/#/c/18223/2/src/kudu/util/net/sockaddr.cc@90
PS2, Line 90:   // but the HashCode() might be provided with length of the
> nit: missed a word? (here and below)
Done



-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Comment-Date: Fri, 11 Feb 2022 17:09:43 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has removed a vote on this change.

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................


Removed Verified-1 by Kudu Jenkins (120)
-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: deleteVote
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 5
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Attila Bukor, Kudu Jenkins, Abhishek Chennaka, Wenzhe Zhou, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/18223

to look at the new patch set (#2).

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................

KUDU-3352 fix handling sockaddr_in in Sockaddr

Since the Sockaddr class has been updated to handle various address
families, an issue with uninitialized memory in the storage_.in.sin_zero
started affecting the behavior of the Sockaddr::HashCode() method.
As the result, ReactorThread::FindOrStartConnection() could create a new
connection to the specified remote even if a connection with the
required credentials policy had already been established.

This patch addresses the issue by zeroing the padding 'sin_zero' field
of the sockaddr_in structure stored in the Sockaddr::storage_ field for
sockets of the AF_INET family.  I also added a new test scenario to
reproduce the issue, verifying that the scenario fails if not applying
the corresponding part of this patch to src/kudu/util/net/sockaddr.cc:

  [ RUN      ] SockaddrHashTest.ZeroPadding
  src/kudu/util/net/socket-test.cc:69: Failure
  Expected equality of these values:
    s_in.HashCode()
      Which is: 2868988679
    s_un.HashCode()
      Which is: 1786951233
  [  FAILED  ] SockaddrHashTest.ZeroPadding (0 ms)

Credit goes to Wenzhe Zhou for detecting and troubleshooting the issue.

This is a follow-up to 79079b6b64295b06c5a0f05ed200a55d89bccc47.

Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
---
M src/kudu/util/net/sockaddr.cc
M src/kudu/util/net/socket-test.cc
2 files changed, 52 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/23/18223/2
-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Wenzhe Zhou (Code Review)" <ge...@cloudera.org>.
Wenzhe Zhou has posted comments on this change. ( http://gerrit.cloudera.org:8080/18223 )

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................


Patch Set 5: Code-Review+1


-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 5
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Comment-Date: Fri, 11 Feb 2022 21:01:24 +0000
Gerrit-HasComments: No

[kudu-CR] KUDU-3352 fix handling sockaddr in in Sockaddr

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/18223 )

Change subject: KUDU-3352 fix handling sockaddr_in in Sockaddr
......................................................................


Patch Set 3:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/18223/3/src/kudu/util/net/sockaddr.cc
File src/kudu/util/net/sockaddr.cc:

http://gerrit.cloudera.org:8080/#/c/18223/3/src/kudu/util/net/sockaddr.cc@110
PS3, Line 110: HashCode()
> Except function HashCode(), it also affects function BytewiseCompare().
Done


http://gerrit.cloudera.org:8080/#/c/18223/3/src/kudu/util/net/sockaddr.cc@188
PS3, Line 188: sizeof(addr)
> set length as offsetof(struct sockaddr_in, sin_zero))
Ah, good catch, thanks!



-- 
To view, visit http://gerrit.cloudera.org:8080/18223
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Gerrit-Change-Number: 18223
Gerrit-PatchSet: 3
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Comment-Date: Fri, 11 Feb 2022 18:18:48 +0000
Gerrit-HasComments: Yes