All of lore.kernel.org
 help / color / mirror / Atom feed
* [kees:for-next/lkdtm 11/12] drivers/misc/lkdtm/fortify.c:28 lkdtm_FORTIFIED_OBJECT() error: memcmp() '&target[1]' too small (10 vs 11)
@ 2021-06-30 23:05 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-06-30 23:05 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 2474 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Kees Cook <keescook@chromium.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/lkdtm
head:   6774078fd3d20a29c0c60b8d507c99c65a57e451
commit: aa6195344df910c48627795856bae05387272857 [11/12] lkdtm/fortify: Consolidate FORTIFY_SOURCE tests
:::::: branch date: 25 hours ago
:::::: commit date: 25 hours ago
config: microblaze-randconfig-m031-20210628 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/misc/lkdtm/fortify.c:28 lkdtm_FORTIFIED_OBJECT() error: memcmp() '&target[1]' too small (10 vs 11)

vim +28 drivers/misc/lkdtm/fortify.c

aa6195344df910 Kees Cook 2021-06-29  12  
aa6195344df910 Kees Cook 2021-06-29  13  void lkdtm_FORTIFIED_OBJECT(void)
aa6195344df910 Kees Cook 2021-06-29  14  {
aa6195344df910 Kees Cook 2021-06-29  15  	struct target {
aa6195344df910 Kees Cook 2021-06-29  16  		char a[10];
aa6195344df910 Kees Cook 2021-06-29  17  	} target[2] = {};
aa6195344df910 Kees Cook 2021-06-29  18  	/*
aa6195344df910 Kees Cook 2021-06-29  19  	 * Using volatile prevents the compiler from determining the value of
aa6195344df910 Kees Cook 2021-06-29  20  	 * 'size' at compile time. Without that, we would get a compile error
aa6195344df910 Kees Cook 2021-06-29  21  	 * rather than a runtime error.
aa6195344df910 Kees Cook 2021-06-29  22  	 */
aa6195344df910 Kees Cook 2021-06-29  23  	volatile int size = 11;
aa6195344df910 Kees Cook 2021-06-29  24  
aa6195344df910 Kees Cook 2021-06-29  25  	pr_info("trying to read past the end of a struct\n");
aa6195344df910 Kees Cook 2021-06-29  26  
aa6195344df910 Kees Cook 2021-06-29  27  	/* Store result to global to prevent the code from being eliminated */
aa6195344df910 Kees Cook 2021-06-29 @28  	fortify_scratch_space = memcmp(&target[0], &target[1], size);
aa6195344df910 Kees Cook 2021-06-29  29  
aa6195344df910 Kees Cook 2021-06-29  30  	pr_err("FAIL: fortify did not block an object overread!\n");
aa6195344df910 Kees Cook 2021-06-29  31  	pr_expected_config(CONFIG_FORTIFY_SOURCE);
aa6195344df910 Kees Cook 2021-06-29  32  }
aa6195344df910 Kees Cook 2021-06-29  33  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31832 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-30 23:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30 23:05 [kees:for-next/lkdtm 11/12] drivers/misc/lkdtm/fortify.c:28 lkdtm_FORTIFIED_OBJECT() error: memcmp() '&target[1]' too small (10 vs 11) kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.