All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v2 1/2] kunit: add a KUnit test for SLUB debugging functionality
Date: Wed, 31 Mar 2021 07:34:32 +0300	[thread overview]
Message-ID: <20210331043432.GF2065@kadam> (raw)
In-Reply-To: <20210330120436.4591-1-glittao@gmail.com>

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

Hi,

url:    https://github.com/0day-ci/linux/commits/glittao-gmail-com/kunit-add-a-KUnit-test-for-SLUB-debugging-functionality/20210330-200635
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1e43c377a79f9189fea8f2711b399d4e8b4e609b
config: i386-randconfig-m021-20210330 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 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:
mm/slub.c:744 object_err() warn: should this be a bitwise op?
mm/slub.c:759 slab_err() warn: should this be a bitwise op?
mm/slub.c:807 check_bytes_and_report() warn: should this be a bitwise op?

vim +744 mm/slub.c

75c66def8d8152 Andrey Ryabinin   2015-02-13  741  void object_err(struct kmem_cache *s, struct page *page,
81819f0fc8285a Christoph Lameter 2007-05-06  742  			u8 *object, char *reason)
81819f0fc8285a Christoph Lameter 2007-05-06  743  {
98f544695d3d3b Oliver Glitta     2021-03-30 @744  	if (!(s->flags && SLAB_SILENT_ERRORS)) {
                                                                       ^^
& was intended instead of &&

3dc5063786b273 Christoph Lameter 2008-04-23  745  		slab_bug(s, "%s", reason);
2492268472e7d3 Christoph Lameter 2007-07-17  746  		print_trailer(s, page, object);
81819f0fc8285a Christoph Lameter 2007-05-06  747  	}
98f544695d3d3b Oliver Glitta     2021-03-30  748  }
81819f0fc8285a Christoph Lameter 2007-05-06  749  
a38965bf941b7c Mathieu Malaterre 2018-06-07  750  static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page,
d0e0ac9772f8ec Chen Gang         2013-07-15  751  			const char *fmt, ...)
81819f0fc8285a Christoph Lameter 2007-05-06  752  {
81819f0fc8285a Christoph Lameter 2007-05-06  753  	va_list args;
81819f0fc8285a Christoph Lameter 2007-05-06  754  	char buf[100];
81819f0fc8285a Christoph Lameter 2007-05-06  755  
2492268472e7d3 Christoph Lameter 2007-07-17  756  	va_start(args, fmt);
2492268472e7d3 Christoph Lameter 2007-07-17  757  	vsnprintf(buf, sizeof(buf), fmt, args);
81819f0fc8285a Christoph Lameter 2007-05-06  758  	va_end(args);
98f544695d3d3b Oliver Glitta     2021-03-30 @759  	if (!(s->flags && SLAB_SILENT_ERRORS)) {
                                                                       ^^^^^^^^^^^^^^^^^^^^^

3dc5063786b273 Christoph Lameter 2008-04-23  760  		slab_bug(s, "%s", buf);
2492268472e7d3 Christoph Lameter 2007-07-17  761  		print_page_info(page);
81819f0fc8285a Christoph Lameter 2007-05-06  762  		dump_stack();
81819f0fc8285a Christoph Lameter 2007-05-06  763  	}
98f544695d3d3b Oliver Glitta     2021-03-30  764  }
81819f0fc8285a Christoph Lameter 2007-05-06  765  
f7cb1933621bce Christoph Lameter 2010-09-29  766  static void init_object(struct kmem_cache *s, void *object, u8 val)
81819f0fc8285a Christoph Lameter 2007-05-06  767  {
aa1ef4d7b3f67f Andrey Konovalov  2020-12-22  768  	u8 *p = kasan_reset_tag(object);
81819f0fc8285a Christoph Lameter 2007-05-06  769  
d86bd1bece6fc4 Joonsoo Kim       2016-03-15  770  	if (s->flags & SLAB_RED_ZONE)
d86bd1bece6fc4 Joonsoo Kim       2016-03-15  771  		memset(p - s->red_left_pad, val, s->red_left_pad);
d86bd1bece6fc4 Joonsoo Kim       2016-03-15  772  
81819f0fc8285a Christoph Lameter 2007-05-06  773  	if (s->flags & __OBJECT_POISON) {
3b0efdfa1e7193 Christoph Lameter 2012-06-13  774  		memset(p, POISON_FREE, s->object_size - 1);
3b0efdfa1e7193 Christoph Lameter 2012-06-13  775  		p[s->object_size - 1] = POISON_END;
81819f0fc8285a Christoph Lameter 2007-05-06  776  	}
81819f0fc8285a Christoph Lameter 2007-05-06  777  
81819f0fc8285a Christoph Lameter 2007-05-06  778  	if (s->flags & SLAB_RED_ZONE)
3b0efdfa1e7193 Christoph Lameter 2012-06-13  779  		memset(p + s->object_size, val, s->inuse - s->object_size);
81819f0fc8285a Christoph Lameter 2007-05-06  780  }
81819f0fc8285a Christoph Lameter 2007-05-06  781  
2492268472e7d3 Christoph Lameter 2007-07-17  782  static void restore_bytes(struct kmem_cache *s, char *message, u8 data,
2492268472e7d3 Christoph Lameter 2007-07-17  783  						void *from, void *to)
2492268472e7d3 Christoph Lameter 2007-07-17  784  {
2492268472e7d3 Christoph Lameter 2007-07-17  785  	slab_fix(s, "Restoring 0x%p-0x%p=0x%x\n", from, to - 1, data);
2492268472e7d3 Christoph Lameter 2007-07-17  786  	memset(from, data, to - from);
2492268472e7d3 Christoph Lameter 2007-07-17  787  }
2492268472e7d3 Christoph Lameter 2007-07-17  788  
2492268472e7d3 Christoph Lameter 2007-07-17  789  static int check_bytes_and_report(struct kmem_cache *s, struct page *page,
2492268472e7d3 Christoph Lameter 2007-07-17  790  			u8 *object, char *what,
2492268472e7d3 Christoph Lameter 2007-07-17  791  			u8 *start, unsigned int value, unsigned int bytes)
2492268472e7d3 Christoph Lameter 2007-07-17  792  {
2492268472e7d3 Christoph Lameter 2007-07-17  793  	u8 *fault;
2492268472e7d3 Christoph Lameter 2007-07-17  794  	u8 *end;
e1b70dd1e6429f Miles Chen        2019-11-30  795  	u8 *addr = page_address(page);
2492268472e7d3 Christoph Lameter 2007-07-17  796  
a79316c6178ca4 Andrey Ryabinin   2015-02-13  797  	metadata_access_enable();
aa1ef4d7b3f67f Andrey Konovalov  2020-12-22  798  	fault = memchr_inv(kasan_reset_tag(start), value, bytes);
a79316c6178ca4 Andrey Ryabinin   2015-02-13  799  	metadata_access_disable();
2492268472e7d3 Christoph Lameter 2007-07-17  800  	if (!fault)
81819f0fc8285a Christoph Lameter 2007-05-06  801  		return 1;
2492268472e7d3 Christoph Lameter 2007-07-17  802  
2492268472e7d3 Christoph Lameter 2007-07-17  803  	end = start + bytes;
2492268472e7d3 Christoph Lameter 2007-07-17  804  	while (end > fault && end[-1] == value)
2492268472e7d3 Christoph Lameter 2007-07-17  805  		end--;
2492268472e7d3 Christoph Lameter 2007-07-17  806  
98f544695d3d3b Oliver Glitta     2021-03-30 @807  	if (!(s->flags && SLAB_SILENT_ERRORS)) {
                                                                       ^^^^^^^^^^^^^^^^^^^^^

2492268472e7d3 Christoph Lameter 2007-07-17  808  		slab_bug(s, "%s overwritten", what);
e1b70dd1e6429f Miles Chen        2019-11-30  809  		pr_err("INFO: 0x%p-0x%p @offset=%tu. First byte 0x%x instead of 0x%x\n",
e1b70dd1e6429f Miles Chen        2019-11-30  810  					fault, end - 1, fault - addr,
e1b70dd1e6429f Miles Chen        2019-11-30  811  					fault[0], value);
2492268472e7d3 Christoph Lameter 2007-07-17  812  		print_trailer(s, page, object);
98f544695d3d3b Oliver Glitta     2021-03-30  813  	}
2492268472e7d3 Christoph Lameter 2007-07-17  814  
2492268472e7d3 Christoph Lameter 2007-07-17  815  	restore_bytes(s, what, value, fault, end);
2492268472e7d3 Christoph Lameter 2007-07-17  816  	return 0;
81819f0fc8285a Christoph Lameter 2007-05-06  817  }

