[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DF4PR84MB00896C65CECA9D8B7EC6179EF45D0@DF4PR84MB0089.NAMPRD84.PROD.OUTLOOK.COM>
Date: Tue, 7 Jun 2016 18:10:53 +0000
From: "Luruo, Kuthonuzo" <kuthonuzo.luruo@....com>
To: Alexander Potapenko <glider@...gle.com>
CC: Andrey Ryabinin <aryabinin@...tuozzo.com>,
Dmitriy Vyukov <dvyukov@...gle.com>,
Christoph Lameter <cl@...ux.com>,
"penberg@...nel.org" <penberg@...nel.org>,
"rientjes@...gle.com" <rientjes@...gle.com>,
"Joonsoo Kim" <iamjoonsoo.kim@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
kasan-dev <kasan-dev@...glegroups.com>,
LKML <linux-kernel@...r.kernel.org>,
"ynorov@...iumnetworks.com" <ynorov@...iumnetworks.com>
Subject: RE: [PATCH v4 2/2] kasan: add double-free tests
> > + int cpu, cnt = num_online_cpus();
> > + cpumask_t mask = { CPU_BITS_NONE };
> > + size_t size = 4097; /* must be <= KMALLOC_MAX_CACHE_SIZE/2 */
> Can you please explicitly calculate |size| from KMALLOC_MAX_CACHE_SIZE?
> > +
> > + if (cnt == 1)
> > + return;
> > + cnt = cnt < MAX_THREADS ? cnt : MAX_THREADS;
> > + pr_info("concurrent double-free (%d threads)\n", cnt);
> > + p = kmalloc(size, GFP_KERNEL);
> > + if (!p)
> > + return;
> > + for_each_online_cpu(cpu) {
> > + cpumask_set_cpu(cpu, &mask);
> > + if (!--cnt)
> > + break;
> > + }
> > + on_each_cpu_mask(&mask, try_free, p, 0);
> > +}
> > +
> > +static noinline void __init kasan_double_free(void)
> > +{
> > + char *p;
> > + size_t size = 2049;
> Please avoid using magic constants.
Alexander,
Thanks very much for the review. I've changed alloc size for both to 100
in v5.
Kuthonuzo
Powered by blists - more mailing lists