[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a0WzntBkQiEK+nBrfUNw8TMyQwBQ=cQ+=3EeXLYNT+=iw@mail.gmail.com>
Date: Tue, 22 Mar 2022 10:00:00 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Huacai Chen <chenhuacai@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>, Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
David Airlie <airlied@...ux.ie>,
Jonathan Corbet <corbet@....net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-arch <linux-arch@...r.kernel.org>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Xuefeng Li <lixuefeng@...ngson.cn>,
Yanteng Si <siyanteng@...ngson.cn>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
Huacai Chen <chenhuacai@...ngson.cn>
Subject: Re: [PATCH V8 11/22] LoongArch: Add process management
On Tue, Mar 22, 2022 at 4:07 AM Huacai Chen <chenhuacai@...nel.org> wrote:
> On Mon, Mar 21, 2022 at 4:43 PM Arnd Bergmann <arnd@...db.de> wrote:
> > On Sat, Mar 19, 2022 at 3:38 PM Huacai Chen <chenhuacai@...nel.org> wrote:
> >
> > > +#ifdef CONFIG_PAGE_SIZE_64KB
> > > +#define THREAD_SIZE_ORDER (0)
> > > +#endif
> > > +
> > > +#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
> > > +#define THREAD_MASK (THREAD_SIZE - 1UL)
> > > +
> >
> > Having a 64KB stack area is rather wasteful. I think you should use a sub-page
> > allocation in this configuration, or possibly disallow 64KB page configuration
> > entirely.
> >
> > Note that you have to use full pages when using CONFIG_VMAP_STACK, but
> > you don't seem to support that at the moment, so allocating only 16KB stacks
> > on a 64KB page config should still work.
> I think using a 16KB stack for all configurations (4KB/16KB/64KB) is
> the simplest way. Right?
Yes, I agree. 16KB is what almost all 64-bit architectures use, though when
you add 32-bit support that can probably be limited to 8KB like most others.
As a side note, you should definitely consider supporting both separate
IRQ stacks and CONFIG_VMAP_STACK if you don't do that already.
Running with those two enabled makes the kernel more robust both
against accidental stack overflow and against malicious code that
attempts to abuse a potential overflow code path.
Arnd
Powered by blists - more mailing lists