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: <4f77c04b-5fe3-4618-aaaf-7bcc6058591e@infradead.org>
Date: Mon, 11 Mar 2024 12:32:09 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: Pasha Tatashin <pasha.tatashin@...een.com>, linux-kernel@...r.kernel.org,
 linux-mm@...ck.org, akpm@...ux-foundation.org, x86@...nel.org, bp@...en8.de,
 brauner@...nel.org, bristot@...hat.com, bsegall@...gle.com,
 dave.hansen@...ux.intel.com, dianders@...omium.org,
 dietmar.eggemann@....com, eric.devolder@...cle.com, hca@...ux.ibm.com,
 hch@...radead.org, hpa@...or.com, jacob.jun.pan@...ux.intel.com,
 jgg@...pe.ca, jpoimboe@...nel.org, jroedel@...e.de, juri.lelli@...hat.com,
 kent.overstreet@...ux.dev, kinseyho@...gle.com,
 kirill.shutemov@...ux.intel.com, lstoakes@...il.com, luto@...nel.org,
 mgorman@...e.de, mic@...ikod.net, michael.christie@...cle.com,
 mingo@...hat.com, mjguzik@...il.com, mst@...hat.com, npiggin@...il.com,
 peterz@...radead.org, pmladek@...e.com, rick.p.edgecombe@...el.com,
 rostedt@...dmis.org, surenb@...gle.com, tglx@...utronix.de,
 urezki@...il.com, vincent.guittot@...aro.org, vschneid@...hat.com
Subject: Re: [RFC 10/14] fork: Dynamic Kernel Stacks

Hi,

just typos etc.

On 3/11/24 09:46, Pasha Tatashin wrote:
> The core implementation of dynamic kernel stacks.
> 

..

> 
> Signed-off-by: Pasha Tatashin <pasha.tatashin@...een.com>
> ---
>  arch/Kconfig                     |  34 +++++
>  include/linux/sched.h            |   2 +-
>  include/linux/sched/task_stack.h |  41 +++++-
>  kernel/fork.c                    | 239 +++++++++++++++++++++++++++++++
>  kernel/sched/core.c              |   1 +
>  5 files changed, 315 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/Kconfig b/arch/Kconfig
> index a5af0edd3eb8..da3df347b069 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -1241,6 +1241,40 @@ config VMAP_STACK
>  	  backing virtual mappings with real shadow memory, and KASAN_VMALLOC
>  	  must be enabled.
>  
> +config HAVE_ARCH_DYNAMIC_STACK
> +	def_bool n
> +	help
> +	  An arch should select this symbol if it can support kernel stacks
> +	  dynamic growth.
> +
> +	  - Arch must have support for HAVE_ARCH_VMAP_STACK, in order to handle
> +	    stack related page faults

	    stack-related

> +
> +	  - Arch must be able to faults from interrupt context.

	                         fault

> +	  - Arch must allows the kernel to handle stack faults gracefully, even

	              allow

> +	    during interrupt handling.
> +
> +	  - Exceptions such as no pages available should be handled the same

	                                                    handled in the same

> +	    in the consitent and predictable way. I.e. the exception should be

	    consistent

> +	    handled the same as when stack overflow occurs when guard pages are
> +	    touched with extra information about the allocation error.
> +
> +config DYNAMIC_STACK
> +	default y
> +	bool "Dynamically grow kernel stacks"
> +	depends on THREAD_INFO_IN_TASK
> +	depends on HAVE_ARCH_DYNAMIC_STACK
> +	depends on VMAP_STACK
> +	depends on !KASAN
> +	depends on !DEBUG_STACK_USAGE
> +	depends on !STACK_GROWSUP
> +	help
> +	  Dynamic kernel stacks allow to save memory on machines with a lot of
> +	  threads by starting with small stacks, and grow them only when needed.
> +	  On workloads where most of the stack depth do not reach over one page

	                                             does

> +	  the memory saving can be subsentantial. The feature requires virtually

	                           substantial.

> +	  mapped kernel stacks in order to handle page faults.
> +
>  config HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
>  	def_bool n
>  	help



> +/*
> + * This flag is used to pass information from fault handler to refill about
> + * which pages were allocated, and should be charged to memcg.
> + */
> +#define DYNAMIC_STACK_PAGE_AQUIRED_FLAG	0x1

                              ACQUIRED
please



-- 
#Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