On Fri, 17 Apr 2026 13:55:22 GMT, Yasumasa Suenaga <[email protected]> wrote:

> `SystemLookup` in FFM uses libsyslookup to find symbols from the system. But 
> it is not needed because `RTLD_DEFAULT` can be used for this purpose on Linux.
> Removing unneeded library improves security.
> 
> I've sent 
> [email](https://mail.openjdk.org/archives/list/[email protected]/thread/KHXIJCQZD2VCY4QXMPONAPS26IERMEGR/)
>  to core-libs-dev, but I've not yet received any comments, so I created this 
> PR.
> 
> syslookup.dll for Windows is needed because some functions might not be 
> lookup'ed. OTOH on Linux, `dlsym` can lookup symbols from library 
> dependencies. In `SystemLookup`, handle of libsyslookup would be passed to 
> `dlsym` eventually, but it is better to pass `RTLD_DEFAULT` in this case.
> It works when the handle of libsyslookup is passed, but `RTLD_DEFAULT` is 
> better because Javadoc of `Linker::defaultLookup` says it returns a set of 
> commonly used libraries.
> 
> In addition, I guess we can apply this change to all of POSIX platforms 
> because `dlsym` is defined in POSIX, but I'm not sure we can do (especially 
> AIX - it has own syslookup.c in JDK source tree).
> 
> This change passed all of jdk_foreign tests.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has been closed without being integrated.

-------------

PR: https://git.openjdk.org/jdk/pull/30794

Reply via email to