Skip to content

Validation is not declared-version-aware for IntelRdt fields #315

Description

@ebendler

On current main (35765bd41b50a86aa3919eb352bc90321e010e68), cmd/validate accepts CDI documents whose fields do not match the declared cdiVersion.

Repro:

cd cmd/validate
go run . -schema builtin - <<'EOF'
cdiVersion: "1.1.0"
kind: "vendor.com/device"
containerEdits:
  intelRdt:
    enableCMT: true
devices:
  - name: "gpu0"
    containerEdits:
      deviceNodes:
        - path: "/dev/null"
EOF

Actual:

<stdin>: document is valid.

Expected:
Validation should fail because enableCMT / enableMBM are legacy Intel RDT fields and are not valid for a document declaring
cdiVersion: "1.1.0"

The inverse also appears to be accepted:

  cdiVersion: "1.0.0"
  containerEdits:
    intelRdt:
      enableMonitoring: false

Expected: validation should fail because enableMonitoring is a v1.1.0 field.

There also seems to be a related library compatibility issue: pkg/cdi.ParseSpec uses strict unmarshalling, while current specs-go.IntelRdt no longer includes enableCMT / enableMBM. That means older valid CDI specs using those legacy fields may be rejected instead of parsed and processed according to their declared spec version.

Suggested behavior: validation/parsing should select field rules based on the document’s declared cdiVersion: accept and process legacy Intel RDT fields for versions where they existed, reject them for v1.1.0+, and reject v1.1.0-only fields in older declared versions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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