Skip to content

Charge [stack] at its grown extent, as Linux does #492

Open

Description

@xalestar

elfuse maps [stack] at its full fixed extent up front, and #485 counts it that way toward RLIMIT_AS. Linux counts the stack VMA only as far as it has grown.

Measured with one static probe that prints the [stack] line of /proc/self/maps and VmSize from /proc/self/status, right after exec:

[stack] in maps VmSize
elfuse 8188 KiB 8880 kB
Linux 6.18.60 132 KiB 840 kB

So a guest whose ulimit -v was sized from a Linux run gets about 8 MiB less address space under elfuse. test-rlimit-mem cannot see the gap, because it takes its base from elfuse's own VmSize.

To match Linux, [stack] would be charged (and shown in maps) at the extent the stack has grown to, and grown on a fault below it the way Linux expands the stack VMA, with RLIMIT_STACK and RLIMIT_AS checked at that point as acct_stack_growth does.

Refs #485

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions