Commit 5d2a2c59 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Jonathan Corbet

docs: speculation.txt: mark example blocks as such

Identify the example blocks there, in order to avoid Sphinx
warnings.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 59bc64f0
...@@ -17,7 +17,7 @@ observed to extract secret information. ...@@ -17,7 +17,7 @@ observed to extract secret information.
For example, in the presence of branch prediction, it is possible for bounds For example, in the presence of branch prediction, it is possible for bounds
checks to be ignored by code which is speculatively executed. Consider the checks to be ignored by code which is speculatively executed. Consider the
following code: following code::
int load_array(int *array, unsigned int index) int load_array(int *array, unsigned int index)
{ {
...@@ -27,7 +27,7 @@ following code: ...@@ -27,7 +27,7 @@ following code:
return array[index]; return array[index];
} }
Which, on arm64, may be compiled to an assembly sequence such as: Which, on arm64, may be compiled to an assembly sequence such as::
CMP <index>, #MAX_ARRAY_ELEMS CMP <index>, #MAX_ARRAY_ELEMS
B.LT less B.LT less
...@@ -44,7 +44,7 @@ microarchitectural state which can be subsequently measured. ...@@ -44,7 +44,7 @@ microarchitectural state which can be subsequently measured.
More complex sequences involving multiple dependent memory accesses may More complex sequences involving multiple dependent memory accesses may
result in sensitive information being leaked. Consider the following result in sensitive information being leaked. Consider the following
code, building on the prior example: code, building on the prior example::
int load_dependent_arrays(int *arr1, int *arr2, int index) int load_dependent_arrays(int *arr1, int *arr2, int index)
{ {
...@@ -77,7 +77,7 @@ A call to array_index_nospec(index, size) returns a sanitized index ...@@ -77,7 +77,7 @@ A call to array_index_nospec(index, size) returns a sanitized index
value that is bounded to [0, size) even under cpu speculation value that is bounded to [0, size) even under cpu speculation
conditions. conditions.
This can be used to protect the earlier load_array() example: This can be used to protect the earlier load_array() example::
int load_array(int *array, unsigned int index) int load_array(int *array, unsigned int index)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment