[ 
https://issues.apache.org/jira/browse/HADOOP-20040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18133335#comment-18133335
 ] 

ASF GitHub Bot commented on HADOOP-20040:
-----------------------------------------

hadoop-yetus commented on PR #8880:
URL: https://github.com/apache/hadoop/pull/8880#issuecomment-6458415174

   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime |  Logfile | Comment |
   |:----:|----------:|--------:|:--------:|:-------:|
   | +0 :ok: |  reexec  |   0m 52s |  |  Docker mode activated.  |
   |||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  1s |  |  No case conflicting files 
found.  |
   | +0 :ok: |  codespell  |   0m  0s |  |  codespell was not available.  |
   | +0 :ok: |  detsecrets  |   0m  0s |  |  detect-secrets was not available.  
|
   | +1 :green_heart: |  @author  |   0m  0s |  |  The patch does not contain 
any @author tags.  |
   | +1 :green_heart: |  test4tests  |   0m  0s |  |  The patch appears to 
include 1 new or modified test files.  |
   |||| _ trunk Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |  50m 44s |  |  trunk passed  |
   | +1 :green_heart: |  compile  |  17m 56s |  |  trunk passed with JDK 
Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu  |
   | +1 :green_heart: |  compile  |  18m 35s |  |  trunk passed with JDK 
Ubuntu-17.0.20.1+1-1-24.04-Ubuntu  |
   | +1 :green_heart: |  checkstyle  |   1m 31s |  |  trunk passed  |
   | +1 :green_heart: |  mvnsite  |   2m  3s |  |  trunk passed  |
   | +1 :green_heart: |  javadoc  |   1m 27s |  |  trunk passed with JDK 
Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu  |
   | +1 :green_heart: |  javadoc  |   1m 23s |  |  trunk passed with JDK 
Ubuntu-17.0.20.1+1-1-24.04-Ubuntu  |
   | +1 :green_heart: |  spotbugs  |   3m 15s |  |  trunk passed  |
   | +1 :green_heart: |  shadedclient  |  37m  5s |  |  branch has no errors 
when building and testing our client artifacts.  |
   |||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   1m 17s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |  17m  1s |  |  the patch passed with JDK 
Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu  |
   | +1 :green_heart: |  javac  |  17m  1s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |  18m 16s |  |  the patch passed with JDK 
Ubuntu-17.0.20.1+1-1-24.04-Ubuntu  |
   | +1 :green_heart: |  javac  |  18m 16s |  |  the patch passed  |
   | +1 :green_heart: |  blanks  |   0m  0s |  |  The patch has no blanks 
issues.  |
   | +1 :green_heart: |  checkstyle  |   1m 29s |  |  the patch passed  |
   | +1 :green_heart: |  mvnsite  |   2m  1s |  |  the patch passed  |
   | +1 :green_heart: |  javadoc  |   1m 23s |  |  the patch passed with JDK 
Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu  |
   | +1 :green_heart: |  javadoc  |   1m 25s |  |  the patch passed with JDK 
Ubuntu-17.0.20.1+1-1-24.04-Ubuntu  |
   | +1 :green_heart: |  spotbugs  |   3m 26s |  |  the patch passed  |
   | +1 :green_heart: |  shadedclient  |  36m 36s |  |  patch has no errors 
when building and testing our client artifacts.  |
   |||| _ Other Tests _ |
   | +1 :green_heart: |  unit  |  23m 47s |  |  hadoop-common in the patch 
passed.  |
   | +1 :green_heart: |  asflicense  |   1m 15s |  |  The patch does not 
generate ASF License warnings.  |
   |  |   | 244m 13s |  |  |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | ClientAPI=1.56 ServerAPI=1.56 base: 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8880/1/artifact/out/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hadoop/pull/8880 |
   | Optional Tests | dupname asflicense compile javac javadoc mvninstall 
mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets |
   | uname | Linux b8445c1066a4 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 
15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/bin/hadoop.sh |
   | git revision | trunk / e0ce5aacd5d88fdf5cf683a84cc903a12e9dbad5 |
   | Default Java | Ubuntu-17.0.20.1+1-1-24.04-Ubuntu |
   | Multi-JDK versions | 
/usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu 
/usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.20.1+1-1-24.04-Ubuntu |
   |  Test Results | 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8880/1/testReport/ |
   | Max. process+thread count | 3140 (vs. ulimit of 10000) |
   | modules | C: hadoop-common-project/hadoop-common U: 
hadoop-common-project/hadoop-common |
   | Console output | 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8880/1/console |
   | versions | git=2.43.0 maven=3.9.15 spotbugs=4.9.7 |
   | Powered by | Apache Yetus 0.14.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   




> SecurityUtil host resolver cache shares one mutable InetAddress per IP 
> literal, leaking reverse lookups to other callers
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-20040
>                 URL: https://issues.apache.org/jira/browse/HADOOP-20040
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: net, security
>    Affects Versions: 3.5.0
>            Reporter: Siyao Meng
>            Assignee: Siyao Meng
>            Priority: Major
>              Labels: pull-request-available
>
> h3. Problem
> HADOOP-19447 added a cache to {{SecurityUtil.CacheableHostResolver}}, enabled 
> when {{hadoop.security.hostname.cache.expire-interval.seconds}} > 0. The 
> cache returns the same {{InetAddress}} instance to every caller resolving the 
> same host string, and {{NetUtils.createSocketAddrForHost}} wraps that 
> instance directly in a new {{InetSocketAddress}}.
> {{InetAddress}} is not immutable. For an IP literal resolved by 
> {{StandardHostResolver}} (the default, since 
> {{hadoop.security.token.service.use_ip}} defaults to true), the hostname is 
> unset, and the first {{getHostName()}} call does a reverse lookup and stores 
> the PTR name in the object. With the cache on, that one call changes the 
> address seen by every later caller in the JVM:
> {code:java}
> InetSocketAddress a = NetUtils.createSocketAddr("10.0.0.5:8020");
> InetSocketAddress b = NetUtils.createSocketAddr("10.0.0.5:9870");
> b.getHostString();   // "10.0.0.5"
> a.getHostName();     // reverse lookup, e.g. "nn1.example.com"
> b.getHostString();   // now "nn1.example.com"
> NetUtils.createSocketAddr("10.0.0.5:50070").getHostString(); // 
> "nn1.example.com"
> {code}
> Without the cache, each resolution returns a fresh object and 
> {{getHostString()}} keeps returning the literal. So enabling the cache makes 
> the host string of a configured IP address depend on unrelated earlier calls. 
> The cache key is the host only, so addresses on different ports share the 
> object too.
> Callers that trigger the reverse lookup include {{NetUtils.canonicalizeHost}} 
> (via {{FileSystem}} URI canonicalization of {{hdfs://<ip>:<port>}}), 
> {{NetUtils.getHostPortString}} and {{NameNode#loginAsNameNodeUser}}. Callers 
> that read the host string include 
> {{DatanodeHttpServer#getHostnameForSpnegoPrincipal}} (SPNEGO {{_HOST}} 
> substitution), {{RBFMetrics}} router web URI, and 
> {{InetSocketAddress#toString}} in logs. HDFS-18004 makes the NameNode RPC 
> server bind to {{getHostString()}} so an IP literal is bound as given; with 
> the cache on it silently falls back to binding the reverse lookup name.
> {{QualifiedHostResolver}} ({{use_ip=false}}) is not affected for literals, 
> since it builds the address with {{InetAddress.getByAddress(host, bytes)}} 
> and the hostname is already set.
> h3. Proposed fix
> Bypass the cache for IP literals in {{CacheableHostResolver#getByName}}. 
> Resolving a literal needs no DNS lookup, so the cache saves nothing for it, 
> and bypassing restores the exact pre-HADOOP-19447 behavior for literals. 
> Hostnames stay cached; {{InetAddress.getByName(hostname)}} already sets the 
> hostname, so {{getHostName()}} does not mutate those objects.
> Returning a copy via {{InetAddress.getByAddress(host, bytes)}} was considered 
> and rejected: it would make {{getHostName()}} return the literal without the 
> reverse lookup, which is a behavior change of its own.
> The existing {{TestSecurityUtil#testCacheableResolve}} used {{127.0.0.1}} to 
> check cache hits, so it switches to {{localhost}} and checks expiry on the 
> cache entry (the JDK returns the same object for a hostname from its own 
> lookup cache). A new test checks that literals are not shared and keep their 
> host string after {{getHostName()}}.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to