- Notifications
You must be signed in to change notification settings - Fork18.4k
Commit32fb193
committed
[release-branch.go1.3] cmd/5l, cmd/6l, cmd/8l: fix nacl binary corruption bug
««« CL 135050043 / 57dfd03985a9cmd/5l, cmd/6l, cmd/8l: fix nacl binary corruption bugNaCl requires the addition of a 32-byte "halt sled" at the endof the text segment. This means that segtext.len is actually32 bytes shorter than reality. The computation of the file offsetof the end of the data segment did not take this 32 bytes intoaccount, so if len and len+32 rounded up (by 64k) to differentvalues, the symbol table overwrote the last page of the datasegment.The last page of the data segment is usually the C .stringsymbols, which contain the strings used in error printsby the runtime. So when this happens, your programprobably crashes, and then when it does, you get binarygarbage instead of all the usual prints.The chance of hitting this with a randomly sized text segmentis 32 in 65536, or 1 in 2048.If you add or remove ANY code while trying to debug thisproblem, you're overwhelmingly likely to bump the textsegment one way or the other and make the bug disappear.Correct all the computations to use segdata.fileoff+segdata.fileleninstead of trying to rederive segdata.fileoff.This fixes the failure during the nacl/amd64p32 build.TBR=iantCC=golang-codereviewshttps://golang.org/cl/135050043»»»LGTM=bradfitzR=golang-codereviewsCC=adg, bradfitz, golang-codereviews, ianthttps://golang.org/cl/1511500441 parentc09c8bb commit32fb193
3 files changed
+10
-10
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
599 | 599 |
| |
600 | 600 |
| |
601 | 601 |
| |
602 |
| - | |
| 602 | + | |
603 | 603 |
| |
604 | 604 |
| |
605 |
| - | |
| 605 | + | |
606 | 606 |
| |
607 | 607 |
| |
608 | 608 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
689 | 689 |
| |
690 | 690 |
| |
691 | 691 |
| |
692 |
| - | |
| 692 | + | |
693 | 693 |
| |
694 | 694 |
| |
695 |
| - | |
| 695 | + | |
696 | 696 |
| |
697 | 697 |
| |
698 | 698 |
| |
| |||
701 | 701 |
| |
702 | 702 |
| |
703 | 703 |
| |
704 |
| - | |
| 704 | + | |
705 | 705 |
| |
706 | 706 |
| |
707 | 707 |
| |
708 |
| - | |
| 708 | + | |
709 | 709 |
| |
710 | 710 |
| |
711 | 711 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
619 | 619 |
| |
620 | 620 |
| |
621 | 621 |
| |
622 |
| - | |
| 622 | + | |
623 | 623 |
| |
624 | 624 |
| |
625 |
| - | |
| 625 | + | |
626 | 626 |
| |
627 | 627 |
| |
628 |
| - | |
| 628 | + | |
629 | 629 |
| |
630 | 630 |
| |
631 | 631 |
| |
632 |
| - | |
| 632 | + | |
633 | 633 |
| |
634 | 634 |
| |
635 | 635 |
| |
|
0 commit comments
Comments
(0)