Skip to content

[BUG]: Decode FUSE ABI structures without unaligned Rust references [LiAuto] #1397

Description

@yangcx000

Describe the bug

FuseDecoder::parse<T> casts an arbitrary byte pointer to *const T and creates &T after checking only byte length. Byte slices do not guarantee the alignment required by ABI structures containing u64 fields. Constructing an unaligned Rust reference is undefined behavior.

To Reproduce

  1. Place a valid FUSE ABI structure in a byte buffer starting at offset 1, 2, or 4.
  2. Pass that slice to FuseDecoder::parse.
  3. The implementation creates a reference that does not meet T alignment requirements.

Expected behavior

ABI values must be decoded into owned, alignment-safe values using a controlled set of POD-like types and unaligned-safe reads or explicit byte decoding.

OS Version (please complete the following information):

  • Linux
  • Curvine branch: current main
  • Component: curvine-fuse request decoder/operator API

Additional context

Goal:

  • Change structure decoding to return owned values.
  • Restrict generic decoding to explicitly safe ABI types.
  • Migrate request/operator arguments without changing protocol semantics.
  • Cover all supported opcodes and deliberately unaligned buffers.

Not goal:

  • Request dispatch or filesystem operation refactoring.

Dependency: #1091 request-frame boundary validation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions