From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93A87C433EF for ; Wed, 6 Apr 2022 18:54:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FLMzgx6+8YVFLdvXFXUzzFe6YGKah9SL0SxR6wLJIzM=; b=IvUk7eSK4ypJkX BShVkUxLlntz0tB4HYhiuCFwftLVLGfSopXHAwOycIN4d3rPJyOjUD/gCEb3L69DHwFFB+HOXTCNr 2Nab79oY4EsaA9TEKQ9SR+AApFnb3VtnUd6RAGlIpWAvjYDoJN5SNP603r7OrUcYPid6qqTGFvYMv 2NJ/xsFIBD6ax9zqP39F3/nD9+OBCjnYJ8c1QFympfcTypwBxnr3CQ5atvfsx71IXrRPbzhmW/N1O uhXpo2t3tKmEb6uKRPfELngq6VT/R+VLXUwUujd3ncpKmK67aL6shPCbsoWPuVfXXJEd2pZEjD5Rc NsEWvQN3LTZ4hZpvxp4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncAmg-007ck6-93; Wed, 06 Apr 2022 18:53:38 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncAmd-007cis-7a for linux-arm-kernel@lists.infradead.org; Wed, 06 Apr 2022 18:53:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649271215; x=1680807215; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=PDjbw3xHp1tpEP1vfxMQjIQaEu6sE5eZy4txLa+bhfQ=; b=dID2yA18QS2VSaDYXb2wme+VN8HYlHl9UXiLDmfymlhaS3ZclsZWhqEz kTUUC1EbkrBJ5j6na/lqGt/kRGpPnsOJegDdRjN2OWqY0KxBxxLZi0hQO +2/uUsnUU8Og1A1POrzURSycAMGbmrHuWWEohKyHBlJ4uiCoIA/8PKuZw P15oiU6qD4nOFa6EFtSNkqoPVA/n5BJEy+MdlpYV0u42q7pXH7T850x86 ANgSfOEdXfvgmN+KtyGCK73vYesgaxJUPyanLpvex0A6aRf5Ct2bj9YGi H4AROz+7mxOJzG0PbvHSHynhfROk3a0HwToxRsni/h+0aHnkdTVkldhae Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="258720528" X-IronPort-AV: E=Sophos;i="5.90,240,1643702400"; d="scan'208";a="258720528" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 11:53:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,240,1643702400"; d="scan'208";a="642174203" Received: from lkp-server02.sh.intel.com (HELO a44fdfb70b94) ([10.239.97.151]) by FMSMGA003.fm.intel.com with ESMTP; 06 Apr 2022 11:53:28 -0700 Received: from kbuild by a44fdfb70b94 with local (Exim 4.95) (envelope-from ) id 1ncAmW-0004ev-5s; Wed, 06 Apr 2022 18:53:28 +0000 Date: Thu, 7 Apr 2022 02:53:15 +0800 From: kernel test robot To: Masami Hiramatsu , Alexei Starovoitov Cc: kbuild-all@lists.01.org, Daniel Borkmann , Shubham Bansal , Andrii Nakryiko , Masami Hiramatsu , bpf@vger.kernel.org, kernel-team@fb.com, Jiri Olsa , Steven Rostedt , "Naveen N . Rao" , Anil S Keshavamurthy , "David S . Miller" , linux-kernel@vger.kernel.org, Mark Rutland , Will Deacon , Ard Biesheuvel , Russell King , Catalin Marinas , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH bpf 1/4] ARM: unwind: Initialize the lr_addr field of unwind_ctrl_block Message-ID: <202204070204.g3wpjuJi-lkp@intel.com> References: <164915122721.982637.1510683757540074397.stgit@devnote2> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <164915122721.982637.1510683757540074397.stgit@devnote2> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220406_115335_341462_C22A5A45 X-CRM114-Status: GOOD ( 22.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Masami, I love your patch! Perhaps something to improve: [auto build test WARNING on bpf/master] url: https://github.com/intel-lab-lkp/linux/commits/Masami-Hiramatsu/kprobes-rethook-ARM-arm64-Replace-kretprobe-trampoline-with-rethook/20220405-195153 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master config: arm-randconfig-s032-20220406 (https://download.01.org/0day-ci/archive/20220407/202204070204.g3wpjuJi-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-dirty # https://github.com/intel-lab-lkp/linux/commit/99971b0c57ce1501eda858656ed06758bbd4e376 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Masami-Hiramatsu/kprobes-rethook-ARM-arm64-Replace-kretprobe-trampoline-with-rethook/20220405-195153 git checkout 99971b0c57ce1501eda858656ed06758bbd4e376 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash arch/arm/kernel/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) >> arch/arm/kernel/unwind.c:407:24: sparse: sparse: Using plain integer as NULL pointer vim +407 arch/arm/kernel/unwind.c 377 378 /* 379 * Unwind a single frame starting with *sp for the symbol at *pc. It 380 * updates the *pc and *sp with the new values. 381 */ 382 int unwind_frame(struct stackframe *frame) 383 { 384 const struct unwind_idx *idx; 385 struct unwind_ctrl_block ctrl; 386 unsigned long sp_low; 387 388 /* store the highest address on the stack to avoid crossing it*/ 389 sp_low = frame->sp; 390 ctrl.sp_high = ALIGN(sp_low - THREAD_SIZE, THREAD_ALIGN) 391 + THREAD_SIZE; 392 393 pr_debug("%s(pc = %08lx lr = %08lx sp = %08lx)\n", __func__, 394 frame->pc, frame->lr, frame->sp); 395 396 idx = unwind_find_idx(frame->pc); 397 if (!idx) { 398 if (frame->pc && kernel_text_address(frame->pc)) 399 pr_warn("unwind: Index not found %08lx\n", frame->pc); 400 return -URC_FAILURE; 401 } 402 403 ctrl.vrs[FP] = frame->fp; 404 ctrl.vrs[SP] = frame->sp; 405 ctrl.vrs[LR] = frame->lr; 406 ctrl.vrs[PC] = 0; > 407 ctrl.lr_addr = 0; 408 409 if (idx->insn == 1) 410 /* can't unwind */ 411 return -URC_FAILURE; 412 else if (frame->pc == prel31_to_addr(&idx->addr_offset)) { 413 /* 414 * Unwinding is tricky when we're halfway through the prologue, 415 * since the stack frame that the unwinder expects may not be 416 * fully set up yet. However, one thing we do know for sure is 417 * that if we are unwinding from the very first instruction of 418 * a function, we are still effectively in the stack frame of 419 * the caller, and the unwind info has no relevance yet. 420 */ 421 if (frame->pc == frame->lr) 422 return -URC_FAILURE; 423 frame->pc = frame->lr; 424 return URC_OK; 425 } else if ((idx->insn & 0x80000000) == 0) 426 /* prel31 to the unwind table */ 427 ctrl.insn = (unsigned long *)prel31_to_addr(&idx->insn); 428 else if ((idx->insn & 0xff000000) == 0x80000000) 429 /* only personality routine 0 supported in the index */ 430 ctrl.insn = &idx->insn; 431 else { 432 pr_warn("unwind: Unsupported personality routine %08lx in the index at %p\n", 433 idx->insn, idx); 434 return -URC_FAILURE; 435 } 436 437 /* check the personality routine */ 438 if ((*ctrl.insn & 0xff000000) == 0x80000000) { 439 ctrl.byte = 2; 440 ctrl.entries = 1; 441 } else if ((*ctrl.insn & 0xff000000) == 0x81000000) { 442 ctrl.byte = 1; 443 ctrl.entries = 1 + ((*ctrl.insn & 0x00ff0000) >> 16); 444 } else { 445 pr_warn("unwind: Unsupported personality routine %08lx at %p\n", 446 *ctrl.insn, ctrl.insn); 447 return -URC_FAILURE; 448 } 449 450 ctrl.check_each_pop = 0; 451 452 if (prel31_to_addr(&idx->addr_offset) == (u32)&call_with_stack) { 453 /* 454 * call_with_stack() is the only place where we permit SP to 455 * jump from one stack to another, and since we know it is 456 * guaranteed to happen, set up the SP bounds accordingly. 457 */ 458 sp_low = frame->fp; 459 ctrl.sp_high = ALIGN(frame->fp, THREAD_SIZE); 460 } 461 462 while (ctrl.entries > 0) { 463 int urc; 464 if ((ctrl.sp_high - ctrl.vrs[SP]) < sizeof(ctrl.vrs)) 465 ctrl.check_each_pop = 1; 466 urc = unwind_exec_insn(&ctrl); 467 if (urc < 0) 468 return urc; 469 if (ctrl.vrs[SP] < sp_low || ctrl.vrs[SP] > ctrl.sp_high) 470 return -URC_FAILURE; 471 } 472 473 if (ctrl.vrs[PC] == 0) 474 ctrl.vrs[PC] = ctrl.vrs[LR]; 475 476 /* check for infinite loop */ 477 if (frame->pc == ctrl.vrs[PC] && frame->sp == ctrl.vrs[SP]) 478 return -URC_FAILURE; 479 480 frame->fp = ctrl.vrs[FP]; 481 frame->sp = ctrl.vrs[SP]; 482 frame->lr = ctrl.vrs[LR]; 483 frame->pc = ctrl.vrs[PC]; 484 frame->lr_addr = ctrl.lr_addr; 485 486 return URC_OK; 487 } 488 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6DF9C433EF for ; Wed, 6 Apr 2022 20:29:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229805AbiDFUa7 (ORCPT ); Wed, 6 Apr 2022 16:30:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234628AbiDFUag (ORCPT ); Wed, 6 Apr 2022 16:30:36 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4477F71A2C; Wed, 6 Apr 2022 11:53:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649271214; x=1680807214; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=PDjbw3xHp1tpEP1vfxMQjIQaEu6sE5eZy4txLa+bhfQ=; b=JuS9y2IF3JVyOmAPpLMJ2YDrBcF/jKWWGJRWAm5KUMesac0BKhxhfLZ8 2ZZlYVs3hRBVJ40GL2pwNfClW/6EhB/MuQoS+aLCndpPSfF6DuZJ6AJAA JJaG043hnhD2UiAqsnVCI6F8segBNSw1l21gli6von+lrQwe+xjonY7Kd 57tstRnpTmW29l3D2RPklrhL83KVc8fTikAdWb5zf5Dx6Qb3WmeuOH7fR TapitGv1UnYUehbKID5SrwPv7hHNQ85J/uEy6bon2uJXCSFpymZ6NivyG CQUje1bqcvE0HmnOPxJ8E8GDWtoAfWwVpWsiDNJxqRfUonHax4gALOG7R A==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="259964631" X-IronPort-AV: E=Sophos;i="5.90,240,1643702400"; d="scan'208";a="259964631" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 11:53:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,240,1643702400"; d="scan'208";a="642174203" Received: from lkp-server02.sh.intel.com (HELO a44fdfb70b94) ([10.239.97.151]) by FMSMGA003.fm.intel.com with ESMTP; 06 Apr 2022 11:53:28 -0700 Received: from kbuild by a44fdfb70b94 with local (Exim 4.95) (envelope-from ) id 1ncAmW-0004ev-5s; Wed, 06 Apr 2022 18:53:28 +0000 Date: Thu, 7 Apr 2022 02:53:15 +0800 From: kernel test robot To: Masami Hiramatsu , Alexei Starovoitov Cc: kbuild-all@lists.01.org, Daniel Borkmann , Shubham Bansal , Andrii Nakryiko , Masami Hiramatsu , bpf@vger.kernel.org, kernel-team@fb.com, Jiri Olsa , Steven Rostedt , "Naveen N . Rao" , Anil S Keshavamurthy , "David S . Miller" , linux-kernel@vger.kernel.org, Mark Rutland , Will Deacon , Ard Biesheuvel , Russell King , Catalin Marinas , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH bpf 1/4] ARM: unwind: Initialize the lr_addr field of unwind_ctrl_block Message-ID: <202204070204.g3wpjuJi-lkp@intel.com> References: <164915122721.982637.1510683757540074397.stgit@devnote2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <164915122721.982637.1510683757540074397.stgit@devnote2> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Masami, I love your patch! Perhaps something to improve: [auto build test WARNING on bpf/master] url: https://github.com/intel-lab-lkp/linux/commits/Masami-Hiramatsu/kprobes-rethook-ARM-arm64-Replace-kretprobe-trampoline-with-rethook/20220405-195153 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master config: arm-randconfig-s032-20220406 (https://download.01.org/0day-ci/archive/20220407/202204070204.g3wpjuJi-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-dirty # https://github.com/intel-lab-lkp/linux/commit/99971b0c57ce1501eda858656ed06758bbd4e376 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Masami-Hiramatsu/kprobes-rethook-ARM-arm64-Replace-kretprobe-trampoline-with-rethook/20220405-195153 git checkout 99971b0c57ce1501eda858656ed06758bbd4e376 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash arch/arm/kernel/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) >> arch/arm/kernel/unwind.c:407:24: sparse: sparse: Using plain integer as NULL pointer vim +407 arch/arm/kernel/unwind.c 377 378 /* 379 * Unwind a single frame starting with *sp for the symbol at *pc. It 380 * updates the *pc and *sp with the new values. 381 */ 382 int unwind_frame(struct stackframe *frame) 383 { 384 const struct unwind_idx *idx; 385 struct unwind_ctrl_block ctrl; 386 unsigned long sp_low; 387 388 /* store the highest address on the stack to avoid crossing it*/ 389 sp_low = frame->sp; 390 ctrl.sp_high = ALIGN(sp_low - THREAD_SIZE, THREAD_ALIGN) 391 + THREAD_SIZE; 392 393 pr_debug("%s(pc = %08lx lr = %08lx sp = %08lx)\n", __func__, 394 frame->pc, frame->lr, frame->sp); 395 396 idx = unwind_find_idx(frame->pc); 397 if (!idx) { 398 if (frame->pc && kernel_text_address(frame->pc)) 399 pr_warn("unwind: Index not found %08lx\n", frame->pc); 400 return -URC_FAILURE; 401 } 402 403 ctrl.vrs[FP] = frame->fp; 404 ctrl.vrs[SP] = frame->sp; 405 ctrl.vrs[LR] = frame->lr; 406 ctrl.vrs[PC] = 0; > 407 ctrl.lr_addr = 0; 408 409 if (idx->insn == 1) 410 /* can't unwind */ 411 return -URC_FAILURE; 412 else if (frame->pc == prel31_to_addr(&idx->addr_offset)) { 413 /* 414 * Unwinding is tricky when we're halfway through the prologue, 415 * since the stack frame that the unwinder expects may not be 416 * fully set up yet. However, one thing we do know for sure is 417 * that if we are unwinding from the very first instruction of 418 * a function, we are still effectively in the stack frame of 419 * the caller, and the unwind info has no relevance yet. 420 */ 421 if (frame->pc == frame->lr) 422 return -URC_FAILURE; 423 frame->pc = frame->lr; 424 return URC_OK; 425 } else if ((idx->insn & 0x80000000) == 0) 426 /* prel31 to the unwind table */ 427 ctrl.insn = (unsigned long *)prel31_to_addr(&idx->insn); 428 else if ((idx->insn & 0xff000000) == 0x80000000) 429 /* only personality routine 0 supported in the index */ 430 ctrl.insn = &idx->insn; 431 else { 432 pr_warn("unwind: Unsupported personality routine %08lx in the index at %p\n", 433 idx->insn, idx); 434 return -URC_FAILURE; 435 } 436 437 /* check the personality routine */ 438 if ((*ctrl.insn & 0xff000000) == 0x80000000) { 439 ctrl.byte = 2; 440 ctrl.entries = 1; 441 } else if ((*ctrl.insn & 0xff000000) == 0x81000000) { 442 ctrl.byte = 1; 443 ctrl.entries = 1 + ((*ctrl.insn & 0x00ff0000) >> 16); 444 } else { 445 pr_warn("unwind: Unsupported personality routine %08lx at %p\n", 446 *ctrl.insn, ctrl.insn); 447 return -URC_FAILURE; 448 } 449 450 ctrl.check_each_pop = 0; 451 452 if (prel31_to_addr(&idx->addr_offset) == (u32)&call_with_stack) { 453 /* 454 * call_with_stack() is the only place where we permit SP to 455 * jump from one stack to another, and since we know it is 456 * guaranteed to happen, set up the SP bounds accordingly. 457 */ 458 sp_low = frame->fp; 459 ctrl.sp_high = ALIGN(frame->fp, THREAD_SIZE); 460 } 461 462 while (ctrl.entries > 0) { 463 int urc; 464 if ((ctrl.sp_high - ctrl.vrs[SP]) < sizeof(ctrl.vrs)) 465 ctrl.check_each_pop = 1; 466 urc = unwind_exec_insn(&ctrl); 467 if (urc < 0) 468 return urc; 469 if (ctrl.vrs[SP] < sp_low || ctrl.vrs[SP] > ctrl.sp_high) 470 return -URC_FAILURE; 471 } 472 473 if (ctrl.vrs[PC] == 0) 474 ctrl.vrs[PC] = ctrl.vrs[LR]; 475 476 /* check for infinite loop */ 477 if (frame->pc == ctrl.vrs[PC] && frame->sp == ctrl.vrs[SP]) 478 return -URC_FAILURE; 479 480 frame->fp = ctrl.vrs[FP]; 481 frame->sp = ctrl.vrs[SP]; 482 frame->lr = ctrl.vrs[LR]; 483 frame->pc = ctrl.vrs[PC]; 484 frame->lr_addr = ctrl.lr_addr; 485 486 return URC_OK; 487 } 488 -- 0-DAY CI Kernel Test Service https://01.org/lkp