Skip to content

Commit

Permalink
docs: speculation.txt: mark example blocks as such
Browse files Browse the repository at this point in the history
Identify the example blocks there, in order to avoid Sphinx
warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
  • Loading branch information
Mauro Carvalho Chehab authored and Jonathan Corbet committed Apr 11, 2019
1 parent 59bc64f commit 5d2a2c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Documentation/speculation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ observed to extract secret information.

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
following code:
following code::

int load_array(int *array, unsigned int index)
{
Expand All @@ -27,7 +27,7 @@ following code:
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
B.LT less
Expand All @@ -44,7 +44,7 @@ microarchitectural state which can be subsequently measured.

More complex sequences involving multiple dependent memory accesses may
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)
{
Expand Down Expand Up @@ -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
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)
{
Expand Down

0 comments on commit 5d2a2c5

Please sign in to comment.