---
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: 32479 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v2 1/2] kunit: add a KUnit test for SLUB debugging functionality
Date: Wed, 31 Mar 2021 07:34:32 +0300	[thread overview]
Message-ID: <20210331043432.GF2065@kadam> (raw)
In-Reply-To: <20210330120436.4591-1-glittao@gmail.com>

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

Hi,

url:    https://github.com/0day-ci/linux/commits/glittao-gmail-com/kunit-add-a-KUnit-test-for-SLUB-debugging-functionality/20210330-200635
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1e43c377a79f9189fea8f2711b399d4e8b4e609b
config: i386-randconfig-m021-20210330 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 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:
mm/slub.c:744 object_err() warn: should this be a bitwise op?
mm/slub.c:759 slab_err() warn: should this be a bitwise op?
mm/slub.c:807 check_bytes_and_report() warn: should this be a bitwise op?

vim +744 mm/slub.c

75c66def8d8152 Andrey Ryabinin   2015-02-13  741  void object_err(struct kmem_cache *s, struct page *page,
81819f0fc8285a Christoph Lameter 2007-05-06  742  			u8 *object, char *reason)
81819f0fc8285a Christoph Lameter 2007-05-06  743  {
98f544695d3d3b Oliver Glitta     2021-03-30 @744  	if (!(s->flags && SLAB_SILENT_ERRORS)) {
                                                                       ^^
& was intended instead of &&

3dc5063786b273 Christoph Lameter 2008-04-23  745  		slab_bug(s, "%s", reason);
2492268472e7d3 Christoph Lameter 2007-07-17  746  		print_trailer(s, page, object);
81819f0fc8285a Christoph Lameter 2007-05-06  747  	}
98f544695d3d3b Oliver Glitta     2021-03-30  748  }
81819f0fc8285a Christoph Lameter 2007-05-06  749  
a38965bf941b7c Mathieu Malaterre 2018-06-07  750  static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page,
d0e0ac9772f8ec Chen Gang         2013-07-15  751  			const char *fmt, ...)
81819f0fc8285a Christoph Lameter 2007-05-06  752  {
81819f0fc8285a Christoph Lameter 2007-05-06  753  	va_list args;
81819f0fc8285a Christoph Lameter 2007-05-06  754  	char buf[100];
81819f0fc8285a Christoph Lameter 2007-05-06  755  
2492268472e7d3 Christoph Lameter 2007-07-17  756  	va_start(args, fmt);
2492268472e7d3 Christoph Lameter 2007-07-17  757  	vsnprintf(buf, sizeof(buf), fmt, args);
81819f0fc8285a Christoph Lameter 2007-05-06  758  	va_end(args);
98f544695d3d3b Oliver Glitta     2021-03-30 @759  	if (!(s->flags && SLAB_SILENT_ERRORS)) {
                                                                       ^^^^^^^^^^^^^^^^^^^^^

3dc5063786b273 Christoph Lameter 2008-04-23  760  		slab_bug(s, "%s", buf);
2492268472e7d3 Christoph Lameter 2007-07-17  761  		print_page_info(page);
81819f0fc8285a Christoph Lameter 2007-05-06  762  		dump_stack();
81819f0fc8285a Christoph Lameter 2007-05-06  763  	}
98f544695d3d3b Oliver Glitta     2021-03-30  764  }
81819f0fc8285a Christoph Lameter 2007-05-06  765  
f7cb1933621bce Christoph Lameter 2010-09-29  766  static void init_object(struct kmem_cache *s, void *object, u8 val)
81819f0fc8285a Christoph Lameter 2007-05-06  767  {
aa1ef4d7b3f67f Andrey Konovalov  2020-12-22  768  	u8 *p = kasan_reset_tag(object);
81819f0fc8285a Christoph Lameter 2007-05-06  769  
d86bd1bece6fc4 Joonsoo Kim       2016-03-15  770  	if (s->flags & SLAB_RED_ZONE)
d86bd1bece6fc4 Joonsoo Kim       2016-03-15  771  		memset(p - s->red_left_pad, val, s->red_left_pad);
d86bd1bece6fc4 Joonsoo Kim       2016-03-15  772  
81819f0fc8285a Christoph Lameter 2007-05-06  773  	if (s->flags & __OBJECT_POISON) {
3b0efdfa1e7193 Christoph Lameter 2012-06-13  774  		memset(p, POISON_FREE, s->object_size - 1);
3b0efdfa1e7193 Christoph Lameter 2012-06-13  775  		p[s->object_size - 1] = POISON_END;
81819f0fc8285a Christoph Lameter 2007-05-06  776  	}
81819f0fc8285a Christoph Lameter 2007-05-06  777  
81819f0fc8285a Christoph Lameter 2007-05-06  778  	if (s->flags & SLAB_RED_ZONE)
3b0efdfa1e7193 Christoph Lameter 2012-06-13  779  		memset(p + s->object_size, val, s->inuse - s->object_size);
81819f0fc8285a Christoph Lameter 2007-05-06  780  }
81819f0fc8285a Christoph Lameter 2007-05-06  781  
2492268472e7d3 Christoph Lameter 2007-07-17  782  static void restore_bytes(struct kmem_cache *s, char *message, u8 data,
2492268472e7d3 Christoph Lameter 2007-07-17  783  						void *from, void *to)
2492268472e7d3 Christoph Lameter 2007-07-17  784  {
2492268472e7d3 Christoph Lameter 2007-07-17  785  	slab_fix(s, "Restoring 0x%p-0x%p=0x%x\n", from, to - 1, data);
2492268472e7d3 Christoph Lameter 2007-07-17  786  	memset(from, data, to - from);
2492268472e7d3 Christoph Lameter 2007-07-17  787  }
2492268472e7d3 Christoph Lameter 2007-07-17  788  
2492268472e7d3 Christoph Lameter 2007-07-17  789  static int check_bytes_and_report(struct kmem_cache *s, struct page *page,
2492268472e7d3 Christoph Lameter 2007-07-17  790  			u8 *object, char *what,
2492268472e7d3 Christoph Lameter 2007-07-17  791  			u8 *start, unsigned int value, unsigned int bytes)
2492268472e7d3 Christoph Lameter 2007-07-17  792  {
2492268472e7d3 Christoph Lameter 2007-07-17  793  	u8 *fault;
2492268472e7d3 Christoph Lameter 2007-07-17  794  	u8 *end;
e1b70dd1e6429f Miles Chen        2019-11-30  795  	u8 *addr = page_address(page);
2492268472e7d3 Christoph Lameter 2007-07-17  796  
a79316c6178ca4 Andrey Ryabinin   2015-02-13  797  	metadata_access_enable();
aa1ef4d7b3f67f Andrey Konovalov  2020-12-22  798  	fault = memchr_inv(kasan_reset_tag(start), value, bytes);
a79316c6178ca4 Andrey Ryabinin   2015-02-13  799  	metadata_access_disable();
2492268472e7d3 Christoph Lameter 2007-07-17  800  	if (!fault)
81819f0fc8285a Christoph Lameter 2007-05-06  801  		return 1;
2492268472e7d3 Christoph Lameter 2007-07-17  802  
2492268472e7d3 Christoph Lameter 2007-07-17  803  	end = start + bytes;
2492268472e7d3 Christoph Lameter 2007-07-17  804  	while (end > fault && end[-1] == value)
2492268472e7d3 Christoph Lameter 2007-07-17  805  		end--;
2492268472e7d3 Christoph Lameter 2007-07-17  806  
98f544695d3d3b Oliver Glitta     2021-03-30 @807  	if (!(s->flags && SLAB_SILENT_ERRORS)) {
                                                                       ^^^^^^^^^^^^^^^^^^^^^

2492268472e7d3 Christoph Lameter 2007-07-17  808  		slab_bug(s, "%s overwritten", what);
e1b70dd1e6429f Miles Chen        2019-11-30  809  		pr_err("INFO: 0x%p-0x%p @offset=%tu. First byte 0x%x instead of 0x%x\n",
e1b70dd1e6429f Miles Chen        2019-11-30  810  					fault, end - 1, fault - addr,
e1b70dd1e6429f Miles Chen        2019-11-30  811  					fault[0], value);
2492268472e7d3 Christoph Lameter 2007-07-17  812  		print_trailer(s, page, object);
98f544695d3d3b Oliver Glitta     2021-03-30  813  	}
2492268472e7d3 Christoph Lameter 2007-07-17  814  
2492268472e7d3 Christoph Lameter 2007-07-17  815  	restore_bytes(s, what, value, fault, end);
2492268472e7d3 Christoph Lameter 2007-07-17  816  	return 0;
81819f0fc8285a Christoph Lameter 2007-05-06  817  }

