Commit 8bdd22a
Fix CodePatcher test backing storage
Summary:
Use aligned 8-byte storage for the patchpoint and verify patching preserves surrounding memory.
The free-threaded x86 implementation currently accesses a full aligned 8-byte word, even for shorter patches. I’ll investigate separately whether this restriction causes issues for other callers. This change only updates the test to match the current implementation.
AddressSanitizer: stack-buffer-overflow (/data/users/alperyoney/fbsource3/buck-out/v2/art/fbcode/99380b56af1146f2/cinderx/RuntimeTests/__RuntimeTests_3.14t__/RuntimeTests_3.14t+0x33f081a) (BuildId: 1ff8500db347146bd67e824898b0aca4aff0c28e) in __asan_memcpy
Shadow bytes around the buggy address:
0x7b0b76b89d80: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
0x7b0b76b89e00: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
0x7b0b76b89e80: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
0x7b0b76b89f00: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
0x7b0b76b89f80: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
=>0x7b0b76b8a000: f1 f1 f1 f1 02 f2[02]f2 02 f2 02 f2 00 00 00 f2
0x7b0b76b8a080: f2 f2 f2 f2 f8 f8 f2 f2 f8 f2 f8 f2 f2 f2 f8 f2
0x7b0b76b8a100: f2 f2 00 00 f2 f2 f8 f8 f8 f8 f2 f2 f2 f2 f8 f8
0x7b0b76b8a180: f2 f2 f8 f2 f8 f2 f2 f2 f8 f2 f2 f2 00 00 f2 f2
0x7b0b76b8a200: f8 f8 f8 f8 f2 f2 f2 f2 00 00 f2 f2 f8 f8 f2 f2
0x7b0b76b8a280: f8 f2 f8 f2 f2 f2 f8 f2 f2 f2 00 00 f2 f2 f8 f8
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==1751566==ABORTING
```
Reviewed By: DinoV
Differential Revision: D114631917
fbshipit-source-id: 489c4666fc1140ffd8ef9076a3ce5b44f03d2c341 parent 58e8651 commit 8bdd22a
1 file changed
Lines changed: 24 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
83 | 92 | | |
84 | 93 | | |
85 | 94 | | |
86 | 95 | | |
87 | 96 | | |
88 | 97 | | |
89 | | - | |
| 98 | + | |
90 | 99 | | |
91 | 100 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
95 | 104 | | |
96 | 105 | | |
97 | 106 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
101 | 110 | | |
102 | 111 | | |
103 | 112 | | |
104 | | - | |
105 | | - | |
106 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
107 | 116 | | |
108 | 117 | | |
109 | 118 | | |
| |||
0 commit comments