[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240104113412.7040-A-hca@linux.ibm.com>
Date: Thu, 4 Jan 2024 12:34:12 +0100
From: Heiko Carstens <hca@...ux.ibm.com>
To: Alexander Gordeev <agordeev@...ux.ibm.com>
Cc: Ilya Leoshkevich <iii@...ux.ibm.com>,
Alexander Potapenko <glider@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux.com>, David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>, Marco Elver <elver@...gle.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Pekka Enberg <penberg@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Vasily Gorbik <gor@...ux.ibm.com>, Vlastimil Babka <vbabka@...e.cz>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Hyeonggon Yoo <42.hyeyoo@...il.com>, kasan-dev@...glegroups.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-s390@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
Mark Rutland <mark.rutland@....com>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Sven Schnelle <svens@...ux.ibm.com>
Subject: Re: [PATCH v3 28/34] s390/mm: Define KMSAN metadata for vmalloc and
modules
On Thu, Jan 04, 2024 at 11:03:42AM +0100, Alexander Gordeev wrote:
> On Tue, Jan 02, 2024 at 04:05:31PM +0100, Heiko Carstens wrote:
> Hi Heiko,
> ...
> > > @@ -253,9 +253,17 @@ static unsigned long setup_kernel_memory_layout(void)
> > > MODULES_END = round_down(__abs_lowcore, _SEGMENT_SIZE);
> > > MODULES_VADDR = MODULES_END - MODULES_LEN;
> > > VMALLOC_END = MODULES_VADDR;
> > > +#ifdef CONFIG_KMSAN
> > > + VMALLOC_END -= MODULES_LEN * 2;
> > > +#endif
> > >
> > > /* allow vmalloc area to occupy up to about 1/2 of the rest virtual space left */
> > > vmalloc_size = min(vmalloc_size, round_down(VMALLOC_END / 2, _REGION3_SIZE));
> > > +#ifdef CONFIG_KMSAN
> > > + /* take 2/3 of vmalloc area for KMSAN shadow and origins */
> > > + vmalloc_size = round_down(vmalloc_size / 3, _REGION3_SIZE);
> > > + VMALLOC_END -= vmalloc_size * 2;
> > > +#endif
> >
> > Please use
> >
> > if (IS_ENABLED(CONFIG_KMSAN))
> >
> > above, since this way we get more compile time checks.
>
> This way we will get a mixture of CONFIG_KASAN and CONFIG_KMSAN
> #ifdef vs IS_ENABLED() checks within one function. I guess, we
> would rather address it with a separate cleanup?
I don't think so, since you can't convert the CONFIG_KASAN ifdef to
IS_ENABLED() here: it won't compile.
But IS_ENABLED(CONFIG_KMSAN) should work. I highly prefer IS_ENABLED() over
ifdef since it allows for better compile time checks, and you won't be
surprised by code that doesn't compile if you just change a config option.
We've seen that way too often.
Powered by blists - more mailing lists