Skip to content

Implement ops_edges CodeQL query for kernel indirect ops call targets - #420

Open
artmetla wants to merge 1 commit into
masterfrom
add-ops-edges
Open

Implement ops_edges CodeQL query for kernel indirect ops call targets#420
artmetla wants to merge 1 commit into
masterfrom
add-ops-edges

Conversation

@artmetla

Copy link
Copy Markdown
Collaborator

Implements queries/ops_edges.ql to resolve indirect kernel call sites (ExprCall) to concrete callback implementations registered in ops structures (e.g., file_operations, device_attribute). It outputs the 11-column projection expected by import_ops_targets.py to populate the ops_targets table in codeql_data.db.

Implement ops_edges.ql to resolve indirect call sites (ExprCall) invoking
function-pointer struct fields to concrete callback implementations registered in
kernel ops initializers.

Key changes:
  * Implement queries/ops_edges.ql with the 11-column projection expected by
    import_ops_targets.py and the dashboard reachability viewer.
  * Model kernel ops registrations using OpsAggregateLiteral (ClassAggregateLiteral
    with FunctionPointerIshType) matching both FunctionAccess and AddressOfExpr
    assignments via .getUnconverted() to handle typecasts.
  * Bind indirect call invocations (ec.getExpr() = field.getAnAccess()) to enclosing
    caller function spans and target function definition bodies.
  * Add locationString helper to render standard 5-part definition coordinates
    (file:startLine:startColumn:endLine:endColumn).
  * Filter entities with empty identifiers or missing function bodies to ensure valid
    integer line spans.
@artmetla
artmetla requested a review from JordyZomer August 22, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant