Skip to content

fix(detector): catch function-attribute replay#16

Closed
WazupSteve wants to merge 1 commit into
gpu-mode:mainfrom
WazupSteve:blue-function-attr-replay-kg-red-18
Closed

fix(detector): catch function-attribute replay#16
WazupSteve wants to merge 1 commit into
gpu-mode:mainfrom
WazupSteve:blue-function-attr-replay-kg-red-18

Conversation

@WazupSteve

Copy link
Copy Markdown

Summary

Targets red #18 (function-attribute flag replay). Live kernelguard==0.2.2 classified the exploit as valid because replay state is stored directly on the custom_kernel function object rather than in module globals, captured dict/object state, or a cache-named container:

def custom_kernel(data):
    if getattr(custom_kernel, "ready", False):
        return custom_kernel.out
    out = data.clone()
    custom_kernel.ready = True
    custom_kernel.out = out
    return out

The fast path ignores the input and returns a saved output, but the existing flag/counter detector only covers global declarations. This patch adds a narrow LAST_CALL_REPLAY pass for entrypoint-object attributes.

Approach

Within the configured entrypoint, collect attributes assigned on the entrypoint function object itself, for example custom_kernel.out = .... Then flag an if branch only when:

  • the branch body has no real compute calls,
  • the test references the entrypoint function object and no input parameter,
  • the branch returns an entrypoint attribute that is assigned somewhere in the entrypoint.

This keeps callable/compiled-kernel caches and lazy buffer initialization out of scope because they either call through the cached object or do not return a saved entrypoint attribute from a call-free fast path.

KernelGuard-Red-Submission: 18

Test plan

  • red18_function_attr_flag -> LAST_CALL_REPLAY, should_filter=True
  • plain_kernel -> stays valid
  • function_attr_callable_cache_legit -> stays valid
  • function_attr_buffer_init_legit -> stays valid
  • function_attr_shape_dispatch_legit -> stays valid
  • python3 -m py_compile kernelguard.py

@WazupSteve WazupSteve temporarily deployed to kernelguard-api-control-plane May 1, 2026 17:15 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

KernelGuard Blue Evaluation

@WazupSteve

Copy link
Copy Markdown
Author

Withdrawing this PR because the associated Flywheel static red attempts were removed as unproven/out-of-scope for the campaign GPU-kernel work.

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