# Infosec Memory Safety

## Hardware

- Memory protection:
https://en.wikipedia.org/wiki/Memory_protection

- NX Bit:
https://en.wikipedia.org/wiki/NX_bit

- Can non-compiled languages (e.g. those with mutable code objects like Python) utilize the NX bit that the processor supports?

- Can TLA+ find side-channels (which bypass all software memory protection features other than encryption-in-RAM)?

- How do DMA and IOMMU hardware features impact software memory safety controls?
https://news.ycombinator.com/item?id=23993763

- DMA: Direct Memory Access

- DMA attack > Mitigations:
https://en.wikipedia.org/wiki/DMA_attack

- IOMMU: I-O Memory Management Unit; GPUs, Virtualization,
https://en.wikipedia.org/wiki/Input%E2%80%93output_memory_ma...

- Kernel IOMMU parameters: Ctrl-F "iommu":
https://www.kernel.org/doc/html/latest/admin-guide/kernel-pa...

- RDMA: Remote direct memory access
https://en.wikipedia.org/wiki/Remote_direct_memory_access

## Software

- Type safety > Memory management and type safety:
https://en.wikipedia.org/wiki/Type_safety#Memory_management_...

- Memory safety > Types of memory errors:
https://en.wikipedia.org/wiki/Memory_safety#Types_of_memory_...

- Template:Memory management
https://en.wikipedia.org/wiki/Template:Memory_management

- Category:Memory_management
https://en.wikipedia.org/wiki/Category:Memory_management

- Reference (computerscience)
https://en.wikipedia.org/wiki/Reference_(computer_science)

- Pointer (computer programming)
https://en.wikipedia.org/wiki/Pointer_(computer_programming)

- Smart pointer (computer programming) in C++: unique_ptr, shared_ptr and weak_ptr; Python: weakref, Arrow Plasma IPC,
https://en.wikipedia.org/wiki/Smart_pointer

- Manual Memory Management > Resource Acquisition Is Initialization
https://en.wikipedia.org/wiki/Manual_memory_management#Resou...

- Resource acquisition is initialization (C++ (1980s), D, Ada, Vala, Rust), #Reference_counting (Perl, Python (CPython,), PHP,)
https://en.wikipedia.org/wiki/Resource_acquisition_is_initia...

- Ada > Language constructs > Concurrency
https://en.wikipedia.org/wiki/Ada_(programming_language)#Con...

- C_dynamic_memory_allocation#Common_errors:
https://en.wikipedia.org/wiki/C_dynamic_memory_allocation#Co...

- Python 3 > C-API > Memory Managment:
https://docs.python.org/3/c-api/memory.html

- The Rust Programming Language > 4. Understanding Ownership > 4.1. What is Ownership?
https://doc.rust-lang.org/book/ch04-00-understanding-ownersh...

- The Rust Programming Language > 6. Fearless Concurrency > Using Message Passing to Transfer Data Between Threads
https://doc.rust-lang.org/book/ch16-02-message-passing.html#...

> One increasingly popular approach to ensuring safe concurrency is message passing, where threads or actors communicate by sending each other messages containing data. Here’s the idea in a slogan from the Go language documentation: “Do not communicate by sharing memory; instead, share memory by communicating.”

> To accomplish message-sending concurrency, Rust's standard library provides an implementation of channels. A channel is a general programming concept by which data is sent from one thread to another.

> You can imagine a channel in programming as being like a directional channel of water, such as a stream or a river. If you put something like a rubber duck into a river, it will travel downstream to the end of the waterway.

- The Rust Programming Language > 15. Smart Pointers > Smart Pointers:
https://doc.rust-lang.org/book/ch15-00-smart-pointers.html

- The Rust Programming Language > 19. Advanced Features > Unsafe Rust:
https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html

- Secure Rust Guidelines > Memory management, > Checklist > Memory management:
https://anssi-fr.github.io/rust-guide/05_memory.html

- Go 101 > "Type-Unsafe Pointers"
https://go101.org/article/unsafe.html
https://pkg.go.dev/unsafe

- https://github.com/rust-secure-code/projects#side-channel-vu...

- Segmentation fault > Causes, Examples, :
https://en.wikipedia.org/wiki/Segmentation_fault

- "CWE CATEGORY: Pointer Issues"
https://cwe.mitre.org/data/definitions/465.html

- "CWE CATEGORY: Memory Buffer Errors"
https://cwe.mitre.org/data/definitions/1218.html

- "CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer"
https://cwe.mitre.org/data/definitions/119.html

- "CWE CATEGORY: SEI CERT C Coding Standard - Guidelines 08. Memory Management (MEM)"
https://cwe.mitre.org/data/definitions/1162.html

- "CWE CATEGORY: CERT C++ Secure Coding Section 08 - Memory Management (MEM)"
https://cwe.mitre.org/data/definitions/876.html

- SEI CERT C Coding Standard > "Rule 08. Memory Management (MEM)"
https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pa...

- SEI CERT C Coding Standard > "Rec. 08. Memory Management (MEM)"
https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pa...

- Invariance (computer science)
https://en.wikipedia.org/wiki/Invariant_(mathematics)#Invari...

- TLA+ Model checker
https://en.wikipedia.org/wiki/TLA%2B#Model_checker
> The TLC model checker builds a finite state model of TLA+ specifications for checking invariance properties.

- Data remnance; after the process fails or is ended, RAM is not zeroed:
https://en.wikipedia.org/wiki/Data_remanence

- Memory debugger; valgrind, https://en.wikipedia.org/wiki/Memory_debugger

- awesome-safety-critical https://awesome-safety-critical.readthedocs.io/en/latest/#so... ; Software Safety Standards, Handbooks; Formal Verification; backup/
https://github.com/stanislaw/awesome-safety-critical/tree/ma...

- > Additional lists of static analysis, dynamic analysis, SAST, DAST, and other source code analysis tools: https://news.ycombinator.com/item?id=24511280