lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202205061914.zGa4ozYg-lkp@intel.com>
Date:   Fri, 6 May 2022 19:45:44 +0800
From:   kernel test robot <lkp@...el.com>
To:     Paran Lee <p4ranlee@...il.com>,
        Christoph Lameter <cl@...ux-foundation.org>,
        Pekka Enberg <penberg@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Vlastimil Babka <vbabka@...e.cz>,
        Roman Gushchin <roman.gushchin@...ux.dev>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        Linux Memory Management List <linux-mm@...ck.org>,
        linux-kernel@...r.kernel.org, linux-mm@...r.kernel.org,
        Oliver Glitta <glittao@...il.com>,
        Austin Kim <austindh.kim@...il.com>
Subject: Re: [PATCH] slub: kunit catch kmem_cache_alloc failed

Hi Paran,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.18-rc5 next-20220506]
[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]

url:    https://github.com/intel-lab-lkp/linux/commits/Paran-Lee/slub-kunit-catch-kmem_cache_alloc-failed/20220506-125540
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git fe27d189e3f42e31d3c8223d5daed7285e334c5e
config: hexagon-randconfig-r014-20220505 (https://download.01.org/0day-ci/archive/20220506/202205061914.zGa4ozYg-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5e004fb787698440a387750db7f8028e7cb14cfc)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/4827e156a14ba66c648125c98967c96178ca024d
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Paran-Lee/slub-kunit-catch-kmem_cache_alloc-failed/20220506-125540
        git checkout 4827e156a14ba66c648125c98967c96178ca024d
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash lib/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> lib/slub_kunit.c:40:16: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement]
           unsigned long tmp;
                         ^
   1 warning generated.


vim +40 lib/slub_kunit.c

1f9f78b1b376f8 Oliver Glitta 2021-06-28  28  
1f9f78b1b376f8 Oliver Glitta 2021-06-28  29  #ifndef CONFIG_KASAN
1f9f78b1b376f8 Oliver Glitta 2021-06-28  30  static void test_next_pointer(struct kunit *test)
1f9f78b1b376f8 Oliver Glitta 2021-06-28  31  {
1f9f78b1b376f8 Oliver Glitta 2021-06-28  32  	struct kmem_cache *s = kmem_cache_create("TestSlub_next_ptr_free", 64, 0,
1f9f78b1b376f8 Oliver Glitta 2021-06-28  33  				SLAB_POISON, NULL);
1f9f78b1b376f8 Oliver Glitta 2021-06-28  34  	u8 *p = kmem_cache_alloc(s, GFP_KERNEL);
4827e156a14ba6 Paran Lee     2022-05-06  35  	if (!p) {
4827e156a14ba6 Paran Lee     2022-05-06  36  		kunit_err(test, "Allocation failed: %s\n", __func__);
4827e156a14ba6 Paran Lee     2022-05-06  37  		kmem_cache_destroy(s);
4827e156a14ba6 Paran Lee     2022-05-06  38  		return;
4827e156a14ba6 Paran Lee     2022-05-06  39  	}
1f9f78b1b376f8 Oliver Glitta 2021-06-28 @40  	unsigned long tmp;
1f9f78b1b376f8 Oliver Glitta 2021-06-28  41  	unsigned long *ptr_addr;
1f9f78b1b376f8 Oliver Glitta 2021-06-28  42  
1f9f78b1b376f8 Oliver Glitta 2021-06-28  43  	kmem_cache_free(s, p);
1f9f78b1b376f8 Oliver Glitta 2021-06-28  44  
1f9f78b1b376f8 Oliver Glitta 2021-06-28  45  	ptr_addr = (unsigned long *)(p + s->offset);
1f9f78b1b376f8 Oliver Glitta 2021-06-28  46  	tmp = *ptr_addr;
1f9f78b1b376f8 Oliver Glitta 2021-06-28  47  	p[s->offset] = 0x12;
1f9f78b1b376f8 Oliver Glitta 2021-06-28  48  
1f9f78b1b376f8 Oliver Glitta 2021-06-28  49  	/*
1f9f78b1b376f8 Oliver Glitta 2021-06-28  50  	 * Expecting three errors.
1f9f78b1b376f8 Oliver Glitta 2021-06-28  51  	 * One for the corrupted freechain and the other one for the wrong
1f9f78b1b376f8 Oliver Glitta 2021-06-28  52  	 * count of objects in use. The third error is fixing broken cache.
1f9f78b1b376f8 Oliver Glitta 2021-06-28  53  	 */
1f9f78b1b376f8 Oliver Glitta 2021-06-28  54  	validate_slab_cache(s);
1f9f78b1b376f8 Oliver Glitta 2021-06-28  55  	KUNIT_EXPECT_EQ(test, 3, slab_errors);
1f9f78b1b376f8 Oliver Glitta 2021-06-28  56  
1f9f78b1b376f8 Oliver Glitta 2021-06-28  57  	/*
1f9f78b1b376f8 Oliver Glitta 2021-06-28  58  	 * Try to repair corrupted freepointer.
1f9f78b1b376f8 Oliver Glitta 2021-06-28  59  	 * Still expecting two errors. The first for the wrong count
1f9f78b1b376f8 Oliver Glitta 2021-06-28  60  	 * of objects in use.
1f9f78b1b376f8 Oliver Glitta 2021-06-28  61  	 * The second error is for fixing broken cache.
1f9f78b1b376f8 Oliver Glitta 2021-06-28  62  	 */
1f9f78b1b376f8 Oliver Glitta 2021-06-28  63  	*ptr_addr = tmp;
1f9f78b1b376f8 Oliver Glitta 2021-06-28  64  	slab_errors = 0;
1f9f78b1b376f8 Oliver Glitta 2021-06-28  65  
1f9f78b1b376f8 Oliver Glitta 2021-06-28  66  	validate_slab_cache(s);
1f9f78b1b376f8 Oliver Glitta 2021-06-28  67  	KUNIT_EXPECT_EQ(test, 2, slab_errors);
1f9f78b1b376f8 Oliver Glitta 2021-06-28  68  
1f9f78b1b376f8 Oliver Glitta 2021-06-28  69  	/*
1f9f78b1b376f8 Oliver Glitta 2021-06-28  70  	 * Previous validation repaired the count of objects in use.
1f9f78b1b376f8 Oliver Glitta 2021-06-28  71  	 * Now expecting no error.
1f9f78b1b376f8 Oliver Glitta 2021-06-28  72  	 */
1f9f78b1b376f8 Oliver Glitta 2021-06-28  73  	slab_errors = 0;
1f9f78b1b376f8 Oliver Glitta 2021-06-28  74  	validate_slab_cache(s);
1f9f78b1b376f8 Oliver Glitta 2021-06-28  75  	KUNIT_EXPECT_EQ(test, 0, slab_errors);
1f9f78b1b376f8 Oliver Glitta 2021-06-28  76  
1f9f78b1b376f8 Oliver Glitta 2021-06-28  77  	kmem_cache_destroy(s);
1f9f78b1b376f8 Oliver Glitta 2021-06-28  78  }
1f9f78b1b376f8 Oliver Glitta 2021-06-28  79  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