shmat() returns address which is aligned to SHMLBA, so while calling we need to pass SHMLBA-alligned address, to get equal addresses.
Details
Details
- Reviewers
kcc samsonov eugenis - Commits
- rGf7372f5c4f0e: Merging r261837: --------------------------------------------------------------…
rG72c3cce4842d: [Compiler-rt][MSan]Fix shmat testcase: Pass SHMLBA-alligned address to shmat
rCRT261837: [Compiler-rt][MSan]Fix shmat testcase: Pass SHMLBA-alligned address to shmat
rL261837: [Compiler-rt][MSan]Fix shmat testcase: Pass SHMLBA-alligned address to shmat
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Instead of writing different code for x86 and MIPS, can you just make sure that you get a SHMLBA-aligned address?
const int kShmSize = 4096; void *mapping_start = mmap(NULL, kShmSize + SHMLBA, ...); uptr p = (uptr)mapping_start; if (p % SHMLBA != 0) { p = (p + SHMLBA - 1) / SHMLBA * SHMLBA; } // p is now SHMLBA-aligned;
Comment Actions
LGTM after fixing a bug below.
lib/msan/tests/msan_test.cc | ||
---|---|---|
1222 ↗ | (On Diff #48920) | Shouldn't this be void *p = mapping_start; ? Also, you can just unconditionally round up: void *p = (void*)(((unsigned long)mapping_start + SHMLBA - 1) / SHMLBA * SHMLBA); |
lib/msan/tests/msan_test.cc | ||
---|---|---|
1222 ↗ | (On Diff #48920) | Thanks for pointing this out, I will just keep this assignment unconditional. |