Documentation/translations/zh_CN/dev-tools/ubsan.rst

Source file repositories/reference/linux-study-clean/Documentation/translations/zh_CN/dev-tools/ubsan.rst

File Facts

System
Linux kernel
Corpus path
Documentation/translations/zh_CN/dev-tools/ubsan.rst
Extension
.rst
Size
3170 bytes
Lines
89
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

[<ffffffff830ae053>] start_kernel+0x83/0x49a
	  [<ffffffff830ad120>] ? early_idt_handler_array+0x120/0x120
	  [<ffffffff830ad386>] x86_64_start_reservations+0x2a/0x2c
	  [<ffffffff830ad4f3>] x86_64_start_kernel+0x16b/0x17a
	 ================================================================================

用法
-----

使用如下内核配置启用UBSAN::

  CONFIG_UBSAN=y

排除要被检测的文件::

  UBSAN_SANITIZE_main.o := n

排除一个目录中的所有文件::

  UBSAN_SANITIZE := n

当全部文件都被禁用,可通过如下方式为特定文件启用::

  UBSAN_SANITIZE_main.o := y

未对齐的内存访问检测可通过开启独立选项 - CONFIG_UBSAN_ALIGNMENT 检测。
该选项在支持未对齐访问的架构上(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y)
默认为关闭。该选项仍可通过内核配置启用,但它将产生大量的UBSAN报告。

参考文献
----------

.. _1: https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Debugging-Options.html
.. _2: https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html
.. _3: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html

Annotation

Implementation Notes