@@ -57,11 +57,11 @@ compiled application or the operating system. Integrating the runtime into
57
57
the operating system should be preferred since otherwise all thread creation
58
58
and destruction would need to be intercepted by the application.
59
59
60
- The instrumentation makes use of the platform register ``x18 `` on AArch64 and
61
- ``x3 `` (``gp ``) on RISC-V. For simplicity we will refer to this as the
62
- ``SCSReg ``. On some platforms, `` SCSReg `` is reserved, and on others, it is
63
- designated as a scratch register. This generally means that any code that may
64
- run on the same thread as code compiled with ShadowCallStack must either target
60
+ The instrumentation makes use of the platform register ``x18 `` on AArch64,
61
+ ``x3 `` (``gp ``) on RISC-V without ` Zicfiss `_ and `` ssp `` on RISCV with ` Zicfiss `_.
62
+ For simplicity we will refer to this as the ``SCSReg ``. On some platforms,
63
+ `` SCSReg `` is reserved, and on others, it is designated as a scratch register.
64
+ This generally means that any code that may run on the same thread as code compiled with ShadowCallStack must either target
65
65
one of the platforms whose ABI reserves ``SCSReg `` (currently Android, Darwin,
66
66
Fuchsia and Windows) or be compiled with a flag to reserve that register (e.g.,
67
67
``-ffixed-x18 ``). If absolutely necessary, code compiled without reserving the
@@ -70,6 +70,7 @@ saving the register value temporarily on the stack (`example in Android`_) but
70
70
this should be done with care since it risks leaking the shadow call stack
71
71
address.
72
72
73
+ .. _`Zicfiss` : https://github.com/riscv/riscv-cfi/blob/main/cfi_backward.adoc
73
74
.. _`example in Android` : https://android-review.googlesource.com/c/platform/frameworks/base/+/803717
74
75
75
76
Because it requires a dedicated register, the ShadowCallStack feature is
@@ -151,9 +152,10 @@ Usage
151
152
152
153
To enable ShadowCallStack, just pass the ``-fsanitize=shadow-call-stack `` flag
153
154
to both compile and link command lines. On aarch64, you also need to pass
154
- ``-ffixed-x18 `` unless your target already reserves ``x18 ``. On RISC-V, ``x3 ``
155
- (``gp ``) is always reserved. It is, however, important to disable GP relaxation
156
- in the linker. This can be done with the ``--no-relax-gp `` flag in GNU ld.
155
+ ``-ffixed-x18 `` unless your target already reserves ``x18 ``. On RISC-V without
156
+ `Zicfiss `_, ``x3 `` (``gp ``) is always reserved. It is, however, important to
157
+ disable GP relaxation in the linker. This can be done with the ``--no-relax-gp ``
158
+ flag in GNU ld.
157
159
158
160
Low-level API
159
161
-------------
0 commit comments