RFR: 8365168: Use 64-bit aligned addresses for CK_ULONG access in PKCS11 native key code
Sean Coffey
coffeys at openjdk.org
Wed Aug 13 09:22:11 UTC 2025
On Tue, 12 Aug 2025 00:12:39 GMT, Valerie Peng <valeriep at openjdk.org> wrote:
> 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~
Thanks for working on this Valerie. The re-organizing of the attribute fields so that CK_ULONG atts are first makes sense and should help alleviate issues on architectures where reading such data on non 64-bit aligned addresses induces a performance hit (or SIGBUS, something I've seen on Solaris in JDK 11)
-------------
Marked as reviewed by coffeys (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/26735#pullrequestreview-3114770057
More information about the security-dev
mailing list