Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'x86_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Borislav Petkov:

- Fix the MSI message data struct definition

- Use local labels in the exception table macros to avoid symbol
conflicts with clang LTO builds

- A couple of fixes to objtool checking of the relatively newly added
SLS and IBT code

- Rename a local var in the WARN* macro machinery to prevent shadowing

* tag 'x86_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/msi: Fix msi message data shadow struct
x86/extable: Prefer local labels in .set directives
x86,bpf: Avoid IBT objtool warning
objtool: Fix SLS validation for kcov tail-call replacement
objtool: Fix IBT tail-call detection
x86/bug: Prevent shadowing in __WARN_FLAGS
x86/mm/tlb: Revert retpoline avoidance approach

+54 -57
+10 -10
arch/x86/include/asm/asm.h
··· 154 154 155 155 # define DEFINE_EXTABLE_TYPE_REG \ 156 156 ".macro extable_type_reg type:req reg:req\n" \ 157 - ".set found, 0\n" \ 158 - ".set regnr, 0\n" \ 157 + ".set .Lfound, 0\n" \ 158 + ".set .Lregnr, 0\n" \ 159 159 ".irp rs,rax,rcx,rdx,rbx,rsp,rbp,rsi,rdi,r8,r9,r10,r11,r12,r13,r14,r15\n" \ 160 160 ".ifc \\reg, %%\\rs\n" \ 161 - ".set found, found+1\n" \ 162 - ".long \\type + (regnr << 8)\n" \ 161 + ".set .Lfound, .Lfound+1\n" \ 162 + ".long \\type + (.Lregnr << 8)\n" \ 163 163 ".endif\n" \ 164 - ".set regnr, regnr+1\n" \ 164 + ".set .Lregnr, .Lregnr+1\n" \ 165 165 ".endr\n" \ 166 - ".set regnr, 0\n" \ 166 + ".set .Lregnr, 0\n" \ 167 167 ".irp rs,eax,ecx,edx,ebx,esp,ebp,esi,edi,r8d,r9d,r10d,r11d,r12d,r13d,r14d,r15d\n" \ 168 168 ".ifc \\reg, %%\\rs\n" \ 169 - ".set found, found+1\n" \ 170 - ".long \\type + (regnr << 8)\n" \ 169 + ".set .Lfound, .Lfound+1\n" \ 170 + ".long \\type + (.Lregnr << 8)\n" \ 171 171 ".endif\n" \ 172 - ".set regnr, regnr+1\n" \ 172 + ".set .Lregnr, .Lregnr+1\n" \ 173 173 ".endr\n" \ 174 - ".if (found != 1)\n" \ 174 + ".if (.Lfound != 1)\n" \ 175 175 ".error \"extable_type_reg: bad register argument\"\n" \ 176 176 ".endif\n" \ 177 177 ".endm\n"
+2 -2
arch/x86/include/asm/bug.h
··· 78 78 */ 79 79 #define __WARN_FLAGS(flags) \ 80 80 do { \ 81 - __auto_type f = BUGFLAG_WARNING|(flags); \ 81 + __auto_type __flags = BUGFLAG_WARNING|(flags); \ 82 82 instrumentation_begin(); \ 83 - _BUG_FLAGS(ASM_UD2, f, ASM_REACHABLE); \ 83 + _BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \ 84 84 instrumentation_end(); \ 85 85 } while (0) 86 86
+11 -8
arch/x86/include/asm/msi.h
··· 12 12 /* Structs and defines for the X86 specific MSI message format */ 13 13 14 14 typedef struct x86_msi_data { 15 - u32 vector : 8, 16 - delivery_mode : 3, 17 - dest_mode_logical : 1, 18 - reserved : 2, 19 - active_low : 1, 20 - is_level : 1; 21 - 22 - u32 dmar_subhandle; 15 + union { 16 + struct { 17 + u32 vector : 8, 18 + delivery_mode : 3, 19 + dest_mode_logical : 1, 20 + reserved : 2, 21 + active_low : 1, 22 + is_level : 1; 23 + }; 24 + u32 dmar_subhandle; 25 + }; 23 26 } __attribute__ ((packed)) arch_msi_msg_data_t; 24 27 #define arch_msi_msg_data x86_msi_data 25 28
+5 -32
arch/x86/mm/tlb.c
··· 855 855 nr_invalidate); 856 856 } 857 857 858 - static bool tlb_is_not_lazy(int cpu) 858 + static bool tlb_is_not_lazy(int cpu, void *data) 859 859 { 860 860 return !per_cpu(cpu_tlbstate_shared.is_lazy, cpu); 861 861 } 862 - 863 - static DEFINE_PER_CPU(cpumask_t, flush_tlb_mask); 864 862 865 863 DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state_shared, cpu_tlbstate_shared); 866 864 EXPORT_PER_CPU_SYMBOL(cpu_tlbstate_shared); ··· 888 890 * up on the new contents of what used to be page tables, while 889 891 * doing a speculative memory access. 890 892 */ 891 - if (info->freed_tables) { 893 + if (info->freed_tables) 892 894 on_each_cpu_mask(cpumask, flush_tlb_func, (void *)info, true); 893 - } else { 894 - /* 895 - * Although we could have used on_each_cpu_cond_mask(), 896 - * open-coding it has performance advantages, as it eliminates 897 - * the need for indirect calls or retpolines. In addition, it 898 - * allows to use a designated cpumask for evaluating the 899 - * condition, instead of allocating one. 900 - * 901 - * This code works under the assumption that there are no nested 902 - * TLB flushes, an assumption that is already made in 903 - * flush_tlb_mm_range(). 904 - * 905 - * cond_cpumask is logically a stack-local variable, but it is 906 - * more efficient to have it off the stack and not to allocate 907 - * it on demand. Preemption is disabled and this code is 908 - * non-reentrant. 909 - */ 910 - struct cpumask *cond_cpumask = this_cpu_ptr(&flush_tlb_mask); 911 - int cpu; 912 - 913 - cpumask_clear(cond_cpumask); 914 - 915 - for_each_cpu(cpu, cpumask) { 916 - if (tlb_is_not_lazy(cpu)) 917 - __cpumask_set_cpu(cpu, cond_cpumask); 918 - } 919 - on_each_cpu_mask(cond_cpumask, flush_tlb_func, (void *)info, true); 920 - } 895 + else 896 + on_each_cpu_cond_mask(tlb_is_not_lazy, flush_tlb_func, 897 + (void *)info, 1, cpumask); 921 898 } 922 899 923 900 void flush_tlb_multi(const struct cpumask *cpumask,
+1
arch/x86/net/bpf_jit_comp.c
··· 412 412 EMIT_LFENCE(); 413 413 EMIT2(0xFF, 0xE0 + reg); 414 414 } else if (cpu_feature_enabled(X86_FEATURE_RETPOLINE)) { 415 + OPTIMIZER_HIDE_VAR(reg); 415 416 emit_jump(&prog, &__x86_indirect_thunk_array[reg], ip); 416 417 } else 417 418 #endif
+25 -5
tools/objtool/check.c
··· 1155 1155 : arch_nop_insn(insn->len)); 1156 1156 1157 1157 insn->type = sibling ? INSN_RETURN : INSN_NOP; 1158 + 1159 + if (sibling) { 1160 + /* 1161 + * We've replaced the tail-call JMP insn by two new 1162 + * insn: RET; INT3, except we only have a single struct 1163 + * insn here. Mark it retpoline_safe to avoid the SLS 1164 + * warning, instead of adding another insn. 1165 + */ 1166 + insn->retpoline_safe = true; 1167 + } 1168 + 1158 1169 return; 1159 1170 } 1160 1171 ··· 1250 1239 return insn1->func->pfunc == insn2->func->pfunc; 1251 1240 } 1252 1241 1253 - static bool is_first_func_insn(struct instruction *insn) 1242 + static bool is_first_func_insn(struct objtool_file *file, struct instruction *insn) 1254 1243 { 1255 - return insn->offset == insn->func->offset || 1256 - (insn->type == INSN_ENDBR && 1257 - insn->offset == insn->func->offset + insn->len); 1244 + if (insn->offset == insn->func->offset) 1245 + return true; 1246 + 1247 + if (ibt) { 1248 + struct instruction *prev = prev_insn_same_sym(file, insn); 1249 + 1250 + if (prev && prev->type == INSN_ENDBR && 1251 + insn->offset == insn->func->offset + prev->len) 1252 + return true; 1253 + } 1254 + 1255 + return false; 1258 1256 } 1259 1257 1260 1258 /* ··· 1347 1327 insn->jump_dest->func->pfunc = insn->func; 1348 1328 1349 1329 } else if (!same_function(insn, insn->jump_dest) && 1350 - is_first_func_insn(insn->jump_dest)) { 1330 + is_first_func_insn(file, insn->jump_dest)) { 1351 1331 /* internal sibling call (without reloc) */ 1352 1332 add_call_dest(file, insn, insn->jump_dest->func, true); 1353 1333 }