Skip to content

RLIMIT_AS and RLIMIT_DATA totals lose records once the region table is stale #488

Open

Description

@xalestar

After #485, RLIMIT_AS and RLIMIT_DATA are checked against totals summed from the region table on each call. Once regions_tracker_stale is set, the records the table dropped stay out of both totals for good, so a guest that fills the table to GUEST_MAX_REGIONS and then splits mappings can grow past either limit. Running vm_total and vm_data counters, updated wherever a mapping is added, removed or reprotected and kept even when the table has no free slot, would close that gap and also replace the full-table scan on every mmap under a finite limit.

Activity

  1. xalestar commented on Nov 7, 2026

    @xalestar
    CollaboratorAuthor

    From the review of #485: the scan also costs time. With any finite limit, every mmap, mremap growth and page-adding brk walks the whole region table, and MAP_FIXED walks it twice (mem_mapped_in, then mem_vm_totals). A guest under ulimit -v with thousands of mappings (a JVM, a browser) then pays O(n) per call. Running total and data counters kept in the region add, remove and prot-change paths would make this O(1), as mm->total_vm does, and the full sum could stay as a debug-build cross-check.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions