RFR: 8289275: Remove incorrect __declspec(dllimport) attributes from pointers in jdk.crypto.cryptoki [v3]

Julian Waters jwaters at openjdk.org
Thu Jul 14 02:43:52 UTC 2022


> Several instances of function pointers in jdk.crypto.cryptoki are marked with the dllimport attribute, which should only be applied to symbol declarations, of which a typedef'd function pointer is not. This would only be useful if a function pointer defined in the linked dll is desired to be imported, not if the pointer itself is created locally and used to store a function address. In addition to being incorrect, at least on the versions of Visual C++ the JDK supports today, it is also redundant; Typically they are used to avoid an indirect stub that jumps to the proper entry in the import address table, but usage of these typedefs involves loading the address of a function and directly (Usually through GetProcAddress, even in other cases it would simply be set to the address of a function anyway) assigning it to the pointer before immediately dispatching when called, which bypasses this procedure entirely and makes the attribute pointless.

Julian Waters has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - Merge branch 'master' into typedefs
 - Merge branch 'master' into typedefs
 - Remove __declspec(dllimport) from pointers

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/9353/files
  - new: https://git.openjdk.org/jdk/pull/9353/files/f6a94f41..f0115500

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=9353&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=9353&range=01-02

  Stats: 64346 lines in 627 files changed: 34706 ins; 21440 del; 8200 mod
  Patch: https://git.openjdk.org/jdk/pull/9353.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9353/head:pull/9353

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


More information about the security-dev mailing list