Repository navigation
Commit 4fb8ab0
committed
Map KstatCtl.kc_chain as a pointer
kstat_ctl_t declares kc_chain as a kstat_t pointer, but KstatCtl mapped it
as an inline Kstat structure, so JNA computed the structure as 200 bytes
against the native 24 (32 on Solaris 11.4). Because a Structure passed by
reference is written before and read after every call, each
kstat_chain_update, kstat_lookup, kstat_read, and kstat_close wrote 176
bytes past the end of the block kstat_open() allocated, reverting
adjacent heap to its contents at the previous call.
Map kc_chain as a Pointer and add KstatCtl.chain() to return the chain
head as a Kstat, using a new Kstat(Pointer) constructor that next() now
shares. Solaris 11.4's trailing kc_private field is private to libkstat
and deliberately left unmapped; the structure only wraps the pointer
kstat_open() returns, so the three-field mapping is a safe prefix there.
Verified on Solaris 11.4 SPARC under libumem with UMEM_DEBUG=default:
size 24, a full walk of the 4675-entry chain, and 1000 update/lookup/read
cycles plus kstat_close with no allocator errors.
Fixes #17401 parent d036ad9 commit 4fb8ab0
2 files changed
Lines changed: 27 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
143 | 152 | | |
144 | 153 | | |
145 | 154 | | |
146 | 155 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 156 | + | |
151 | 157 | | |
152 | 158 | | |
153 | 159 | | |
| |||
350 | 356 | | |
351 | 357 | | |
352 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
353 | 365 | | |
354 | 366 | | |
355 | 367 | | |
356 | 368 | | |
357 | 369 | | |
358 | 370 | | |
359 | | - | |
| 371 | + | |
360 | 372 | | |
361 | 373 | | |
362 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
363 | 381 | | |
364 | 382 | | |
365 | 383 | | |
| |||
0 commit comments