| .. | .. |
|---|
| 133 | 133 | LOCK_TEXT |
|---|
| 134 | 134 | KPROBES_TEXT |
|---|
| 135 | 135 | ALIGN_ENTRY_TEXT_BEGIN |
|---|
| 136 | +#ifdef CONFIG_CPU_SRSO |
|---|
| 137 | + *(.text..__x86.rethunk_untrain) |
|---|
| 138 | +#endif |
|---|
| 139 | + |
|---|
| 136 | 140 | ENTRY_TEXT |
|---|
| 141 | + |
|---|
| 142 | +#ifdef CONFIG_CPU_SRSO |
|---|
| 143 | + /* |
|---|
| 144 | + * See the comment above srso_alias_untrain_ret()'s |
|---|
| 145 | + * definition. |
|---|
| 146 | + */ |
|---|
| 147 | + . = srso_alias_untrain_ret | (1 << 2) | (1 << 8) | (1 << 14) | (1 << 20); |
|---|
| 148 | + *(.text..__x86.rethunk_safe) |
|---|
| 149 | +#endif |
|---|
| 137 | 150 | ALIGN_ENTRY_TEXT_END |
|---|
| 138 | 151 | SOFTIRQENTRY_TEXT |
|---|
| 139 | 152 | STATIC_CALL_TEXT |
|---|
| .. | .. |
|---|
| 142 | 155 | |
|---|
| 143 | 156 | #ifdef CONFIG_RETPOLINE |
|---|
| 144 | 157 | __indirect_thunk_start = .; |
|---|
| 145 | | - *(.text.__x86.*) |
|---|
| 158 | + *(.text..__x86.indirect_thunk) |
|---|
| 159 | + *(.text..__x86.return_thunk) |
|---|
| 146 | 160 | __indirect_thunk_end = .; |
|---|
| 147 | 161 | #endif |
|---|
| 148 | 162 | } :text =0xcccc |
|---|
| 149 | 163 | |
|---|
| 150 | 164 | /* End of text section, which should occupy whole number of pages */ |
|---|
| 151 | 165 | _etext = .; |
|---|
| 166 | + |
|---|
| 152 | 167 | . = ALIGN(PAGE_SIZE); |
|---|
| 153 | 168 | |
|---|
| 154 | 169 | X86_ALIGN_RODATA_BEGIN |
|---|
| .. | .. |
|---|
| 502 | 517 | "fixed_percpu_data is not at start of per-cpu area"); |
|---|
| 503 | 518 | #endif |
|---|
| 504 | 519 | |
|---|
| 520 | +#ifdef CONFIG_RETHUNK |
|---|
| 521 | +. = ASSERT((retbleed_return_thunk & 0x3f) == 0, "retbleed_return_thunk not cacheline-aligned"); |
|---|
| 522 | +. = ASSERT((srso_safe_ret & 0x3f) == 0, "srso_safe_ret not cacheline-aligned"); |
|---|
| 523 | +#endif |
|---|
| 524 | + |
|---|
| 525 | +#ifdef CONFIG_CPU_SRSO |
|---|
| 526 | +/* |
|---|
| 527 | + * GNU ld cannot do XOR until 2.41. |
|---|
| 528 | + * https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=f6f78318fca803c4907fb8d7f6ded8295f1947b1 |
|---|
| 529 | + * |
|---|
| 530 | + * LLVM lld cannot do XOR until lld-17. |
|---|
| 531 | + * https://github.com/llvm/llvm-project/commit/fae96104d4378166cbe5c875ef8ed808a356f3fb |
|---|
| 532 | + * |
|---|
| 533 | + * Instead do: (A | B) - (A & B) in order to compute the XOR |
|---|
| 534 | + * of the two function addresses: |
|---|
| 535 | + */ |
|---|
| 536 | +. = ASSERT(((ABSOLUTE(srso_alias_untrain_ret) | srso_alias_safe_ret) - |
|---|
| 537 | + (ABSOLUTE(srso_alias_untrain_ret) & srso_alias_safe_ret)) == ((1 << 2) | (1 << 8) | (1 << 14) | (1 << 20)), |
|---|
| 538 | + "SRSO function pair won't alias"); |
|---|
| 539 | +#endif |
|---|
| 540 | + |
|---|
| 505 | 541 | #endif /* CONFIG_X86_32 */ |
|---|
| 506 | 542 | |
|---|
| 507 | 543 | #ifdef CONFIG_KEXEC_CORE |
|---|