Skip to content

Tracking Issue for Kernel Control Flow Integrity (KCFI) Support for Rust #123479

Open
@rcvalle

Description

@rcvalle

This is a tracking issue for the Kernel Control Flow Integrity (KCFI) Support for Rust project.

Steps

The Kernel Control Flow Integrity (KCFI) Support for Rust project shares most of its implementation with the LLVM Control Flow Integrity (CFI) Support for Rust project (see #89653), with some key differences:

  1. KCFI perform type tests differently and are implemented as different LLVM passes than CFI to not require LTO.
  2. KCFI has the limitation that a function or method may have one type id assigned only.

KCFI support for Rust work will be implemented in these steps:

  • Add support for emitting KCFI type metadata and checks to the Rust compiler code generation (i.e., add support for emitting KCFI operand bundles).
  • Fixing (or temporarily working around) the limitations listed above in KCFI.

Unresolved Questions

Because of limitation listed above (2), the current KCFI implementation (not CFI) does reifying of types (i.e., adds shims/trampolines for indirect calls in these cases1) for:

  1. Supporting casting between function items, closures, and Fn trait objects
  2. Supporting methods being cast as function pointers.

There may be possible costs of these added levels of indirections for KCFI for cache coherence/locality and performance, possible introduction of gadgets or KCFI bypasses, and increased artifact/binary sizes, which haven't been looked at yet.

Implementation history

These are the most relevant PRs for Kernel Control Flow Integrity (KCFI) Support for Rust project:

Footnotes

  1. It also unnecessarily adds shims/trampolines to indirect calls to methods that are cast into function pointers from traits that are not object safe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sanitizersArea: Sanitizers for correctness and code qualityC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCPG-exploit-mitigationsProject group: Exploit mitigationsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions