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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0AA4D1AD47 for ; Wed, 16 Oct 2024 11:22:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 499F26B0083; Wed, 16 Oct 2024 07:22:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 449876B0088; Wed, 16 Oct 2024 07:22:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 339516B0089; Wed, 16 Oct 2024 07:22:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1702E6B0083 for ; Wed, 16 Oct 2024 07:22:17 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2CC131C46D4 for ; Wed, 16 Oct 2024 11:22:05 +0000 (UTC) X-FDA: 82679226294.01.E6C46A0 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by imf15.hostedemail.com (Postfix) with ESMTP id BC74FA000C for ; Wed, 16 Oct 2024 11:22:04 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=AI7KY3ER; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf15.hostedemail.com: domain of lkp@intel.com designates 198.175.65.14 as permitted sender) smtp.mailfrom=lkp@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729077701; a=rsa-sha256; cv=none; b=ZQaIdpmOdytZ6S6SNNnNNcDTHn+N1i/UdufkhZS2qTWepW5LsOTT+WQaAABD1s4b3odqre FYXUz21l4Jcb98ud4nKAbN1MkbVAzphM/Z4MEK0vEcZQ9FxdCXbZe4aG8J4Sm1bnGIh0AS SKGx9AFz/ujV82fDeDQBkqhYMRxRXGk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=AI7KY3ER; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf15.hostedemail.com: domain of lkp@intel.com designates 198.175.65.14 as permitted sender) smtp.mailfrom=lkp@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729077701; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=jwYmgacNlPwom9HJWn+FIOnz8yPX9yAALYS23d/9C6Y=; b=e8n+fx6EHHkL1JeRaciyNqz28a2yZAyLsRYpnLcUj/uXrL0AFqXzJQRpBU3DQmg7p0pueV BWFzM1ZtWNXd1SRd7ksS/kYopfaBi5j1rzod/4E9FOUoOnAYnoWtCXeFJ+/pLcSn2gqduI tkm+L7uTsiSRP8uIU7eViUvVBhHlah0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729077733; x=1760613733; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Gau0sTeAKP4PxxVTvgkDOWCBf/ZUVWIEi4VtTvfm0rk=; b=AI7KY3ERM87SnhC9dKJAyGAF3CcbFv9JIUHSVMUZDWMyRLlLt2nhM2mt LbxqSfHEo1jvQLLdOY7yyvOuexonfkfp+PV6j7gEW+FFmLL/PnVxWauRp +CgzoOMtkdE18nYY6s8z5krrD3mCjsa+D+kocXTaDqBh3pNlbrEifwsz/ 68tGnE1vfgrfWbA+S7WYACgIwjGPJ/GdMHSc7Q5kMMSeQJzrI5AI0827l 74K46XL3RB0BNJb2ia/JOdmNhlXuRSbOm44H+vdwIaGLnD1lvjFIcePds taT7OLJaJXEAxkx71nl6Sshr0XJF7l4/78o5lSE22Yy4frm+F3t58S2qT Q==; X-CSE-ConnectionGUID: l/O75W42TIuBvQmnh7v/NA== X-CSE-MsgGUID: ozik0cQFQxOFT0uuyjhF0A== X-IronPort-AV: E=McAfee;i="6700,10204,11226"; a="32317977" X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="32317977" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 04:22:12 -0700 X-CSE-ConnectionGUID: 8j/7+9XOS+SQsZvNVHkwvw== X-CSE-MsgGUID: 9Iz2gBfdTWe9P65TlLL2GQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="78083159" Received: from lkp-server01.sh.intel.com (HELO a48cf1aa22e8) ([10.239.97.150]) by orviesa009.jf.intel.com with ESMTP; 16 Oct 2024 04:22:10 -0700 Received: from kbuild by a48cf1aa22e8 with local (Exim 4.96) (envelope-from ) id 1t126R-000Kpv-0m; Wed, 16 Oct 2024 11:22:07 +0000 Date: Wed, 16 Oct 2024 19:21:14 +0800 From: kernel test robot To: Markus Elfring , linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org, Andrew Morton , Herbert Xu , Peter Zijlstra Cc: oe-kbuild-all@lists.linux.dev, Linux Memory Management List , LKML Subject: Re: [PATCH v3 2/3] lib/digsig: Use scope-based resource management for two MPI variables in digsig_verify_rsa() Message-ID: <202410161914.lY62TWL3-lkp@intel.com> References: <300a0376-f003-4862-bb16-7e004733c9c1@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <300a0376-f003-4862-bb16-7e004733c9c1@web.de> X-Rspam-User: X-Stat-Signature: ky1crrtepmusymssmsrt7wnksxcj51mp X-Rspamd-Queue-Id: BC74FA000C X-Rspamd-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0Sag9lvJY8TKK76vwtcxV7ETuNFMbHqT9dy9R/Matoa6wkGjVOPNm1i3usjJUhCa+UlibrXIu+Ckh92nfUyzoJPLEfMjgVPsY1QeKilHHDstPxusK9go6zZh3POHlqSrhmsFNoNcZnX89XoUAiuMMcMrfgdPxQNPUGq4FbWX3BeBDg/O1Np24L4KVSTvomHsl2EPc5+eEx9UWbrhVMXHQx5QbSzJm3lLulQwIxecLKg98XJBaPsXC0y0ppDx8/zrNeWImuzL4MO7UyrRNX50xZ2hz0WqVp4FTMqABq528MkdaCVIlCoM2rhEi3picyBucTCALv9e4JQl4dyESAKU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi Markus, kernel test robot noticed the following build errors: [auto build test ERROR on akpm-mm/mm-nonmm-unstable] [also build test ERROR on herbert-crypto-2.6/master herbert-cryptodev-2.6/master linus/master v6.12-rc3 next-20241016] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Markus-Elfring/crypto-lib-mpi-Extend-support-for-scope-based-resource-management/20241012-231156 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable patch link: https://lore.kernel.org/r/300a0376-f003-4862-bb16-7e004733c9c1%40web.de patch subject: [PATCH v3 2/3] lib/digsig: Use scope-based resource management for two MPI variables in digsig_verify_rsa() config: hexagon-randconfig-r064-20241016 (https://download.01.org/0day-ci/archive/20241016/202410161914.lY62TWL3-lkp@intel.com/config) compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241016/202410161914.lY62TWL3-lkp@intel.com/reproduce) 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 | Closes: https://lore.kernel.org/oe-kbuild-all/202410161914.lY62TWL3-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from lib/digsig.c:25: In file included from include/linux/mpi.h:21: In file included from include/linux/scatterlist.h:9: In file included from arch/hexagon/include/asm/io.h:328: include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __raw_readb(PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) ^ In file included from lib/digsig.c:25: In file included from include/linux/mpi.h:21: In file included from include/linux/scatterlist.h:9: In file included from arch/hexagon/include/asm/io.h:328: include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) ^ In file included from lib/digsig.c:25: In file included from include/linux/mpi.h:21: In file included from include/linux/scatterlist.h:9: In file included from arch/hexagon/include/asm/io.h:328: include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writeb(value, PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ >> lib/digsig.c:176:3: error: expected statement } ^ lib/digsig.c:178:2: error: expected statement } ^ 6 warnings and 2 errors generated. vim +176 lib/digsig.c 63 64 /* 65 * RSA Signature verification with public key 66 */ 67 static int digsig_verify_rsa(struct key *key, 68 const char *sig, int siglen, 69 const char *h, int hlen) 70 { 71 int err = -EINVAL; 72 unsigned long len; 73 unsigned long mlen, mblen; 74 unsigned int l; 75 int head, i; 76 unsigned char *out1 = NULL; 77 const char *m; 78 MPI pkey[2]; 79 uint8_t *p, *datap; 80 const uint8_t *endp; 81 const struct user_key_payload *ukp; 82 struct pubkey_hdr *pkh; 83 84 down_read(&key->sem); 85 ukp = user_key_payload_locked(key); 86 87 if (!ukp) { 88 /* key was revoked before we acquired its semaphore */ 89 err = -EKEYREVOKED; 90 goto err1; 91 } 92 93 if (ukp->datalen < sizeof(*pkh)) 94 goto err1; 95 96 pkh = (struct pubkey_hdr *)ukp->data; 97 98 if (pkh->version != 1) 99 goto err1; 100 101 if (pkh->algo != PUBKEY_ALGO_RSA) 102 goto err1; 103 104 if (pkh->nmpi != 2) 105 goto err1; 106 107 datap = pkh->mpi; 108 endp = ukp->data + ukp->datalen; 109 110 for (i = 0; i < pkh->nmpi; i++) { 111 unsigned int remaining = endp - datap; 112 pkey[i] = mpi_read_from_buffer(datap, &remaining); 113 if (IS_ERR(pkey[i])) { 114 err = PTR_ERR(pkey[i]); 115 goto free_keys; 116 } 117 datap += remaining; 118 } 119 120 mblen = mpi_get_nbits(pkey[0]); 121 mlen = DIV_ROUND_UP(mblen, 8); 122 123 if (mlen == 0) { 124 err = -EINVAL; 125 goto free_keys; 126 } 127 128 err = -ENOMEM; 129 130 out1 = kzalloc(mlen, GFP_KERNEL); 131 if (!out1) 132 goto free_keys; 133 134 { 135 unsigned int nret = siglen; 136 MPI in __free(mpi_free) = mpi_read_from_buffer(sig, &nret); 137 138 if (IS_ERR(in)) { 139 err = PTR_ERR(in); 140 goto in_exit; 141 } 142 143 { 144 MPI res __free(mpi_free) = mpi_alloc(mpi_get_nlimbs(in) * 2); 145 146 if (!res) 147 goto res_exit; 148 149 err = mpi_powm(res, in, pkey[1], pkey[0]); 150 if (err) 151 goto res_exit; 152 153 if (mpi_get_nlimbs(res) * BYTES_PER_MPI_LIMB > mlen) { 154 err = -EINVAL; 155 goto res_exit; 156 } 157 158 p = mpi_get_buffer(res, &l, NULL); 159 if (!p) { 160 err = -EINVAL; 161 goto res_exit; 162 } 163 164 len = mlen; 165 head = len - l; 166 memset(out1, 0, head); 167 memcpy(out1 + head, p, l); 168 169 kfree(p); 170 171 m = pkcs_1_v1_5_decode_emsa(out1, len, mblen, &len); 172 173 if (!m || len != hlen || memcmp(m, h, hlen)) 174 err = -EINVAL; 175 res_exit: > 176 } 177 in_exit: 178 } 179 180 kfree(out1); 181 free_keys: 182 while (--i >= 0) 183 mpi_free(pkey[i]); 184 err1: 185 up_read(&key->sem); 186 187 return err; 188 } 189 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki