Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795946897; b=OJswaDgXs9O6uWqQrVxbjvx1cFfmfRCjdFaY0YF7HGpDDhuWRngAxoy0Y8Ei8Wg1RUoM gozdv3YgAgkXBaXsHJ2MFZKbUTC+0fBksOIY3N4F9KFn2xeIFuqf1IQVGpjDVYdEvC2Fx pB98VCNc1q6hqoBXmBNleb4OnjrCKU1W/giGPJXrFTGQj9jyREULXVCf4fw/lIKkryYen Md+tCe+g+KiEj9yizt2k2LGCxx7Q/u2U0ywQJjKAkmt0azTOlYrigZh6xHwDE0Or1+beX ALivnIlD7/OHxCsqbygGqXKkBm+DaYmr6NZ2KIBUwSFPAI13Oce1z5PjO9jakQBuN3g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795946897; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Date:From:To: Cc:Subject:Message-ID:User-Agent; bh=5tuupBO/Hq42JJVKQll2b8FQlxiBivBt36FEhaf4nYM=; b=mXXSBWbaM5tDQjSOQWpjsav0fYk8Edjz29NamEISCxjZ95G8Qn1YwsTQY3zMp3XbAzow z2z/E4s0jss14zjyWchxpX7+GeJdTBY4f6TFvEPRk+jpYH/Y5bnP/MEygWa6K5zX643Zr LwRCMPJbExYGvhTHUUZV/xxNaUx4aMzRW659KR2EiRnia83eSXweptgDFn7O5Sv/Kh0DY 8iN+gIPZFvn3+/q46x3OOmH1MZkjnwnPabz9M5E5Sj1oU5X6Sfol6t5RKDdx5YrPdZkIe y/HaTALi9PWSA36bqQcv/s/KO+c9p4gAsReAOxRFQlQTd8TUccwutZ4VzL6Ni19iKOA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b="gIK/+SPC"; arc=none smtp.remote-ip=192.198.163.18 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDD28606A31C for ; Sun, 29 Nov 2026 10:08:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EDD28606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=gIK/+SPC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1795946896; x=1827482896; h=date:from:to:cc:subject:message-id; bh=NDyxrrbczkByH5Xa2PqU+oTIIgF4ggBXDJTQ9m29G14=; b=gIK/+SPCSNqn9hTAJjVVyYwTk5ZAXenAn+LPQYcqhbvI+cIS4Enrs4Br U3juxIJMbSsqgRa1bOPD94mcl0NODDZKkPhKZ+I672KE+ycGho3qRwzH7 GLH/jkVra5iHceabee459w8ddYXKKPLydujB8KpdNWqqA+KRCnrLRnADF UxaXWDurGTBgA2kz3ygLWfyIqmm7VNV4bJGR1744I38jIhoUlQfZ0Z82A 23a7eitzK7xsOqTL/L/DQvQib7zqNdcPRk8VBFY/s4NQC2CiVeHOhRgGo Z75KORnnIXxCMzb0PkryZcaEnqJDywwYgX3BdwfYdRJmBJmmScXzWJBtM A==; X-CSE-ConnectionGUID: hIWfkPCASO28ZrD33j0hKg== X-CSE-MsgGUID: 67Dqc7sCQ9CHF37ItVubeg== X-IronPort-AV: E=McAfee;i="6800,10657,11980"; a="4798137" X-IronPort-AV: E=Sophos;i="6.27,240,1787036400"; d="scan'208";a="4798137" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2026 02:08:15 -0800 X-CSE-ConnectionGUID: BflcOwEbSnS6cHTUi7IYUw== X-CSE-MsgGUID: zmwfzWznSzqdAqx2eH91cw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,240,1787036400"; d="scan'208";a="12750140" Received: from igk-lkp-server01.igk.intel.com (HELO 146cf1e082f1) ([10.211.93.152]) by orviesa006.jf.intel.com with ESMTP; 29 Nov 2026 02:08:14 -0800 Received: from kbuild by 146cf1e082f1 with local (Exim 4.98.2) (envelope-from ) id 1xXbpL-00000000122-47dQ; Sun, 29 Nov 2026 10:08:11 +0000 Date: Sun, 29 Nov 2026 11:07:59 +0100 From: kernel test robot To: oe-kbuild@lists.linux.dev Cc: lkp@intel.com, Dan Carpenter Subject: [kkdwivedi:sock-copy 53/57] net/core/sock_copy.c:274 sock_copy_run() error: buffer overflow 'sock_copy_queues' 64 <= u32max Message-ID: <20261129110227.hqaiIoSh-lkp@intel.com> User-Agent: s-nail v14.9.25 X-Mailing-List: oe-kbuild@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Unfiltered warning: this smatch report is sent as-is and has not been reviewed for false positives, so please treat it with due skepticism. BCC: lkp@intel.com CC: oe-kbuild-all@lists.linux.dev TO: Kumar Kartikeya Dwivedi tree: https://github.com/kkdwivedi/linux sock-copy head: bc98958cae1e859b7deaa9d24e1dfee59760b9e7 commit: b99a63ee7b6d5203ce14049aede8bd21d03a0735 [53/57] net: Split the copy of a socket's send over BPF kthreads :::::: branch date: 9 hours ago :::::: commit date: 9 hours ago config: xtensa-randconfig-2200-20261129 (https://download.01.org/0day-ci/archive/20261129/20261129110227.hqaiIoSh-lkp@intel.com/config) compiler: xtensa-linux-gcc (GCC) 16.2.0 smatch: v0.5.0-9187-g5189e3fb 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 | Reported-by: Dan Carpenter | Closes: https://lore.kernel.org/r/20261129110227.hqaiIoSh-lkp@intel.com/ New smatch warnings: net/core/sock_copy.c:274 sock_copy_run() error: buffer overflow 'sock_copy_queues' 64 <= u32max net/core/sock_copy.c:274 sock_copy_run() error: buffer overflow 'sock_copy_queues' 64 <= u32max net/core/sock_copy.c:274 sock_copy_run() error: buffer overflow 'sock_copy_queues' 64 <= u32max Old smatch warnings: arch/xtensa/include/asm/thread_info.h:97 current_thread_info() warn: inconsistent indenting vim +/sock_copy_queues +274 net/core/sock_copy.c b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 256 b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 257 /** b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 258 * sock_copy_run() - copy what the send has planned and not copied b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 259 * @copy: the send's copy b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 260 * b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 261 * The bytes are cut into pieces of at least SOCK_COPY_PIECE_MIN, one the b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 262 * caller's and one for each of the socket's queues that has a thread. Returns b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 263 * once all are copied. b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 264 */ b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 265 void sock_copy_run(struct sock_copy *copy) b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 266 { b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 267 size_t total = copy->planned - copy->done, each, off; b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 268 unsigned int pieces = 1, i; b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 269 u64 since; b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 270 b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 271 if (!total) b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 272 return; b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 273 for (i = 0; i < copy->nr && pieces <= SOCK_COPY_MAX; i++) b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 @274 if (rcu_access_pointer(sock_copy_queues[copy->first + i].thread)) b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 275 copy->piece[pieces++].queue = copy->first + i; b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 276 pieces = clamp_t(unsigned int, total / SOCK_COPY_PIECE_MIN, 1, pieces); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 277 each = round_up(DIV_ROUND_UP(total, pieces), L1_CACHE_BYTES); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 278 b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 279 atomic_set(©->pending, 0); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 280 for (i = 1, off = copy->done + each; i < pieces && off < copy->planned; i++, off += each) { b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 281 struct sock_copy_piece *piece = ©->piece[i]; b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 282 b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 283 piece->copy = copy; b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 284 piece->off = off; b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 285 piece->len = min(each, copy->planned - off); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 286 INIT_LIST_HEAD(&piece->node); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 287 atomic_inc(©->pending); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 288 if (!sock_copy_queue_piece(piece)) { b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 289 atomic_dec(©->pending); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 290 sock_copy_piece_run(piece); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 291 } b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 292 } b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 293 pieces = i; b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 294 b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 295 copy->piece[0].copy = copy; b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 296 copy->piece[0].off = copy->done; b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 297 copy->piece[0].len = min(each, total); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 298 sock_copy_piece_run(©->piece[0]); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 299 b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 300 /* Pairs with the release in sock_copy_poll(): a piece done is copied. */ b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 301 since = local_clock(); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 302 while (atomic_read_acquire(©->pending)) { b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 303 if (local_clock() - since > SOCK_COPY_TAKE_NS) { b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 304 for (i = 1; i < pieces; i++) { b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 305 if (sock_copy_take(©->piece[i])) { b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 306 sock_copy_piece_run(©->piece[i]); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 307 atomic_dec(©->pending); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 308 } b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 309 } b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 310 /* What is left runs on a thread, which may be preempted. */ b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 311 cond_resched(); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 312 since = local_clock(); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 313 } b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 314 cpu_relax(); b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 315 } b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 316 copy->done = copy->planned; b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 317 } b99a63ee7b6d52 Kumar Kartikeya Dwivedi 2026-11-28 318 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki