Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add stack overflow detection mechanism #14

Copy link
Copy link

Description

@kristjanvalur
Issue body actions

Problem

Currently, stackman provides stack switching but no built-in overflow detection. Users must manually implement guard pages or canaries.

Proposal

Add optional stack overflow detection helpers:

  1. Guard zone utilities:

    • stackman_guard_init(void *stack, size_t size, size_t guard_bytes) - Initialize guard pattern
    • stackman_guard_check(void *stack, size_t size, size_t guard_bytes) - Verify guard intact
  2. Stack usage tracking:

    • stackman_stack_usage(void *stack_base, size_t size) - Measure actual usage via stack painting

Benefits

  • Easier debugging of stack-related crashes
  • Production overflow detection
  • Helps users size stacks appropriately

Implementation

Could be a separate header (stackman_debug.h) to keep core library minimal.

Related

test_04 already uses basic guard bytes for validation - could formalize this pattern.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.