Commit 8ccd798
authored
[release/10.0] Fix Linux madvise() advice values (#128605)
Backport of #126966 to release/10.0
## Customer Impact
- [x] Customer reported
- [ ] Found internally
`VirtualReset` in GC was combining `MADV_FREE` (8) and `MADV_DONTDUMP`
(16) via bitwise OR and passing the result (24) to a single `madvise`
call. `madvise` takes a single advice constant — not a bitmask — so this
was either rejected as `EINVAL` (kernels < 5.18) or silently matched
`MADV_DONTNEED_LOCKED` (kernels ≥ 5.18), a completely different
operation.
## Regression
- [x] Yes - introduced in .NET 9 by #95643 (an optimization to reduce
syscall count).
- [ ] No
## Testing
CI tests, local testing using targeted repro app from the customer, GC
tests
## Risk
Low. It is a simple targeted fix that just makes two calls to `madvise`
with correct arguments where we were making one call with a combination
of those values that had no effect or was outright wrong.1 parent cb36ff8 commit 8ccd798
1 file changed
Lines changed: 5 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
741 | 741 | | |
742 | 742 | | |
743 | 743 | | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | 744 | | |
749 | 745 | | |
750 | | - | |
| 746 | + | |
751 | 747 | | |
752 | 748 | | |
753 | | - | |
| 749 | + | |
754 | 750 | | |
755 | 751 | | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
| 752 | + | |
| 753 | + | |
764 | 754 | | |
765 | 755 | | |
766 | 756 | | |
767 | | - | |
768 | | - | |
| 757 | + | |
769 | 758 | | |
770 | 759 | | |
771 | 760 | | |
| |||
0 commit comments