---
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: 32479 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, glittao@gmail.com, cl@linux.com,
	penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com,
	akpm@linux-foundation.org, vbabka@suse.cz
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Oliver Glitta <glittao@gmail.com>
Subject: Re: [PATCH v2 1/2] kunit: add a KUnit test for SLUB debugging functionality
Date: Wed, 31 Mar 2021 07:34:32 +0300	[thread overview]
Message-ID: <20210331043432.GF2065@kadam> (raw)
In-Reply-To: <20210330120436.4591-1-glittao@gmail.com>

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

Hi,

url:    https://github.com/0day-ci/linux/commits/glittao-gmail-com/kunit-add-a-KUnit-test-for-SLUB-debugging-functionality/20210330-200635
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1e43c377a79f9189fea8f2711b399d4e8b4e609b
config: i386-randconfig-m021-20210330 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 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:
mm/slub.c:744 object_err() warn: should this be a bitwise op?
mm/slub.c:759 slab_err() warn: should this be a bitwise op?
mm/slub.c:807 check_bytes_and_report() warn: should this be a bitwise op?

vim +744 mm/slub.c

75c66def8d8152 Andrey Ryabinin   2015-02-13  741  void object_err(struct kmem_cache *s, struct page *page,
81819f0fc8285a Christoph Lameter 2007-05-06  742  			u8 *object, char *reason)
81819f0fc8285a Christoph Lameter 2007-05-06  743  {
98f544695d3d3b Oliver Glitta     2021-03-30 @744  	if (!(s->flags && SLAB_SILENT_ERRORS)) {
                                                                       ^^
& was intended instead of &&

3dc5063786b273 Christoph Lameter 2008-04-23  745  		slab_bug(s, "%s", reason);
2492268472e7d3 Christoph Lameter 2007-07-17  746  		print_trailer(s, page, object);
81819f0fc8285a Christoph Lameter 2007-05-06  747  	}
98f544695d3d3b Oliver Glitta     2021-03-30  748  }
81819f0fc8285a Christoph Lameter 2007-05-06  749  
a38965bf941b7c Mathieu Malaterre 2018-06-07  750  static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page,
d0e0ac9772f8ec Chen Gang         2013-07-15  751  			const char *fmt, ...)
81819f0fc8285a Christoph Lameter 2007-05-06  752  {
81819f0fc8285a Christoph Lameter 2007-05-06  753  	va_list args;
81819f0fc8285a Christoph Lameter 2007-05-06  754  	char buf[100];
81819f0fc8285a Christoph Lameter 2007-05-06  755  
2492268472e7d3 Christoph Lameter 2007-07-17  756  	va_start(args, fmt);
2492268472e7d3 Christoph Lameter 2007-07-17  757  	vsnprintf(buf, sizeof(buf), fmt, args);
81819f0fc8285a Christoph Lameter 2007-05-06  758  	va_end(args);
98f544695d3d3b Oliver Glitta     2021-03-30 @759  	if (!(s->flags && SLAB_SILENT_ERRORS)) {
                                                                       ^^^^^^^^^^^^^^^^^^^^^

3dc5063786b273 Christoph Lameter 2008-04-23  760  		slab_bug(s, "%s", buf);
2492268472e7d3 Christoph Lameter 2007-07-17  761  		print_page_info(page);
81819f0fc8285a Christoph Lameter 2007-05-06  762  		dump_stack();
81819f0fc8285a Christoph Lameter 2007-05-06  763  	}
98f544695d3d3b Oliver Glitta     2021-03-30  764  }
81819f0fc8285a Christoph Lameter 2007-05-06  765  
f7cb1933621bce Christoph Lameter 2010-09-29  766  static void init_object(struct kmem_cache *s, void *object, u8 val)
81819f0fc8285a Christoph Lameter 2007-05-06  767  {
aa1ef4d7b3f67f Andrey Konovalov  2020-12-22  768  	u8 *p = kasan_reset_tag(object);
81819f0fc8285a Christoph Lameter 2007-05-06  769  
d86bd1bece6fc4 Joonsoo Kim       2016-03-15  770  	if (s->flags & SLAB_RED_ZONE)
d86bd1bece6fc4 Joonsoo Kim       2016-03-15  771  		memset(p - s->red_left_pad, val, s->red_left_pad);
d86bd1bece6fc4 Joonsoo Kim       2016-03-15  772  
81819f0fc8285a Christoph Lameter 2007-05-06  773  	if (s->flags & __OBJECT_POISON) {
3b0efdfa1e7193 Christoph Lameter 2012-06-13  774  		memset(p, POISON_FREE, s->object_size - 1);
3b0efdfa1e7193 Christoph Lameter 2012-06-13  775  		p[s->object_size - 1] = POISON_END;
81819f0fc8285a Christoph Lameter 2007-05-06  776  	}
81819f0fc8285a Christoph Lameter 2007-05-06  777  
81819f0fc8285a Christoph Lameter 2007-05-06  778  	if (s->flags & SLAB_RED_ZONE)
3b0efdfa1e7193 Christoph Lameter 2012-06-13  779  		memset(p + s->object_size, val, s->inuse - s->object_size);
81819f0fc8285a Christoph Lameter 2007-05-06  780  }
81819f0fc8285a Christoph Lameter 2007-05-06  781  
2492268472e7d3 Christoph Lameter 2007-07-17  782  static void restore_bytes(struct kmem_cache *s, char *message, u8 data,
2492268472e7d3 Christoph Lameter 2007-07-17  783  						void *from, void *to)
2492268472e7d3 Christoph Lameter 2007-07-17  784  {
2492268472e7d3 Christoph Lameter 2007-07-17  785  	slab_fix(s, "Restoring 0x%p-0x%p=0x%x\n", from, to - 1, data);
2492268472e7d3 Christoph Lameter 2007-07-17  786  	memset(from, data, to - from);
2492268472e7d3 Christoph Lameter 2007-07-17  787  }
2492268472e7d3 Christoph Lameter 2007-07-17  788  
2492268472e7d3 Christoph Lameter 2007-07-17  789  static int check_bytes_and_report(struct kmem_cache *s, struct page *page,
2492268472e7d3 Christoph Lameter 2007-07-17  790  			u8 *object, char *what,
2492268472e7d3 Christoph Lameter 2007-07-17  791  			u8 *start, unsigned int value, unsigned int bytes)
2492268472e7d3 Christoph Lameter 2007-07-17  792  {
2492268472e7d3 Christoph Lameter 2007-07-17  793  	u8 *fault;
2492268472e7d3 Christoph Lameter 2007-07-17  794  	u8 *end;
e1b70dd1e6429f Miles Chen        2019-11-30  795  	u8 *addr = page_address(page);
2492268472e7d3 Christoph Lameter 2007-07-17  796  
a79316c6178ca4 Andrey Ryabinin   2015-02-13  797  	metadata_access_enable();
aa1ef4d7b3f67f Andrey Konovalov  2020-12-22  798  	fault = memchr_inv(kasan_reset_tag(start), value, bytes);
a79316c6178ca4 Andrey Ryabinin   2015-02-13  799  	metadata_access_disable();
2492268472e7d3 Christoph Lameter 2007-07-17  800  	if (!fault)
81819f0fc8285a Christoph Lameter 2007-05-06  801  		return 1;
2492268472e7d3 Christoph Lameter 2007-07-17  802  
2492268472e7d3 Christoph Lameter 2007-07-17  803  	end = start + bytes;
2492268472e7d3 Christoph Lameter 2007-07-17  804  	while (end > fault && end[-1] == value)
2492268472e7d3 Christoph Lameter 2007-07-17  805  		end--;
2492268472e7d3 Christoph Lameter 2007-07-17  806  
98f544695d3d3b Oliver Glitta     2021-03-30 @807  	if (!(s->flags && SLAB_SILENT_ERRORS)) {
                                                                       ^^^^^^^^^^^^^^^^^^^^^

2492268472e7d3 Christoph Lameter 2007-07-17  808  		slab_bug(s, "%s overwritten", what);
e1b70dd1e6429f Miles Chen        2019-11-30  809  		pr_err("INFO: 0x%p-0x%p @offset=%tu. First byte 0x%x instead of 0x%x\n",
e1b70dd1e6429f Miles Chen        2019-11-30  810  					fault, end - 1, fault - addr,
e1b70dd1e6429f Miles Chen        2019-11-30  811  					fault[0], value);
2492268472e7d3 Christoph Lameter 2007-07-17  812  		print_trailer(s, page, object);
98f544695d3d3b Oliver Glitta     2021-03-30  813  	}
2492268472e7d3 Christoph Lameter 2007-07-17  814  
2492268472e7d3 Christoph Lameter 2007-07-17  815  	restore_bytes(s, what, value, fault, end);
2492268472e7d3 Christoph Lameter 2007-07-17  816  	return 0;
81819f0fc8285a Christoph Lameter 2007-05-06  817  }

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

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

  parent reply	other threads:[~2021-03-31  4:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 12:04 [PATCH v2 1/2] kunit: add a KUnit test for SLUB debugging functionality glittao
2021-03-30 12:04 ` [PATCH v2 2/2] slub: remove resiliency_test() function glittao
2021-03-30 16:22 ` [PATCH v2 1/2] kunit: add a KUnit test for SLUB debugging functionality kernel test robot
2021-03-30 16:22   ` kernel test robot
2021-03-31  4:34 ` Dan Carpenter [this message]
2021-03-31  4:34   ` Dan Carpenter
2021-03-31  4:34   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2021-03-30 21:42 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210331043432.GF2065@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.