Skip to content

speculative_feature_state should not return Ok(None) #1470

@rusty-snake

Description

@rusty-snake

The return type of speculative_feature_state is Result<Option<SpeculationFeatureState>>.

The return logic is

  • error -> Err(Errno)
  • success, value known by rustix -> Ok(Some(SpeculationFeatureState))
  • success, value not known by rustix -> Ok(None)

The third cases isn't useful at all. We should either return the raw kernel answer, possibly inside SpeculationFeatureState, or treat this as an error. The only thing you know is that the operation was successful (known by the kernel and no permission error).

I presume this was meant to return the "not vulnerable" case. However this is indistinguishable from "new kernel value".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions