microsoft / microsoft/DirectXShaderCompiler

DXIL Validator fails to catch reserved OpCode

Open
#8,144 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description
The DXIL Validator should not allow a reserved DXIL OpCode to be used.

Steps to Reproduce
Try the following validation test that uses a reserved DXIL OpCode. The validator succeeds but should have caught the illegal use of a reserved OpCode.

; RUN: not %dxv %s 2>&1 | FileCheck %s
target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f64:64-n8:16:32:64"
target triple = "dxil-ms-dx"

define void @main() {
  call void @dx.op.reserved(i32 302)
  ret void
}

; Function Attrs: nounwind
declare void @dx.op.reserved(i32) #0

attributes #0 = { nounwind}

!llvm.ident = !{!0}
!dx.version = !{!1}
!dx.valver = !{!1}
!dx.shaderModel = !{!2}
!dx.resources = !{!3}
!dx.entryPoints = !{!4}

!0 = !{!"hand-crafted"}
!1 = !{i32 1, i32 10}
!2 = !{!"vs", i32 6, i32 10}
!3 = !{null, null, null, null}
!4 = !{void ()* @main, !"main", !5, !3, null}
!5 = !{null, null, null}

Actual Behavior
Validator succeeds, when it should have failed.

Environment

  • DXC version latest
  • Host Operating System any

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied DXIL Validator validation test and run it through dxv to confirm that the reserved opcode is currently accepted. Trace the validator's handling of the reserved DXIL OpCode, then update coverage so the test fails validation and reports the illegal use.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.