`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).

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

Commit messages:
 - Use RTLD_DEFAULT on Linux

Changes: https://git.openjdk.org/jdk/pull/30794/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=30794&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8382428
  Stats: 56 lines in 3 files changed: 40 ins; 1 del; 15 mod
  Patch: https://git.openjdk.org/jdk/pull/30794.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/30794/head:pull/30794

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

Reply via email to