Commit 159dff1
Fix ksym buffer overrun on 32 bit platforms
Commit 78074c5 ("info: expose more prog jited info"), which made its
way into v0.17.0, resulted in random runc CI failures when running i386
binary on an amd64 kernel (see [1]).
Apparently [2], the kernel always returns 64-bit pointers, so uint64
(rather than uintptr) should be used for ksyms slice regardless of
the platform to avoid the buffer overrun.
Now, to keep the public API of (*ProgramInfo).JitedKsymAddrs intact,
convert those addresses back to uintptr, as it was done before
commit 78074c5. Except, if the kernel address won't fit into an
uintptr (as it is the case when running i386 binary on an amd64 kernel),
return an empty slice and a false, rather than incorrect addresses.
[1]: opencontainers/runc#4594
[2]: https://github.com/torvalds/linux/blob/2014c95afecee3e76ca4a56956a936e23283f05b/kernel/bpf/syscall.c#L4840-L4846
Signed-off-by: Kir Kolyshkin <[email protected]>1 parent 0cd3acc commit 159dff1
1 file changed
+20
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
347 | | - | |
| 347 | + | |
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| |||
630 | 630 | | |
631 | 631 | | |
632 | 632 | | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
633 | 637 | | |
634 | | - | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
635 | 652 | | |
636 | 653 | | |
637 | 654 | | |
| |||
0 commit comments