[CAUTION] RE: RFR 8216355: missing NULL checks in libnet in interface iteration and potential resource leak in getMacAddress

Robin Westberg robin.westberg at oracle.com
Wed Jan 9 14:41:52 UTC 2019


Hi Matthias,

Yes, looks fine to me!

Best regards,
Robin

> On 9 Jan 2019, at 15:10, Baesken, Matthias <matthias.baesken at sap.com> wrote:
> 
> Hi Christoph, thanks for  the review !
> I updated the formatting :
>  
> http://cr.openjdk.java.net/~mbaesken/webrevs/8216355.3/ <http://cr.openjdk.java.net/~mbaesken/webrevs/8216355.3/>
>  
> Robin : may  I  add you as reviewer too ?
>  
> Thanks, Matthias
>  
>  
> From: Langer, Christoph 
> Sent: Mittwoch, 9. Januar 2019 12:16
> To: Baesken, Matthias <matthias.baesken at sap.com>
> Cc: net-dev <net-dev at openjdk.java.net>; Robin Westberg <robin.westberg at oracle.com>
> Subject: RE: [CAUTION] RE: RFR 8216355: missing NULL checks in libnet in interface iteration and potential resource leak in getMacAddress
>  
> Hi Matthias,
>  
> looks good to me.
>  
> In src/java.base/unix/native/libnet/NetworkInterface.c, lines 1019 and 1034, I’d prefer if the style was:
> if (addr == NULL) {
>     return 0;
> }
>  
> Thanks
> Christoph
>  
>  
> From: net-dev <net-dev-bounces at openjdk.java.net <mailto:net-dev-bounces at openjdk.java.net>> On Behalf Of Baesken, Matthias
> Sent: Mittwoch, 9. Januar 2019 10:02
> To: net-dev <net-dev at openjdk.java.net <mailto:net-dev at openjdk.java.net>>
> Cc: Robin Westberg <robin.westberg at oracle.com <mailto:robin.westberg at oracle.com>>
> Subject: [CAUTION] RE: RFR 8216355: missing NULL checks in libnet in interface iteration and potential resource leak in getMacAddress
>  
> New webrev :
>  
> http://cr.openjdk.java.net/~mbaesken/webrevs/8216355.2/ <http://cr.openjdk.java.net/~mbaesken/webrevs/8216355.2/>
>  
>  
> ( I noticed that I accidentally  deleted a line in the AIX coding so I brought it back,  and I updated the Copyright  year  info to 2019 ).
>  
> Best regards, Matthias
>  
>  
> From: Baesken, Matthias 
> Sent: Mittwoch, 9. Januar 2019 09:36
> To: net-dev <net-dev at openjdk.java.net <mailto:net-dev at openjdk.java.net>>
> Cc: 'Robin Westberg' <robin.westberg at oracle.com <mailto:robin.westberg at oracle.com>>
> Subject: RFR 8216355: missing NULL checks in libnet in interface iteration and potential resource leak in getMacAddress
>  
> Hello, please review the following fix .
>  
> In NetworkInterface.c and Inet6AddressImpl.c we have some coding that omits checking for ifa_addr == NULL when iterating on the result of the getifaddrs call.
> This is similar to what has been fixed in hotspot with 
> 
> https://bugs.openjdk.java.net/browse/JDK-8208676 <https://bugs.openjdk.java.net/browse/JDK-8208676> 
> 
> The issues are in the bsd/macOS coding. However bsd/macOS also document that ifa_addr can be NULL in special cases (not sure how likely it is to see it "in the wild").
> See 
>  
> 
> https://www.freebsd.org/cgi/man.cgi?getifaddrs <https://urldefense.proofpoint.com/v2/url?u=https-3A__www.freebsd.org_cgi_man.cgi-3Fgetifaddrs&d=DwMFAg&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=UJlIwvo0Thp_BYS_NWFT0ryBTIkcL2KhsFz8CKsa4GY&m=9CpuZEIfUpWIc0Xam7OZCs0sjJditgCKJAYp8h77QaY&s=OVOH0AHA1db0xrvPTQkMkid2bkRm0WEPLQCYDBH0SC4&e=>
> 
> https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/getifaddrs.3.html <https://urldefense.proofpoint.com/v2/url?u=https-3A__developer.apple.com_library_archive_documentation_System_Conceptual_ManPages-5FiPhoneOS_man3_getifaddrs.3.html&d=DwMFAg&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=UJlIwvo0Thp_BYS_NWFT0ryBTIkcL2KhsFz8CKsa4GY&m=9CpuZEIfUpWIc0Xam7OZCs0sjJditgCKJAYp8h77QaY&s=XVZ5bWNxdq1JQLBJ1aA6KKlb7Ec3bzAbRdiooqqjyDw&e=>
>  
>  
> Additionally  a small resource  leak  in NetworkInterface.c   is fixed.
>  
> Bug/webrev :
>  
> https://bugs.openjdk.java.net/browse/JDK-8216355 <https://bugs.openjdk.java.net/browse/JDK-8216355>
>  
>  
> http://cr.openjdk.java.net/~mbaesken/webrevs/8216355.1/ <http://cr.openjdk.java.net/~mbaesken/webrevs/8216355.1/>
>  
>  
> Best regards, Matthias

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20190109/10b98118/attachment-0001.html>


More information about the net-dev mailing list