mailweb.openeuler.org
Manage this list

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Kernel

Threads by month
  • ----- 2025 -----
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
kernel@openeuler.org

August 2024

  • 83 participants
  • 926 discussions
[openeuler:OLK-6.6 13311/13455] drivers/crypto/ccp/hygon/tdm-kernel-guard.c:308:37: error: 'NR_syscalls' undeclared; did you mean 'si_syscall'?
by kernel test robot 20 Aug '24

20 Aug '24
tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 063fb5b67877d27a0adebef0dd88bab842d8de07 commit: 3ad98583441f7c8a2553e1e8d6340ed4397033e2 [13311/13455] crypto: tdm: Support dynamic protection for SCT and IDT by HYGON TDM config: x86_64-randconfig-004-20240819 (https://download.01.org/0day-ci/archive/20240820/202408200300.4dy9MKnd-lkp@…) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240820/202408200300.4dy9MKnd-lkp@…) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp(a)intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202408200300.4dy9MKnd-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/crypto/ccp/hygon/tdm-kernel-guard.c:151:5: warning: no previous prototype for 'tdm_service_run' [-Wmissing-prototypes] 151 | int tdm_service_run(struct tdm_security_enhance *data) | ^~~~~~~~~~~~~~~ drivers/crypto/ccp/hygon/tdm-kernel-guard.c:212:5: warning: no previous prototype for 'tdm_service_exit' [-Wmissing-prototypes] 212 | int tdm_service_exit(struct tdm_security_enhance *data) | ^~~~~~~~~~~~~~~~ drivers/crypto/ccp/hygon/tdm-kernel-guard.c:243:15: warning: no previous prototype for 'kprobe_symbol_address_byname' [-Wmissing-prototypes] 243 | unsigned long kprobe_symbol_address_byname(const char *name) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/crypto/ccp/hygon/tdm-kernel-guard.c: In function 'kernel_security_enhance_init': >> drivers/crypto/ccp/hygon/tdm-kernel-guard.c:308:37: error: 'NR_syscalls' undeclared (first use in this function); did you mean 'si_syscall'? 308 | eh_objs[SCT].size = NR_syscalls * sizeof(char *); | ^~~~~~~~~~~ | si_syscall drivers/crypto/ccp/hygon/tdm-kernel-guard.c:308:37: note: each undeclared identifier is reported only once for each function it appears in Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for ACPI_HOTPLUG_IGNORE_OSC Depends on [n]: ACPI [=y] && ACPI_HOTPLUG_CPU [=n] Selected by [y]: - X86 [=y] && ACPI [=y] && HOTPLUG_CPU [=y] vim +308 drivers/crypto/ccp/hygon/tdm-kernel-guard.c 286 287 sct_addr = (unsigned long *)kallsyms_lookup_name("sys_call_table"); 288 #endif 289 if (!sct_addr) { 290 ret = -DYN_ERR_API; 291 pr_err("kallsyms_lookup_name for sys_call_table failed!"); 292 goto end; 293 } 294 295 asm("sidt %0":"=m"(idtr)); 296 297 if (!psp_check_tdm_support()) 298 return 0; 299 300 for (i = 0; i < MAX_OBJ; i++) { 301 memset(&eh_objs[i], 0, sizeof(eh_objs[i])); 302 eh_objs[i].context = CONTEXT_CHECK_MODNAME; 303 eh_objs[i].obj_name = obj_names[i]; 304 } 305 306 if ((eh_obj == -1) || (eh_obj & (1 << SCT))) { 307 eh_objs[SCT].vaddr = (uint64_t)sct_addr; > 308 eh_objs[SCT].size = NR_syscalls * sizeof(char *); 309 } 310 if ((eh_obj == -1) || (eh_obj & (1 << IDT))) { 311 eh_objs[IDT].vaddr = idtr.address; 312 eh_objs[IDT].size = idtr.size; 313 } 314 315 for (i = 0; i < MAX_OBJ; i++) { 316 if (eh_objs[i].vaddr) 317 tdm_service_run(&eh_objs[i]); 318 } 319 320 pr_info("Hygon TDM guard load successfully!\n"); 321 322 end: 323 return ret; 324 } 325 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
1 0
0 0
[openeuler:OLK-6.6 13310/13455] drivers/crypto/ccp/hygon/tdm-dev.c:340:61: error: invalid use of undefined type 'struct module'
by kernel test robot 20 Aug '24

20 Aug '24
tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 063fb5b67877d27a0adebef0dd88bab842d8de07 commit: a1dd4972da4e66d9a9d1a89b3dfd8f742c20193b [13310/13455] crypto: tdm: Add Hygon TDM driver config: x86_64-buildonly-randconfig-006-20240819 (https://download.01.org/0day-ci/archive/20240820/202408200124.eAjYI7Na-lkp@…) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240820/202408200124.eAjYI7Na-lkp@…) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp(a)intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202408200124.eAjYI7Na-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/crypto/ccp/hygon/tdm-dev.c: In function 'list_enqueue': drivers/crypto/ccp/hygon/tdm-dev.c:94:13: warning: variable 'ret' set but not used [-Wunused-but-set-variable] 94 | int ret = 0; | ^~~ drivers/crypto/ccp/hygon/tdm-dev.c: In function 'tdm_get_cmd_context_hash': >> drivers/crypto/ccp/hygon/tdm-dev.c:340:61: error: invalid use of undefined type 'struct module' 340 | memcpy(ctx_msg.module_name, p_module->name, sizeof(p_module->name)); | ^~ drivers/crypto/ccp/hygon/tdm-dev.c:340:84: error: invalid use of undefined type 'struct module' 340 | memcpy(ctx_msg.module_name, p_module->name, sizeof(p_module->name)); | ^~ drivers/crypto/ccp/hygon/tdm-dev.c: In function 'psp_create_measure_task': drivers/crypto/ccp/hygon/tdm-dev.c:606:27: warning: variable 'head' set but not used [-Wunused-but-set-variable] 606 | struct list_head *head = NULL; | ^~~~ vim +340 drivers/crypto/ccp/hygon/tdm-dev.c 323 324 if (!hash) { 325 ret = -DYN_NULL_POINTER; 326 pr_err("Null pointer\n"); 327 goto end; 328 } 329 330 ctx_msg.flag = flag; 331 ctx_msg.pid = current->pid; 332 memcpy(ctx_msg.comm, current->comm, sizeof(current->comm)); 333 334 return_address = CALLER_ADDR1; 335 if (return_address) { 336 #if IS_BUILTIN(CONFIG_CRYPTO_DEV_CCP_DD) 337 p_module = __module_address(return_address); 338 // caller is module 339 if (p_module) > 340 memcpy(ctx_msg.module_name, p_module->name, sizeof(p_module->name)); 341 // caller is build-in 342 else 343 memset(ctx_msg.module_name, 0, sizeof(ctx_msg.module_name)); 344 #elif IS_ENABLED(CONFIG_KALLSYMS) 345 symbol_len = sprint_symbol((char *)symbol_buf, return_address); 346 if (!symbol_len) { 347 ret = -DYN_ERR_API; 348 pr_err("sprint_symbol failed\n"); 349 goto end; 350 } 351 symbol_begin = strchr((char *)symbol_buf, '['); 352 if (!symbol_begin) { 353 ret = -DYN_NULL_POINTER; 354 pr_err("module name is not exist\n"); 355 goto end; 356 } 357 symbol_end = strchr((char *)symbol_buf, ']'); 358 if (!symbol_end) { 359 ret = -DYN_NULL_POINTER; 360 pr_err("module name is not exist\n"); 361 goto end; 362 } 363 symbol_begin++; 364 if (symbol_end - symbol_begin) 365 memcpy(ctx_msg.module_name, symbol_begin, symbol_end - symbol_begin); 366 else 367 memset(ctx_msg.module_name, 0, sizeof(ctx_msg.module_name)); 368 #else 369 memset(ctx_msg.module_name, 0, sizeof(ctx_msg.module_name)); 370 #endif 371 } else 372 memset(ctx_msg.module_name, 0, sizeof(ctx_msg.module_name)); 373 374 ret = calc_task_context_hash(ctx_msg, hash); 375 if (ret) { 376 pr_err("calc_task_context_hash failed\n"); 377 goto end; 378 } 379 380 end: 381 return ret; 382 } 383 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
1 0
0 0
[openeuler:openEuler-1.0-LTS 10131/23506] kernel/sched/debug.o: warning: objtool: missing symbol for section .text.unlikely
by kernel test robot 20 Aug '24

20 Aug '24
tree: https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS head: 36fe9923e738b237c70af2304f0d1d2a033fc632 commit: acfa0f545c7dd43f959c28e8ab4b139c927ba387 [10131/23506] svm: reduce log of run queue and atomic->atomic64 config: x86_64-buildonly-randconfig-001-20240819 (https://download.01.org/0day-ci/archive/20240820/202408200045.LpVCr73z-lkp@…) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240820/202408200045.LpVCr73z-lkp@…) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp(a)intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202408200045.LpVCr73z-lkp@intel.com/ All warnings (new ones prefixed by >>): kernel/sched/debug.c:797:6: warning: no previous prototype for 'sysrq_sched_debug_tidy' [-Wmissing-prototypes] 797 | void sysrq_sched_debug_tidy(void) | ^~~~~~~~~~~~~~~~~~~~~~ >> kernel/sched/debug.o: warning: objtool: missing symbol for section .text.unlikely -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
1 0
0 0
[openeuler:OLK-6.6 12432/13455] arch/arm64/kvm/virtcca_cvm.c:70:6: warning: no previous prototype for 'kvm_cvm_supports_sve'
by kernel test robot 20 Aug '24

20 Aug '24
tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 063fb5b67877d27a0adebef0dd88bab842d8de07 commit: 67e11ee6347c43a97e8987b03a5b3534cd8095d9 [12432/13455] kvm: add virtcca cvm host feature config: arm64-randconfig-003-20240820 (https://download.01.org/0day-ci/archive/20240820/202408200033.m00Dx7hV-lkp@…) compiler: aarch64-linux-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240820/202408200033.m00Dx7hV-lkp@…) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp(a)intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202408200033.m00Dx7hV-lkp@intel.com/ All warnings (new ones prefixed by >>): >> arch/arm64/kvm/virtcca_cvm.c:70:6: warning: no previous prototype for 'kvm_cvm_supports_sve' [-Wmissing-prototypes] 70 | bool kvm_cvm_supports_sve(void) | ^~~~~~~~~~~~~~~~~~~~ >> arch/arm64/kvm/virtcca_cvm.c:75:6: warning: no previous prototype for 'kvm_cvm_supports_pmu' [-Wmissing-prototypes] 75 | bool kvm_cvm_supports_pmu(void) | ^~~~~~~~~~~~~~~~~~~~ >> arch/arm64/kvm/virtcca_cvm.c:80:5: warning: no previous prototype for 'kvm_cvm_ipa_limit' [-Wmissing-prototypes] 80 | u32 kvm_cvm_ipa_limit(void) | ^~~~~~~~~~~~~~~~~ >> arch/arm64/kvm/virtcca_cvm.c:85:5: warning: no previous prototype for 'kvm_cvm_get_num_brps' [-Wmissing-prototypes] 85 | u32 kvm_cvm_get_num_brps(void) | ^~~~~~~~~~~~~~~~~~~~ >> arch/arm64/kvm/virtcca_cvm.c:90:5: warning: no previous prototype for 'kvm_cvm_get_num_wrps' [-Wmissing-prototypes] 90 | u32 kvm_cvm_get_num_wrps(void) | ^~~~~~~~~~~~~~~~~~~~ >> arch/arm64/kvm/virtcca_cvm.c:244:5: warning: no previous prototype for 'kvm_cvm_create_ttt_levels' [-Wmissing-prototypes] 244 | int kvm_cvm_create_ttt_levels(struct kvm *kvm, struct virtcca_cvm *cvm, | ^~~~~~~~~~~~~~~~~~~~~~~~~ >> arch/arm64/kvm/virtcca_cvm.c:311:5: warning: no previous prototype for 'kvm_cvm_populate_par_region' [-Wmissing-prototypes] 311 | int kvm_cvm_populate_par_region(struct kvm *kvm, u64 numa_set, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ -- >> arch/arm64/kvm/tmi.c:131:5: warning: no previous prototype for 'tmi_tmm_inf_test' [-Wmissing-prototypes] 131 | u64 tmi_tmm_inf_test(u64 x1, u64 x2, u64 x3, u64 x4, u64 x5) | ^~~~~~~~~~~~~~~~ vim +/kvm_cvm_supports_sve +70 arch/arm64/kvm/virtcca_cvm.c 69 > 70 bool kvm_cvm_supports_sve(void) 71 { 72 return tmm_supports(TMI_FEATURE_REGISTER_0_SVE_EN); 73 } 74 > 75 bool kvm_cvm_supports_pmu(void) 76 { 77 return tmm_supports(TMI_FEATURE_REGISTER_0_PMU_EN); 78 } 79 > 80 u32 kvm_cvm_ipa_limit(void) 81 { 82 return u64_get_bits(tmm_feat_reg0, TMI_FEATURE_REGISTER_0_S2SZ); 83 } 84 > 85 u32 kvm_cvm_get_num_brps(void) 86 { 87 return u64_get_bits(tmm_feat_reg0, TMI_FEATURE_REGISTER_0_NUM_BPS); 88 } 89 > 90 u32 kvm_cvm_get_num_wrps(void) 91 { 92 return u64_get_bits(tmm_feat_reg0, TMI_FEATURE_REGISTER_0_NUM_WPS); 93 } 94 95 static int cvm_vmid_reserve(void) 96 { 97 int ret; 98 unsigned int vmid_count = 1 << kvm_get_vmid_bits(); 99 100 spin_lock(&cvm_vmid_lock); 101 ret = bitmap_find_free_region(cvm_vmid_bitmap, vmid_count, 0); 102 spin_unlock(&cvm_vmid_lock); 103 104 return ret; 105 } 106 107 static void cvm_vmid_release(unsigned int vmid) 108 { 109 spin_lock(&cvm_vmid_lock); 110 bitmap_release_region(cvm_vmid_bitmap, vmid, 0); 111 spin_unlock(&cvm_vmid_lock); 112 } 113 114 static u32 __kvm_pgd_page_idx(struct kvm_pgtable *pgt, u64 addr) 115 { 116 u64 shift = ARM64_HW_PGTABLE_LEVEL_SHIFT(pgt->start_level - 1); 117 u64 mask = BIT(pgt->ia_bits) - 1; 118 119 return (addr & mask) >> shift; 120 } 121 122 static u32 kvm_pgd_pages(u32 ia_bits, u32 start_level) 123 { 124 struct kvm_pgtable pgt = { 125 .ia_bits = ia_bits, 126 .start_level = start_level, 127 }; 128 return __kvm_pgd_page_idx(&pgt, -1ULL) + 1; 129 } 130 131 /* 132 * the configurable physical numa range in QEMU is 0-127, 133 * but in real scenarios, 0-63 is sufficient. 134 */ 135 static u64 kvm_get_host_numa_set_by_vcpu(u64 vcpu, struct kvm *kvm) 136 { 137 int64_t i; 138 struct virtcca_cvm *cvm = kvm->arch.virtcca_cvm; 139 struct kvm_numa_info *numa_info = &cvm->numa_info; 140 141 for (i = 0; i < numa_info->numa_cnt && i < MAX_NUMA_NODE; i++) { 142 if (test_bit(vcpu, (unsigned long *)numa_info->numa_nodes[i].cpu_id)) 143 return numa_info->numa_nodes[i].host_numa_nodes[0]; 144 } 145 return NO_NUMA; 146 } 147 148 static u64 kvm_get_first_binded_numa_set(struct kvm *kvm) 149 { 150 struct virtcca_cvm *cvm = kvm->arch.virtcca_cvm; 151 struct kvm_numa_info *numa_info = &cvm->numa_info; 152 153 if (numa_info->numa_cnt > 0) 154 return numa_info->numa_nodes[0].host_numa_nodes[0]; 155 return NO_NUMA; 156 } 157 158 int kvm_arm_create_cvm(struct kvm *kvm) 159 { 160 int ret; 161 struct kvm_pgtable *pgt = kvm->arch.mmu.pgt; 162 unsigned int pgd_sz; 163 struct virtcca_cvm *cvm = kvm->arch.virtcca_cvm; 164 /* get affine host numa set by default vcpu 0 */ 165 u64 numa_set = kvm_get_host_numa_set_by_vcpu(0, kvm); 166 167 if (!kvm_is_virtcca_cvm(kvm) || virtcca_cvm_state(kvm) != CVM_STATE_NONE) 168 return 0; 169 170 if (!cvm->params) { 171 ret = -EFAULT; 172 goto out; 173 } 174 175 ret = cvm_vmid_reserve(); 176 if (ret < 0) 177 goto out; 178 179 cvm->cvm_vmid = ret; 180 181 pgd_sz = kvm_pgd_pages(pgt->ia_bits, pgt->start_level); 182 183 cvm->params->ttt_level_start = kvm->arch.mmu.pgt->start_level; 184 cvm->params->ttt_num_start = pgd_sz; 185 cvm->params->s2sz = VTCR_EL2_IPA(kvm->arch.vtcr); 186 cvm->params->vmid = cvm->cvm_vmid; 187 cvm->params->ns_vtcr = kvm->arch.vtcr; 188 cvm->params->vttbr_el2 = kvm->arch.mmu.pgd_phys; 189 memcpy(cvm->params->rpv, &cvm->cvm_vmid, sizeof(cvm->cvm_vmid)); 190 cvm->rd = tmi_cvm_create(__pa(cvm->params), numa_set); 191 if (!cvm->rd) { 192 kvm_err("KVM creates cVM failed: %d\n", cvm->cvm_vmid); 193 ret = -ENOMEM; 194 goto out; 195 } 196 197 WRITE_ONCE(cvm->state, CVM_STATE_NEW); 198 ret = 0; 199 out: 200 kfree(cvm->params); 201 cvm->params = NULL; 202 if (ret < 0) { 203 kfree(cvm); 204 kvm->arch.virtcca_cvm = NULL; 205 } 206 return ret; 207 } 208 209 void kvm_destroy_cvm(struct kvm *kvm) 210 { 211 struct virtcca_cvm *cvm = kvm->arch.virtcca_cvm; 212 uint32_t cvm_vmid; 213 214 if (!cvm) 215 return; 216 217 cvm_vmid = cvm->cvm_vmid; 218 kfree(cvm->params); 219 cvm->params = NULL; 220 221 if (virtcca_cvm_state(kvm) == CVM_STATE_NONE) 222 return; 223 224 cvm_vmid_release(cvm_vmid); 225 226 WRITE_ONCE(cvm->state, CVM_STATE_DYING); 227 228 if (!tmi_cvm_destroy(cvm->rd)) 229 kvm_info("KVM has destroyed cVM: %d\n", cvm->cvm_vmid); 230 231 kfree(cvm); 232 kvm->arch.virtcca_cvm = NULL; 233 } 234 235 static int kvm_cvm_ttt_create(struct virtcca_cvm *cvm, 236 unsigned long addr, 237 int level, 238 u64 numa_set) 239 { 240 addr = ALIGN_DOWN(addr, cvm_ttt_level_mapsize(level - 1)); 241 return tmi_ttt_create(numa_set, cvm->rd, addr, level); 242 } 243 > 244 int kvm_cvm_create_ttt_levels(struct kvm *kvm, struct virtcca_cvm *cvm, 245 unsigned long ipa, 246 int level, 247 int max_level, 248 struct kvm_mmu_memory_cache *mc) 249 { 250 int ret = 0; 251 if (WARN_ON(level == max_level)) 252 return 0; 253 254 while (level++ < max_level) { 255 u64 numa_set = kvm_get_first_binded_numa_set(kvm); 256 257 ret = kvm_cvm_ttt_create(cvm, ipa, level, numa_set); 258 if (ret) 259 return -ENXIO; 260 } 261 262 return 0; 263 } 264 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
1 0
0 0
[PATCH OLK-6.6] bpf, arm64: Fix trampoline for BPF_TRAMP_F_CALL_ORIG
by Tengda Wu 19 Aug '24

19 Aug '24
From: Puranjay Mohan <puranjay(a)kernel.org> mainline inclusion from mainline-v6.11-rc1 commit 19d3c179a37730caf600a97fed3794feac2b197b category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAKQ62 CVE: CVE-2024-43840 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?… -------------------------------- When BPF_TRAMP_F_CALL_ORIG is set, the trampoline calls __bpf_tramp_enter() and __bpf_tramp_exit() functions, passing them the struct bpf_tramp_image *im pointer as an argument in R0. The trampoline generation code uses emit_addr_mov_i64() to emit instructions for moving the bpf_tramp_image address into R0, but emit_addr_mov_i64() assumes the address to be in the vmalloc() space and uses only 48 bits. Because bpf_tramp_image is allocated using kzalloc(), its address can use more than 48-bits, in this case the trampoline will pass an invalid address to __bpf_tramp_enter/exit() causing a kernel crash. Fix this by using emit_a64_mov_i64() in place of emit_addr_mov_i64() as it can work with addresses that are greater than 48-bits. Fixes: efc9909fdce0 ("bpf, arm64: Add bpf trampoline for arm64") Signed-off-by: Puranjay Mohan <puranjay(a)kernel.org> Signed-off-by: Daniel Borkmann <daniel(a)iogearbox.net> Closes: https://lore.kernel.org/all/SJ0PR15MB461564D3F7E7A763498CA6A8CBDB2@SJ0PR15M… Link: https://lore.kernel.org/bpf/20240711151838.43469-1-puranjay@kernel.org Conflicts: arch/arm64/net/bpf_jit_comp.c [The conflict is due to commit 96b0f5addc7a ("arm64, bpf: Use bpf_prog_pack for arm64 bpf trampoline"), a perf commit, which changes ctx->image to ctx->ro_image] Signed-off-by: Tengda Wu <wutengda2(a)huawei.com> --- arch/arm64/net/bpf_jit_comp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index 166619348b98..0618c95af103 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -1942,7 +1942,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, emit(A64_STR64I(A64_R(20), A64_SP, regs_off + 8), ctx); if (flags & BPF_TRAMP_F_CALL_ORIG) { - emit_addr_mov_i64(A64_R(0), (const u64)im, ctx); + emit_a64_mov_i64(A64_R(0), (const u64)im, ctx); emit_call((const u64)__bpf_tramp_enter, ctx); } @@ -1986,7 +1986,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, if (flags & BPF_TRAMP_F_CALL_ORIG) { im->ip_epilogue = ctx->image + ctx->idx; - emit_addr_mov_i64(A64_R(0), (const u64)im, ctx); + emit_a64_mov_i64(A64_R(0), (const u64)im, ctx); emit_call((const u64)__bpf_tramp_exit, ctx); } -- 2.34.1
2 1
0 0
[PATCH OLK-5.10] bpf, arm64: Fix trampoline for BPF_TRAMP_F_CALL_ORIG
by Tengda Wu 19 Aug '24

19 Aug '24
From: Puranjay Mohan <puranjay(a)kernel.org> mainline inclusion from mainline-v6.11-rc1 commit 19d3c179a37730caf600a97fed3794feac2b197b category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAKQ62 CVE: CVE-2024-43840 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?… -------------------------------- When BPF_TRAMP_F_CALL_ORIG is set, the trampoline calls __bpf_tramp_enter() and __bpf_tramp_exit() functions, passing them the struct bpf_tramp_image *im pointer as an argument in R0. The trampoline generation code uses emit_addr_mov_i64() to emit instructions for moving the bpf_tramp_image address into R0, but emit_addr_mov_i64() assumes the address to be in the vmalloc() space and uses only 48 bits. Because bpf_tramp_image is allocated using kzalloc(), its address can use more than 48-bits, in this case the trampoline will pass an invalid address to __bpf_tramp_enter/exit() causing a kernel crash. Fix this by using emit_a64_mov_i64() in place of emit_addr_mov_i64() as it can work with addresses that are greater than 48-bits. Fixes: efc9909fdce0 ("bpf, arm64: Add bpf trampoline for arm64") Signed-off-by: Puranjay Mohan <puranjay(a)kernel.org> Signed-off-by: Daniel Borkmann <daniel(a)iogearbox.net> Closes: https://lore.kernel.org/all/SJ0PR15MB461564D3F7E7A763498CA6A8CBDB2@SJ0PR15M… Link: https://lore.kernel.org/bpf/20240711151838.43469-1-puranjay@kernel.org Conflicts: arch/arm64/net/bpf_jit_comp.c [The conflict is due to commit 96b0f5addc7a ("arm64, bpf: Use bpf_prog_pack for arm64 bpf trampoline"), a perf commit, which changes ctx->image to ctx->ro_image] Signed-off-by: Tengda Wu <wutengda2(a)huawei.com> --- arch/arm64/net/bpf_jit_comp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index 5560d20f68f4..f6e790058b0a 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -1640,7 +1640,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, emit(A64_STR64I(A64_R(19), A64_SP, regs_off), ctx); if (flags & BPF_TRAMP_F_CALL_ORIG) { - emit_addr_mov_i64(A64_R(0), (const u64)im, ctx); + emit_a64_mov_i64(A64_R(0), (const u64)im, ctx); emit_call((const u64)__bpf_tramp_enter, ctx); } @@ -1681,7 +1681,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, if (flags & BPF_TRAMP_F_CALL_ORIG) { im->ip_epilogue = ctx->image + ctx->idx; - emit_addr_mov_i64(A64_R(0), (const u64)im, ctx); + emit_a64_mov_i64(A64_R(0), (const u64)im, ctx); emit_call((const u64)__bpf_tramp_exit, ctx); } -- 2.34.1
2 1
0 0
[PATCH openEuler-22.03-LTS-SP1] Revert "kbuild: fix false positive warning/error about missing libelf"
by zhaoxuedong 19 Aug '24

19 Aug '24
openEuler inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAD5GG?from=project-issue CVE: NA -------------------- When your development environment does not have the libelf library and you compile an external module with the "M=xxx" compilation option, the external module will not have ORC information and there will be no warning or errors. If a machine insmod this module and it's process is calling a function in this module, typing kaptch will result in an error indicating that the stack of this process is not trustworthy. The worst thing is that if this module is a necessary and will be used for a long time, kpatch will be difficult to type. --------------------- Revert "kbuild: fix false positive warning/error about missing libelf" This reverts commit ef7cfd00b2caf6edeb7f169682b64be2d0a798cf. Fixes: ef7cfd00b2ca ("kbuild: fix false positive warning/error about missing libelf") Signed-off-by: Zhao Xuedong <zhaoxuedong(a)meituan.com> --- Makefile | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index fbaeeb80a69e..82dcf846d07b 100644 --- a/Makefile +++ b/Makefile @@ -1100,6 +1100,11 @@ ifdef CONFIG_STACK_VALIDATION ifeq ($(has_libelf),1) objtool_target := tools/objtool FORCE else + ifdef CONFIG_UNWINDER_ORC + $(error "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") + else + $(warning "Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") + endif SKIP_STACK_VALIDATION := 1 export SKIP_STACK_VALIDATION endif @@ -1249,14 +1254,6 @@ uapi-asm-generic: PHONY += prepare-objtool prepare-resolve_btfids prepare-objtool: $(objtool_target) -ifeq ($(SKIP_STACK_VALIDATION),1) -ifdef CONFIG_UNWINDER_ORC - @echo "error: Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2 - @false -else - @echo "warning: Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2 -endif -endif prepare-resolve_btfids: $(resolve_btfids_target) ifeq ($(ERROR_RESOLVE_BTFIDS),1) -- 2.43.0
2 1
0 0
[PATCH openEuler-1.0-LTS] perf: Optimize perf_pmu_migrate_context()
by Liu Chuang 19 Aug '24

19 Aug '24
From: Peter Zijlstra <peterz(a)infradead.org> mainline inclusion from mainline-v6.3-rc6 commit b168098912926236bbeebaf7795eb7aab76d2b45 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAL27E Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id… --------------------------- Thomas reported that offlining CPUs spends a lot of time in synchronize_rcu() as called from perf_pmu_migrate_context() even though he's not actually using uncore events. Turns out, the thing is unconditionally waiting for RCU, even if there's no actual events to migrate. Fixes: 0cda4c023132 ("perf: Introduce perf_pmu_migrate_context()") Reported-by: Thomas Gleixner <tglx(a)linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz(a)infradead.org> Tested-by: Thomas Gleixner <tglx(a)linutronix.de> Reviewed-by: Thomas Gleixner <tglx(a)linutronix.de> Reviewed-by: Paul E. McKenney <paulmck(a)kernel.org> Link: https://lkml.kernel.org/r/20230403090858.GT4253@hirez.programming.kicks-ass… Conflicts: kernel/events/core.c [Due to not merge previous commit bd27568117664b8b3e259721393df420ed51f57b] Signed-off-by: Liu Chuang <liuchuang40(a)huawei.com> --- kernel/events/core.c | 68 +++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index be528436a03b..b9667223b050 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -11247,42 +11247,44 @@ void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu) list_add(&event->migrate_entry, &events); } - /* - * Wait for the events to quiesce before re-instating them. - */ - synchronize_rcu(); + if (!list_empty(&events)) { + /* + * Wait for the events to quiesce before re-instating them. + */ + synchronize_rcu(); - /* - * Re-instate events in 2 passes. - * - * Skip over group leaders and only install siblings on this first - * pass, siblings will not get enabled without a leader, however a - * leader will enable its siblings, even if those are still on the old - * context. - */ - list_for_each_entry_safe(event, tmp, &events, migrate_entry) { - if (event->group_leader == event) - continue; + /* + * Re-instate events in 2 passes. + * + * Skip over group leaders and only install siblings on this first + * pass, siblings will not get enabled without a leader, however a + * leader will enable its siblings, even if those are still on the old + * context. + */ + list_for_each_entry_safe(event, tmp, &events, migrate_entry) { + if (event->group_leader == event) + continue; - list_del(&event->migrate_entry); - if (event->state >= PERF_EVENT_STATE_OFF) - event->state = PERF_EVENT_STATE_INACTIVE; - account_event_cpu(event, dst_cpu); - perf_install_in_context(dst_ctx, event, dst_cpu); - get_ctx(dst_ctx); - } + list_del(&event->migrate_entry); + if (event->state >= PERF_EVENT_STATE_OFF) + event->state = PERF_EVENT_STATE_INACTIVE; + account_event_cpu(event, dst_cpu); + perf_install_in_context(dst_ctx, event, dst_cpu); + get_ctx(dst_ctx); + } - /* - * Once all the siblings are setup properly, install the group leaders - * to make it go. - */ - list_for_each_entry_safe(event, tmp, &events, migrate_entry) { - list_del(&event->migrate_entry); - if (event->state >= PERF_EVENT_STATE_OFF) - event->state = PERF_EVENT_STATE_INACTIVE; - account_event_cpu(event, dst_cpu); - perf_install_in_context(dst_ctx, event, dst_cpu); - get_ctx(dst_ctx); + /* + * Once all the siblings are setup properly, install the group leaders + * to make it go. + */ + list_for_each_entry_safe(event, tmp, &events, migrate_entry) { + list_del(&event->migrate_entry); + if (event->state >= PERF_EVENT_STATE_OFF) + event->state = PERF_EVENT_STATE_INACTIVE; + account_event_cpu(event, dst_cpu); + perf_install_in_context(dst_ctx, event, dst_cpu); + get_ctx(dst_ctx); + } } mutex_unlock(&dst_ctx->mutex); mutex_unlock(&src_ctx->mutex); -- 2.34.1
2 1
0 0
[PATCH OLK-5.10] perf: Optimize perf_pmu_migrate_context()
by Liu Chuang 19 Aug '24

19 Aug '24
From: Peter Zijlstra <peterz(a)infradead.org> mainline inclusion from mainline-v6.3-rc6 commit b168098912926236bbeebaf7795eb7aab76d2b45 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAL27E Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id… --------------------------- Thomas reported that offlining CPUs spends a lot of time in synchronize_rcu() as called from perf_pmu_migrate_context() even though he's not actually using uncore events. Turns out, the thing is unconditionally waiting for RCU, even if there's no actual events to migrate. Fixes: 0cda4c023132 ("perf: Introduce perf_pmu_migrate_context()") Reported-by: Thomas Gleixner <tglx(a)linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz(a)infradead.org> Tested-by: Thomas Gleixner <tglx(a)linutronix.de> Reviewed-by: Thomas Gleixner <tglx(a)linutronix.de> Reviewed-by: Paul E. McKenney <paulmck(a)kernel.org> Link: https://lkml.kernel.org/r/20230403090858.GT4253@hirez.programming.kicks-ass… Conflicts: kernel/events/core.c [Due to not merge previous commit bd27568117664b8b3e259721393df420ed51f57b] Signed-off-by: Liu Chuang <liuchuang40(a)huawei.com> --- kernel/events/core.c | 68 +++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index b1fabcaeeffd..46b0c7fc2270 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -12424,42 +12424,44 @@ void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu) list_add(&event->migrate_entry, &events); } - /* - * Wait for the events to quiesce before re-instating them. - */ - synchronize_rcu(); + if (!list_empty(&events)) { + /* + * Wait for the events to quiesce before re-instating them. + */ + synchronize_rcu(); - /* - * Re-instate events in 2 passes. - * - * Skip over group leaders and only install siblings on this first - * pass, siblings will not get enabled without a leader, however a - * leader will enable its siblings, even if those are still on the old - * context. - */ - list_for_each_entry_safe(event, tmp, &events, migrate_entry) { - if (event->group_leader == event) - continue; + /* + * Re-instate events in 2 passes. + * + * Skip over group leaders and only install siblings on this first + * pass, siblings will not get enabled without a leader, however a + * leader will enable its siblings, even if those are still on the old + * context. + */ + list_for_each_entry_safe(event, tmp, &events, migrate_entry) { + if (event->group_leader == event) + continue; - list_del(&event->migrate_entry); - if (event->state >= PERF_EVENT_STATE_OFF) - event->state = PERF_EVENT_STATE_INACTIVE; - account_event_cpu(event, dst_cpu); - perf_install_in_context(dst_ctx, event, dst_cpu); - get_ctx(dst_ctx); - } + list_del(&event->migrate_entry); + if (event->state >= PERF_EVENT_STATE_OFF) + event->state = PERF_EVENT_STATE_INACTIVE; + account_event_cpu(event, dst_cpu); + perf_install_in_context(dst_ctx, event, dst_cpu); + get_ctx(dst_ctx); + } - /* - * Once all the siblings are setup properly, install the group leaders - * to make it go. - */ - list_for_each_entry_safe(event, tmp, &events, migrate_entry) { - list_del(&event->migrate_entry); - if (event->state >= PERF_EVENT_STATE_OFF) - event->state = PERF_EVENT_STATE_INACTIVE; - account_event_cpu(event, dst_cpu); - perf_install_in_context(dst_ctx, event, dst_cpu); - get_ctx(dst_ctx); + /* + * Once all the siblings are setup properly, install the group leaders + * to make it go. + */ + list_for_each_entry_safe(event, tmp, &events, migrate_entry) { + list_del(&event->migrate_entry); + if (event->state >= PERF_EVENT_STATE_OFF) + event->state = PERF_EVENT_STATE_INACTIVE; + account_event_cpu(event, dst_cpu); + perf_install_in_context(dst_ctx, event, dst_cpu); + get_ctx(dst_ctx); + } } mutex_unlock(&dst_ctx->mutex); mutex_unlock(&src_ctx->mutex); -- 2.34.1
2 1
0 0
[PATCH openEuler-22.03-LTS-SP1] Revert "kbuild: fix false positive warning/error about missing libelf"
by zhaoxuedong 19 Aug '24

19 Aug '24
openEuler inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAD5GG?from=project-issue CVE: NA -------------------- When your development environment does not have the libelf library and you compile an external module with the "M=xxx" compilation option, the external module will not have ORC information and there will be no warning or errors. If a machine insmod this module and it's process is calling a function in this module, typing kaptch will result in an error indicating that the stack of this process is not trustworthy. The worst thing is that if this module is a necessary and will be used for a long time, kpatch will be difficult to type. --------------------- Revert "kbuild: fix false positive warning/error about missing libelf" This reverts commit ef7cfd00b2caf6edeb7f169682b64be2d0a798cf. Fixes: ef7cfd00b2ca Signed-off-by: Zhao Xuedong <zhaoxuedong(a)meituan.com> --- Makefile | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index fbaeeb80a69e..82dcf846d07b 100644 --- a/Makefile +++ b/Makefile @@ -1100,6 +1100,11 @@ ifdef CONFIG_STACK_VALIDATION ifeq ($(has_libelf),1) objtool_target := tools/objtool FORCE else + ifdef CONFIG_UNWINDER_ORC + $(error "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") + else + $(warning "Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") + endif SKIP_STACK_VALIDATION := 1 export SKIP_STACK_VALIDATION endif @@ -1249,14 +1254,6 @@ uapi-asm-generic: PHONY += prepare-objtool prepare-resolve_btfids prepare-objtool: $(objtool_target) -ifeq ($(SKIP_STACK_VALIDATION),1) -ifdef CONFIG_UNWINDER_ORC - @echo "error: Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2 - @false -else - @echo "warning: Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2 -endif -endif prepare-resolve_btfids: $(resolve_btfids_target) ifeq ($(ERROR_RESOLVE_BTFIDS),1) -- 2.43.0
2 1
0 0
  • ← Newer
  • 1
  • ...
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • ...
  • 93
  • Older →

HyperKitty Powered by HyperKitty