shmat ignores shmaddr
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 57/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c, linux, macos
- Domain
- operating-systems
Research direction
Start in src/syscall/sysvipc.c at sys_shmat, where shmaddr_gva is currently ignored, and inspect how address mapping and the SHM_RND and SHM_REMAP flags are handled. Read steps 26–28 of test-rlimit-mem, which currently skip when the attach lands elsewhere. Done means the requested address and documented error cases are honored, with those test steps checking the chosen address strictly.
Written by the indexing model from the issue text.
Description
sys_shmat ignores shmaddr ((void) shmaddr_gva in src/syscall/sysvipc.c): every attach goes wherever the allocator puts it. Linux attaches at shmaddr when it is given, rounding it down with SHM_RND, and replaces what is mapped there with SHM_REMAP. It fails with EINVAL when the address is unaligned without SHM_RND, or when the range is already mapped and SHM_REMAP is not set.
A program that attaches at a chosen address, for example to share pointers between processes, gets a different address under elfuse.
Found in review on #485 (r4510389312). Steps 26 to 28 of test-rlimit-mem attach into a hole they just unmapped, and skip when the attach lands elsewhere. Once shmat honors the address, those steps can go back to a strict check.
- Dominant language
- C
- Stars
- 287
- Forks
- 33
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 18
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sysprog21/elfuse
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 2 days
All issues in sysprog21/elfuse
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
libreswan/libreswan#3185 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
category:port-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
llvm:instcombine
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
llvm/llvm-project#246503 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day