OpenHFT / OpenHFT/Java-Thread-Affinity

LinuxHelper.sched_getcpu() uses wrong syscall number: 318 (getrandom) instead of 309 (getcpu) on x86_64

Open Beginner friendly
#203 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.9k
Forks
367
PR merge metrics
No merged PRs in 30d

Description

In LinuxHelper.sched_getcpu(), the fallback path calls lib.syscall(318, cpu, node, null) intending to invoke getcpu. However, on x86_64 Linux:

__NR_getcpu = 309
__NR_getrandom = 318
So the code is actually invoking getrandom(2) with incorrect arguments rather than getcpu(2).

Location: net.openhft.affinity.impl.LinuxHelper, method sched_getcpu(), in the UnsatisfiedLinkError catch block.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in LinuxHelper.sched_getcpu(), specifically the UnsatisfiedLinkError fallback that calls lib.syscall. Check the x86_64 syscall numbers against the issue description, update the fallback to use the getcpu number, and verify that the fallback invokes getcpu rather than getrandom.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
operating-systems
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.