Skip to content

fix out-of-bounds l2 cache write in cpuinfo_arm_linux_init#418

Open
soma0212 wants to merge 1 commit into
pytorch:mainfrom
soma0212:arm-linux-l2-cache-count
Open

fix out-of-bounds l2 cache write in cpuinfo_arm_linux_init#418
soma0212 wants to merge 1 commit into
pytorch:mainfrom
soma0212:arm-linux-l2-cache-count

Conversation

@soma0212

Copy link
Copy Markdown

The L2 cache count and population passes in cpuinfo_arm_linux_init disagree on when a core gets an L2 entry:

  • counting keys off the decoded L2 size, but population overrides it with the size from sysfs (cache/index2/size)
  • a core whose built-in decode reports no L2 (ARM11, or an unrecognized ARMv6 core) but whose sysfs exposes an L2 size is skipped while counting yet still gets a slot while populating
  • l2_index then advances past l2_count, writing past the end of the calloc'd l2 array, or through a NULL l2 when the count is zero (the L2 writes are unguarded, unlike the L3 writes)

Applying the same sysfs size override in the counting pass keeps l2_count aligned with the number of entries written.

@meta-cla

meta-cla Bot commented Jul 14, 2026

Copy link
Copy Markdown

Hi @soma0212!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

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