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 6BAC4C54EE9 for ; Tue, 13 Sep 2022 07:59:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E22EC8D0001; Tue, 13 Sep 2022 03:59:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD2786B0073; Tue, 13 Sep 2022 03:59:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9AA98D0001; Tue, 13 Sep 2022 03:59:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B5CFD6B0072 for ; Tue, 13 Sep 2022 03:59:57 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 891891C687B for ; Tue, 13 Sep 2022 07:59:57 +0000 (UTC) X-FDA: 79906313634.15.D79CC96 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf02.hostedemail.com (Postfix) with ESMTP id 5ABB7800A8 for ; Tue, 13 Sep 2022 07:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663055996; x=1694591996; h=date:from:to:cc:subject:message-id:mime-version; bh=/Zo6+jKDhXQsDPrefdhLh9c3sOpBfAMwuyZHgMjJuYo=; b=Qej/4M5SuEPgPh9DYKJHjD8mtZ1KT7zUERryp6mm9tvdggd/1Z1sAQL7 atWRpXSsWioZ8ekFo4IL5Rir6Rr6j0Sj80C53QQi/qZ+a8zo8365JKB6e CWenwNsuUa+yQIIGKBocff/kp8fbQ1LUhWstLSMZyCyW+8QCL8bGQoO/L RwdPPqOwJEKm3DVrV3OAQEA5YfVUKvz9Nmqhd6gPOWI0MTgWZ6b8Pl0NQ oJAsCCeOsbV3TFF+gZJsuwfPLmhw7QYw7AZfNaPhh1ZUnHjYpGVj/OxQG 7fzhiiwpCI0c+Szc6XwdccJPYJZv2dDRreMr+haFEXGNlqqx1GcTI4YO1 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10468"; a="277806207" X-IronPort-AV: E=Sophos;i="5.93,312,1654585200"; d="scan'208";a="277806207" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2022 00:59:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,312,1654585200"; d="scan'208";a="678458354" Received: from lkp-server02.sh.intel.com (HELO 4011df4f4fd3) ([10.239.97.151]) by fmsmga008.fm.intel.com with ESMTP; 13 Sep 2022 00:59:53 -0700 Received: from kbuild by 4011df4f4fd3 with local (Exim 4.96) (envelope-from ) id 1oY0pk-0003Nj-1v; Tue, 13 Sep 2022 07:59:52 +0000 Date: Tue, 13 Sep 2022 15:59:16 +0800 From: kernel test robot To: Andrey Konovalov Cc: kbuild-all@lists.01.org, Linux Memory Management List , Andrew Morton , Marco Elver Subject: [linux-next:master 6573/6679] mm/kasan/kasan_test.c:335:59: warning: array subscript 201 is outside array bounds of 'char[201]' Message-ID: <202209131555.dMFROX4C-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663055997; a=rsa-sha256; cv=none; b=43ri4Ud0u7kv6zLbJKmnFW/u8t9ef6pPJQ1eHkOwlyxg3CPuTb9E1GxeyFpm+b6s/TF+t8 fIHUXwJzQd5zz6j1UR8dVdjKTCacCE5X1nzUpD2DyuCVOQ5tY2Q3EFh0iUWEDh6GsbTwew ThsjwYAh6QCk3PsHT2fbCA+aFXrjPek= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b="Qej/4M5S"; spf=pass (imf02.hostedemail.com: domain of lkp@intel.com designates 192.55.52.136 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663055997; 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: references:dkim-signature; bh=JC7EzW9q5a4eaR28G+mvXkMTwmYuMxQqrINHo1Pj7h0=; b=FF6E/nHrLoTamm68ysiEee/M5mAUFmXYEfmwsgtffPYS9oQcmwn1vg1Q5TaILqvCQc4mRd CuCLW9KbwKQwqCSffc1GTxIjqyyfyYTGKx9RoEcsrXknzlDS9OqnW9nTdiFk5xm7Y0mBD5 NBTNeddO8+zzE/t/OhwljkObp7rytBs= X-Stat-Signature: d18ygejqgn9f5jmqdqn5x4yq3aunrp6d X-Rspamd-Queue-Id: 5ABB7800A8 Authentication-Results: imf02.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b="Qej/4M5S"; spf=pass (imf02.hostedemail.com: domain of lkp@intel.com designates 192.55.52.136 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1663055996-278885 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: Hi Andrey, First bad commit (maybe != root cause): tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 044b771be9c5de9d817dfafb829d2f049c71c3b4 commit: 9d72007f43e209ca4de65acbb8e8e13568b6c0c9 [6573/6679] kasan: move tests to mm/kasan/ config: x86_64-buildonly-randconfig-r004-20220912 (https://download.01.org/0day-ci/archive/20220913/202209131555.dMFROX4C-lkp@intel.com/config) compiler: gcc-11 (Debian 11.3.0-5) 11.3.0 reproduce (this is a W=1 build): # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=9d72007f43e209ca4de65acbb8e8e13568b6c0c9 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout 9d72007f43e209ca4de65acbb8e8e13568b6c0c9 # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash mm/kasan/ If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot All warnings (new ones prefixed by >>): mm/kasan/kasan_test.c: In function 'krealloc_less_oob_helper.constprop': >> mm/kasan/kasan_test.c:335:59: warning: array subscript 201 is outside array bounds of 'char[201]' [-Warray-bounds] 335 | KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size2] = 'x'); | ~~~~~~~~~~~~^~~~~ mm/kasan/kasan_test.c:97:9: note: in definition of macro 'KUNIT_EXPECT_KASAN_FAIL' 97 | expression; \ | ^~~~~~~~~~ mm/kasan/kasan_test.c:327:16: note: referencing an object of size 201 allocated by 'krealloc' 327 | ptr2 = krealloc(ptr1, size2, GFP_KERNEL); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan_test.c:339:59: warning: array subscript 208 is outside array bounds of 'char[201]' [-Warray-bounds] 339 | ptr2[round_up(size2, KASAN_GRANULE_SIZE)] = 'x'); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ mm/kasan/kasan_test.c:97:9: note: in definition of macro 'KUNIT_EXPECT_KASAN_FAIL' 97 | expression; \ | ^~~~~~~~~~ mm/kasan/kasan_test.c:327:16: note: referencing an object of size 201 allocated by 'krealloc' 327 | ptr2 = krealloc(ptr1, size2, GFP_KERNEL); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan_test.c:349:52: warning: array subscript 218 is outside array bounds of 'char[201]' [-Warray-bounds] 349 | KUNIT_EXPECT_KASAN_FAIL(test, ptr2[middle] = 'x'); | ~~~~~~~~~~~~~^~~~~ mm/kasan/kasan_test.c:97:9: note: in definition of macro 'KUNIT_EXPECT_KASAN_FAIL' 97 | expression; \ | ^~~~~~~~~~ mm/kasan/kasan_test.c:327:16: note: referencing an object of size 201 allocated by 'krealloc' 327 | ptr2 = krealloc(ptr1, size2, GFP_KERNEL); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan_test.c:350:55: warning: array subscript 234 is outside array bounds of 'char[201]' [-Warray-bounds] 350 | KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size1 - 1] = 'x'); | ~~~~~~~~~~~~~~~~^~~~~ mm/kasan/kasan_test.c:97:9: note: in definition of macro 'KUNIT_EXPECT_KASAN_FAIL' 97 | expression; \ | ^~~~~~~~~~ mm/kasan/kasan_test.c:327:16: note: referencing an object of size 201 allocated by 'krealloc' 327 | ptr2 = krealloc(ptr1, size2, GFP_KERNEL); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan_test.c:351:51: warning: array subscript 235 is outside array bounds of 'char[201]' [-Warray-bounds] 351 | KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size1] = 'x'); | ~~~~~~~~~~~~^~~~~ mm/kasan/kasan_test.c:97:9: note: in definition of macro 'KUNIT_EXPECT_KASAN_FAIL' 97 | expression; \ | ^~~~~~~~~~ mm/kasan/kasan_test.c:327:16: note: referencing an object of size 201 allocated by 'krealloc' 327 | ptr2 = krealloc(ptr1, size2, GFP_KERNEL); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan_test.c: In function 'krealloc_more_oob_helper.constprop': mm/kasan/kasan_test.c:306:59: warning: array subscript 235 is outside array bounds of 'char[235]' [-Warray-bounds] 306 | KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size2] = 'x'); | ~~~~~~~~~~~~^~~~~ mm/kasan/kasan_test.c:97:9: note: in definition of macro 'KUNIT_EXPECT_KASAN_FAIL' 97 | expression; \ | ^~~~~~~~~~ mm/kasan/kasan_test.c:295:16: note: referencing an object of size 235 allocated by 'krealloc' 295 | ptr2 = krealloc(ptr1, size2, GFP_KERNEL); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan_test.c:310:59: warning: array subscript 240 is outside array bounds of 'char[235]' [-Warray-bounds] 310 | ptr2[round_up(size2, KASAN_GRANULE_SIZE)] = 'x'); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ mm/kasan/kasan_test.c:97:9: note: in definition of macro 'KUNIT_EXPECT_KASAN_FAIL' 97 | expression; \ | ^~~~~~~~~~ mm/kasan/kasan_test.c:295:16: note: referencing an object of size 235 allocated by 'krealloc' 295 | ptr2 = krealloc(ptr1, size2, GFP_KERNEL); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for PM_GENERIC_DOMAINS_OF Depends on [n]: PM_GENERIC_DOMAINS [=y] && OF [=n] Selected by [y]: - QCOM_RPMPD [=y] && PM [=y] && QCOM_SMD_RPM [=y] vim +335 mm/kasan/kasan_test.c 3f15801cdc2379 lib/test_kasan.c Andrey Ryabinin 2015-02-13 314 b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 315 static void krealloc_less_oob_helper(struct kunit *test, b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 316 size_t size1, size_t size2) 3f15801cdc2379 lib/test_kasan.c Andrey Ryabinin 2015-02-13 317 { 3f15801cdc2379 lib/test_kasan.c Andrey Ryabinin 2015-02-13 318 char *ptr1, *ptr2; b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 319 size_t middle; b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 320 b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 321 KUNIT_ASSERT_LT(test, size2, size1); b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 322 middle = size2 + (size1 - size2) / 2; 3f15801cdc2379 lib/test_kasan.c Andrey Ryabinin 2015-02-13 323 3f15801cdc2379 lib/test_kasan.c Andrey Ryabinin 2015-02-13 324 ptr1 = kmalloc(size1, GFP_KERNEL); 73228c7ecc5e40 lib/test_kasan.c Patricia Alfonso 2020-10-13 325 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1); f33a01492a24a2 lib/test_kasan.c Walter Wu 2020-08-06 326 73228c7ecc5e40 lib/test_kasan.c Patricia Alfonso 2020-10-13 327 ptr2 = krealloc(ptr1, size2, GFP_KERNEL); 73228c7ecc5e40 lib/test_kasan.c Patricia Alfonso 2020-10-13 328 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); f33a01492a24a2 lib/test_kasan.c Walter Wu 2020-08-06 329 b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 330 /* Must be accessible for all modes. */ b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 331 ptr2[size2 - 1] = 'x'; b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 332 b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 333 /* Generic mode is precise, so unaligned size2 must be inaccessible. */ b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 334 if (IS_ENABLED(CONFIG_KASAN_GENERIC)) b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 @335 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size2] = 'x'); b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 336 b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 337 /* For all modes first aligned offset after size2 must be inaccessible. */ b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 338 KUNIT_EXPECT_KASAN_FAIL(test, b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 339 ptr2[round_up(size2, KASAN_GRANULE_SIZE)] = 'x'); b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 340 b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 341 /* b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 342 * For all modes all size2, middle, and size1 should land in separate b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 343 * granules and thus the latter two offsets should be inaccessible. b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 344 */ b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 345 KUNIT_EXPECT_LE(test, round_up(size2, KASAN_GRANULE_SIZE), b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 346 round_down(middle, KASAN_GRANULE_SIZE)); b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 347 KUNIT_EXPECT_LE(test, round_up(middle, KASAN_GRANULE_SIZE), b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 348 round_down(size1, KASAN_GRANULE_SIZE)); b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 349 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[middle] = 'x'); b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 350 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size1 - 1] = 'x'); b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 351 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size1] = 'x'); b87c28b9a7ef64 lib/test_kasan.c Andrey Konovalov 2021-02-25 352 3f15801cdc2379 lib/test_kasan.c Andrey Ryabinin 2015-02-13 353 kfree(ptr2); 3f15801cdc2379 lib/test_kasan.c Andrey Ryabinin 2015-02-13 354 } 3f15801cdc2379 lib/test_kasan.c Andrey Ryabinin 2015-02-13 355 :::::: The code at line 335 was first introduced by commit :::::: b87c28b9a7ef64590943435ea59f40092f2376d5 kasan: rework krealloc tests :::::: TO: Andrey Konovalov :::::: CC: Linus Torvalds -- 0-DAY CI Kernel Test Service https://01.org/lkp