Skip to content

Commit 9fe63cb

Browse files
authored
Update citations in gui_uyp3mCj77FS8.rst.inc
1 parent 103fbba commit 9fe63cb

1 file changed

Lines changed: 45 additions & 63 deletions

File tree

src/coding-guidelines/values/gui_uyp3mCj77FS8.rst.inc

Lines changed: 45 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,24 @@
1313
:scope: system
1414
:tags: undefined-behavior, unsafe
1515

16-
Do not read uninitialized memory of any non-union type as a typed value
17-
:cite:`RUSTNOMICON_UNINIT`.
16+
Do not read uninitialized memory of any non-union type as a typed value :cite:`gui_xK9pLm2nQR4t:RUSTNOMICON-UNINIT`.
1817
This is sometimes referred to as *transmuting* or *read-at-type*.
1918
Memory can remain uninitialized if it is not read as a type.
2019

2120
Reading from a union is covered by `Do not read from union fields that may contain uninitialized bytes
2221
<https://coding-guidelines.arewesafetycriticalyet.org/coding-guidelines/types-and-traits/index.html#gui_UnionPartialInit>`_.
2322

2423
Calling `assume_init <https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init>`_
25-
:cite:`MAYBEUNINIT_DOC` or any of the following related functions is treated in the same manner as a typed read:
24+
:cite:`gui_aE3fNc6dWX1v:MAYBEUNINIT-DOC` or any of the following related functions is treated in the same manner as a typed read:
2625

2726
* ``assume_init_drop``
2827
* ``assume_init_mut``
2928
* ``assume_init_read``
3029
* ``assume_init_ref``
3130
* ``array_assume_init``
3231

33-
Calling any of these function on memory that is not yet fully initialized is undefined behavior :cite:`RUST_REF_BEHAVIOR`.
34-
The memory must be properly initialized according to the requirements of the variable's type :cite:`UCG_VALIDITY`.
32+
Calling any of these function on memory that is not yet fully initialized is undefined behavior :cite:`gui_vB7sHj5wYZ8u:RUST-REF-BEHAVIOR`.
33+
The memory must be properly initialized according to the requirements of the variable's type :cite:`gui_uZ0zDq8rST1b:UCG-VALIDITY`.
3534
For example, a variable of reference type must be aligned, non-null, and point to valid memory.
3635
Similarly, entirely uninitialized memory may have any content, while a ``bool`` must always be ``true`` or ``false``.
3736
Consequently, reading an uninitialized ``bool`` is undefined behavior.
@@ -40,10 +39,12 @@
4039
:id: rat_kjFRrhpS8Wu6
4140
:status: draft
4241
43-
Rust's memory model requires that all bytes must be initialized before being read as a typed value :cite:`RUSTNOMICON_UNINIT` :cite:`FERROCENE_SPEC`.
44-
Reading uninitialized memory as a typed value is undefined behavior :cite:`RUST_REF_BEHAVIOR`.
45-
This guideline aligns with functional safety standards :cite:`ISO_26262` :cite:`IEC_61508` and secure coding practices :cite:`CERT_RUST`.
46-
42+
Rust's memory model requires that all bytes must be initialized before being read as a typed value
43+
:cite:`gui_xK9pLm2nQR4t:RUSTNOMICON-UNINIT` :cite:`gui_kP8qTg4hUS2w:FERROCENE-SPEC`.
44+
Reading uninitialized memory as a typed value is undefined behavior :cite:`gui_vB7sHj5wYZ8u:RUST-REF-BEHAVIOR`.
45+
This guideline aligns with functional safety standards :cite:`gui_oT4tXk2lMN5y:ISO-26262`
46+
:cite:`gui_qV6vZm4nOP7z:IEC-61508` and secure coding practices.
47+
4748
.. non_compliant_example::
4849
:id: non_compl_ex_Qb5GqYTP6db1
4950
:status: draft
@@ -86,9 +87,9 @@
8687
:status: draft
8788

8889
This noncompliant example creates a pointer from uninitialized memory.
89-
Not all bit patterns are valid pointers for all operations (e.g., provenance rules) :cite:`UCG_VALIDITY`.
90+
Not all bit patterns are valid pointers for all operations (e.g., provenance rules) :cite:`gui_uZ0zDq8rST1b:UCG-VALIDITY`.
9091
You cannot create a pointer from unspecified bytes.
91-
Even a raw pointer type (e.g., ``*const T``) has validity rules :cite:`RUST_REF_BEHAVIOR`.
92+
Even a raw pointer type (e.g., ``*const T``) has validity rules `gui_vB7sHj5wYZ8u:RUST-REF-BEHAVIOR`.
9293

9394
.. rust-example::
9495

@@ -103,8 +104,8 @@
103104
:status: draft
104105

105106
This noncompliant example creates a reference from uninitialized memory.
106-
Creating a reference from arbitrary or uninitialized bytes is undefined behavior :cite:`RUST_REF_BEHAVIOR`.
107-
References must be valid, aligned, dereferenceable, and non-null :cite:`UCG_VALIDITY`.
107+
Creating a reference from arbitrary or uninitialized bytes is undefined behavior :cite:`gui_vB7sHj5wYZ8u:RUST-REF-BEHAVIOR`.
108+
References must be valid, aligned, dereferenceable, and non-null :cite:`gui_uZ0zDq8rST1b:UCG-VALIDITY`.
108109
Uninitialized memory cannot satisfy these requirements.
109110

110111
.. rust-example::
@@ -226,63 +227,44 @@
226227
}
227228

228229
.. bibliography::
229-
:id: bib_LoopTerminate
230+
:id: bib_WNCi5njUWLuY
230231
:status: draft
231232

232233
.. list-table::
233234
:header-rows: 0
234235
:widths: auto
235236
:class: bibliography-table
236237

237-
* - .. [DO-178C]
238-
- | RTCA, Inc.
239-
| "DO-178C: Software Considerations in Airborne Systems and Equipment Certification."
240-
| https://store.accuristech.com/standards/rtca-do-178c?product_id=2200105
241-
242-
* - .. [RUSTNOMICON_UNINIT]
243-
- | The Rust Project Developers
244-
| "The Rustonomicon - Uninitialized Memory"
245-
| https://doc.rust-lang.org/nomicon/uninitialized.html
246-
247-
* - .. [RUST_REF_BEHAVIOR]
248-
- | The Rust Project Developers
249-
| "The Rust Reference - Behavior considered undefined"
250-
| https://doc.rust-lang.org/reference/behavior-considered-undefined.html
251-
252-
* - .. [MAYBEUNINIT_DOC]
253-
- | The Rust Project Developers
254-
| "std::mem::MaybeUninit - Rust Standard Library Documentation"
255-
| https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html
256-
257-
* - .. [FERROCENE_SPEC]
258-
- | Ferrocene GmbH
259-
| "Ferrocene Language Specification"
260-
| https://spec.ferrocene.dev/
261-
262-
* - .. [MISRA_RUST]
263-
- | MISRA Consortium Limited
264-
| "MISRA Rust Guidelines (Draft)"
265-
| https://misra.org.uk/
266-
267-
* - .. [ISO_26262]
268-
- | International Organization for Standardization
269-
| "ISO 26262 - Road vehicles - Functional safety"
270-
| https://www.iso.org/standard/68383.html
271-
272-
* - .. [IEC_61508]
273-
- | International Electrotechnical Commission
274-
| "IEC 61508 - Functional Safety of Electrical/Electronic/Programmable Electronic Safety-related Systems"
275-
| https://www.iec.ch/functional-safety
276-
277-
* - .. [RUST_SAFETY_CRITICAL_WG]
278-
- | Rust Foundation
279-
| "Rust Safety-Critical Consortium"
280-
| https://github.com/rust-lang/safety-critical-consortium
281-
282-
* - .. [UCG_VALIDITY]
283-
- | The Rust Project Developers
284-
| "Unsafe Code Guidelines - Validity Invariants"
285-
| https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#validity-and-safety-invariant
238+
* - :bibentry:`gui_wB2bFs0tUV3c:DO-178C`
239+
- RTCA, Inc. "DO-178C: Software Considerations in Airborne Systems and Equipment Certification." https://store.accuristech.com/standards/rtca-do-178c?product_id=2200105.
240+
241+
* - :bibentry:`gui_xK9pLm2nQR4t:RUSTNOMICON-UNINIT`
242+
- The Rust Project Developers. "The Rustonomicon - Uninitialized Memory." https://doc.rust-lang.org/nomicon/uninitialized.html.
243+
244+
* - :bibentry:`gui_vB7sHj5wYZ8u:RUST-REF-BEHAVIOR`
245+
- The Rust Project Developers. "The Rust Reference - Behavior considered undefined." https://doc.rust-lang.org/reference/behavior-considered-undefined.html.
246+
247+
* - :bibentry:`gui_aE3fNc6dWX1v:MAYBEUNINIT-DOC`
248+
- The Rust Project Developers. "std::mem::MaybeUninit - Rust Standard Library Documentation." https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html.
249+
250+
* - :bibentry:`gui_kP8qTg4hUS2w:FERROCENE-SPEC`
251+
- Ferrocene GmbH. "Ferrocene Language Specification." https://spec.ferrocene.dev/.
252+
253+
* - :bibentry:`gui_mR1rVi9jKL3x:MISRA-RUST`
254+
- MISRA Consortium Limited. "MISRA Rust Guidelines (Draft)." https://misra.org.uk/.
255+
256+
* - :bibentry:`gui_oT4tXk2lMN5y:ISO-26262`
257+
- International Organization for Standardization. "ISO 26262 - Road vehicles - Functional safety." https://www.iso.org/standard/68383.html.
258+
259+
* - :bibentry:`gui_qV6vZm4nOP7z:IEC-61508`
260+
- International Electrotechnical Commission. "IEC 61508 - Functional Safety of Electrical/Electronic/Programmable Electronic Safety-related Systems." https://www.iec.ch/functional-safety.
261+
262+
* - :bibentry:`gui_sX8xBo6pQR9a:RUST-SAFETY-CRITICAL-WG`
263+
- Rust Foundation. "Rust Safety-Critical Consortium." https://github.com/rust-lang/safety-critical-consortium.
264+
265+
* - :bibentry:`gui_uZ0zDq8rST1b:UCG-VALIDITY`
266+
- The Rust Project Developers. "Unsafe Code Guidelines - Validity Invariants." https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#validity-and-safety-invariant.
267+
286268

287269
* - .. [CERT_RUST]
288270
- | Carnegie Mellon University Software Engineering Institute

0 commit comments

Comments
 (0)