Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

考虑支持 rustc unstable flag sanitizer 作为动态检查工具? #17

Open
zjp-CN opened this issue Aug 7, 2024 · 3 comments
Open
Labels
question Further information is requested

Comments

@zjp-CN
Copy link
Member

zjp-CN commented Aug 7, 2024

Rust 编译器有一个不稳定的代码安全质量检查标志: https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/sanitizer.html

Sanitizers are tools that help detect and prevent various types of bugs and vulnerabilities in software. They are available in compilers and work by instrumenting the code to add additional runtime checks. ...
they are typically used alongside other best practices in software development, such as testing and fuzzing, to ensure the highest level of software quality and security.

This feature allows for use of one of following sanitizers:

  • Those intended for testing or fuzzing (but not production use):

  • Those that apart from testing, may be used in production:

    • ControlFlowIntegrity LLVM Control Flow Integrity
      (CFI) provides forward-edge control flow protection.
    • DataFlowSanitizer a generic dynamic data flow analysis
      framework.
    • KernelControlFlowIntegrity LLVM Kernel
      Control Flow Integrity (KCFI) provides forward-edge control flow protection
      for operating systems kernels.
    • MemTagSanitizer fast memory error detector based on
      Armv8.5-A Memory Tagging Extension.
    • SafeStack provides backward-edge control flow protection by
      separating the stack into safe and unsafe regions.
    • ShadowCallStack provides backward-edge control flow
      protection (aarch64 only).

target-spec-json 编译选项可知道当前架构支持哪些检查类型,输出示例 #25

{
  "arch": "x86_64",
  "supported-sanitizers": [
    "address",
    "leak",
    "memory",
    "thread",
    "cfi",
    "kcfi",
    "safestack",
    "dataflow"
  ]
}
{
  "arch": "riscv64",
  "supported-sanitizers": [
    "kernel-address"
  ]
}
@zjp-CN zjp-CN added the question Further information is requested label Aug 7, 2024
@zjp-CN
Copy link
Member Author

zjp-CN commented Aug 25, 2024

官方 rustc 开发指南有专门一节介绍 sanitizer:https://rustc-dev-guide.rust-lang.org/sanitizers.html

@zjp-CN
Copy link
Member Author

zjp-CN commented Sep 14, 2024

@zjp-CN
Copy link
Member Author

zjp-CN commented Jan 23, 2025

最近有人提前基于 LLVM 20 做了 RealtimeSanitizer

与 AddressSanitizer 等通常检查整个程序的现有清理器不同,RTSan 需要针对代码的特定实时部分(通过对该函数标注 #[nonblocking] 属性进行检查)。非实时部分(如 initialization)不需要这些检查。

虽然这些属性可以添加到不稳定的 Rust 中,但我们希望在稳定的 Rust 中提供即时访问。这让我们创建了 rtsan-standalone-rs —— “独立”的版本将其与未来 Rust 的内置版本区分开来。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant