You copied the Doc URL to your clipboard.

--library_security=protection

Selects one of the security hardened libraries with varying levels of protection, which include branch protection and memory tagging.

Note

This topic includes descriptions of [ALPHA] features. See Support level definitions.

Default

The default is --library_security=auto.

Syntax

--library_security=protection

Parameters

protection specifies the level of protection in the library.

v8.3a
Selects the v8.3a library, which provides branch protection using Branch Target Identification and Pointer Authentication on function returns.
v8.5a [ALPHA]
Selects the v8.5a library, which provides memory tagging protection of the stack used by the library code. This library also includes all the protection in the v8.3a library. Use of the v8.5a library is an [ALPHA] feature.
none
Selects the standard C library that does not provide protection using Branch Target Identification and Pointer Authentication, and does not provide memory tagging stack protection.
auto
The linker automatically selects either the standard C library, or the v8.3a, or the v8.5a library. If at least one input object file has been compiled with -mmemtag-stack and at least one input object file has return address signing with pointer authentication, then the linker selects the v8.5a library. Otherwise, if at least one input object file has been compiled for Arm®v8.3-A or later, and has return address signing with pointer authentication, then the linker selects the v8.3a library. Otherwise, the behavior is the same as --library_security=none.

Note

  • The presence of BTI instructions in the compiled objects does not affect automatic library selection.
  • The presence of memory tagging instructions in the compiled objects does not affect automatic library selection.

Usage

Use --library_security to override the automatic selection of protected libraries for branch protection and memory tagging stack protection (stack tagging).

Branch protection protects your code from Return Oriented Programming (ROP) and Jump Oriented Programming (JOP) attacks. Branch protection using pointer authentication and branch target identification are only available in AArch64 state.

Memory tagging stack protection protects accesses to variables on the stack whose addresses are taken. Memory tagging protection is available for the AArch64 state for architectures with the memory tagging extension.

Note

  • Selecting the v8.5a library does not automatically imply memory tagging protection of the heap. To enable memory tagging protection of the heap, you must define the symbol __use_memtag_heap. You can define this symbol irrespective of the level of protection you use for --library_security=protection. For more information, see Choosing a heap implementation for memory allocation functions.
  • Code compiled with stack tagging can be safely linked together with code compiled without stack tagging. However, if any object file is compiled with -mmemtag-stack, and if setjmp, longjmp, or C++ exceptions are present anywhere in the image, then you must use the v8.5a library to avoid stack tagging related memory fault at runtime.

Examples

This uses the v8.3a library with branch protection using Branch Target Identification and Pointer Authentication:

armlink --cpu=8.3-A.64 --library_security=v8.3a foo.o 

This uses the standard C library without any branch protection using Branch Target Identification and Pointer Authentication:

armlink --cpu=8.3-A.64 --library_security=none foo.o 

This uses the v8.5a library with memory tagging stack protection, and branch protection using Branch Target Identification and Pointer Authentication:

armlink --library_security=v8.5a foo.o 
Was this page helpful? Yes No