Integrated: 8289275: Remove incorrect __declspec(dllimport) attributes from pointers in jdk.crypto.cryptoki

Julian Waters jwaters at openjdk.org
Thu Jul 21 19:16:03 UTC 2022


On Sat, 2 Jul 2022 02:12:15 GMT, Julian Waters <jwaters at openjdk.org> wrote:

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

This pull request has now been integrated.

Changeset: 0dda3c14
Author:    Julian Waters <jwaters at openjdk.org>
Committer: Valerie Peng <valeriep at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/0dda3c14ebe040158dcc5a87d349d5286c48b573
Stats:     6 lines in 2 files changed: 0 ins; 0 del; 6 mod

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

Reviewed-by: valeriep

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

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


More information about the security-dev mailing list