Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Exceptions

Wiki Markup
*LCK10-EX1EX0:* Use of the noncompliant form of the double-checked locking idiom is permitted for 32-bit primitive values (for example, {{int}} or {{float}}) \[[Pugh 2004|AA. Bibliography#Pugh 04]\], although this usage is discouraged. The noncompliant form establishes the necessary happens-before relationship between threads that see an initialized version of the primitive value. The second happens-before relationship (that for the initialization of the fields of the referent) is moot, because unsynchronized reads and writes of primitive values up to 32-bits are guaranteed to be atomic. Consequently, the noncompliant form establishes the only needed happens-before relationship in this case. Note, however, that the noncompliant form fails for {{long}} or {{double}} because unsynchronized reads/writes of 64-bit primitives lack a guarantee of atomicity, and thus require a second happens-before relationship to guarantee that all threads see only fully assigned 64-bit values (See rule [VNA05-J. Ensure atomicity when reading and writing 64-bit values].)

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

LCK10-J

low

probable

medium

P4

L3

Related Vulnerabilities

...

Related Guidelines

MITRE CWE

CWE ID 609, "Double-Checked Locking"

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="e2577d97c814ce52-2038960c-474f4f7f-96cfa1b1-48325f43e2fd66aefa18750a"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

 

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="3e589e2fed95ee8e-be1a71b6-48d8460c-b4228f9f-db97495c08db6ee9f3aeda0d"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS 05]]

Section 12.4, "Initialization of Classes and Interfaces"

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2807913587a74e8e-5e6691b9-4c824044-bc26a0e1-86c358d53ffe145cb64a03bd"><ac:plain-text-body><![CDATA[

[[Pugh 2004

AA. Bibliography#Pugh 04]]

 

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a1b2d2bdac82d7a2-9eb0eeec-4fe543f6-afbebf67-cd3cd25d5a34d488fcd0742c"><ac:plain-text-body><![CDATA[

[[Bloch 2001

AA. Bibliography#Bloch 01]]

Item 48: "Synchronize access to shared mutable data"

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="116c992aa5d9f075-23f8347f-4fbd4a68-8d1da408-60df4ef696666b5b8b461abd"><ac:plain-text-body><![CDATA[

[[Bloch 2008

AA. Bibliography#Bloch 08]]

Item 71: "Use lazy initialization judiciously"]]></ac:plain-text-body></ac:structured-macro>

...