RFR: 8365168: Use 64-bit aligned addresses for CK_ULONG access in PKCS11 native key code

Valerie Peng valeriep at openjdk.org
Tue Aug 12 00:19:29 UTC 2025


The current `getNativeKeyInfo(...)` method impl inside SunPKCS11 provider's p11_keymgmt.c queries key attributes and pack the resulting data into a blob which is later passed to the `createNativeKey(...)` method to create a native key handle. Some of these attributes have type CK_ULONG values and this may lead to SIGBUS errors on Solaris sparc when these attrbute values aren't 64-bit aligned.

In order to ensure the proper alignment, one way to fix this is to re-order the attributes in the template by their value types starting with those requiring alignments. Also ordered attributes with the same value types alphabetically.

Thanks in advance for the review~

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

Commit messages:
 - 8365168: Use 64-bit aligned addresses for CK_ULONG access in PKCS11 native key code

Changes: https://git.openjdk.org/jdk/pull/26735/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26735&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8365168
  Stats: 97 lines in 2 files changed: 48 ins; 40 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/26735.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26735/head:pull/26735

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


More information about the security-dev mailing list