|
Message-ID: <791fc70f7bcaf13a89abaee9aae52dfe@www.loen.fr> Date: Mon, 04 Nov 2019 14:22:19 +0109 From: Marc Zyngier <maz@...nel.org> To: Sami Tolvanen <samitolvanen@...gle.com> Cc: Will Deacon <will@...nel.org>, Catalin Marinas <catalin.marinas@....com>, Steven Rostedt <rostedt@...dmis.org>, Masami Hiramatsu <mhiramat@...nel.org>, Ard Biesheuvel <ard.biesheuvel@...aro.org>, Dave Martin <dave.martin@....com>, Kees Cook <keescook@...omium.org>, Laura Abbott <labbott@...hat.com>, Mark Rutland <mark.rutland@....com>, Nick Desaulniers <ndesaulniers@...gle.com>, Jann Horn <jannh@...gle.com>, Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, Masahiro Yamada <yamada.masahiro@...ionext.com>, <clang-built-linux@...glegroups.com>, <kernel-hardening@...ts.openwall.com>, <linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org> Subject: Re: [PATCH v4 06/17] scs: add accounting On 2019-11-01 23:21, Sami Tolvanen wrote: > This change adds accounting for the memory allocated for shadow > stacks. > > Signed-off-by: Sami Tolvanen <samitolvanen@...gle.com> > Reviewed-by: Kees Cook <keescook@...omium.org> > --- > drivers/base/node.c | 6 ++++++ > fs/proc/meminfo.c | 4 ++++ > include/linux/mmzone.h | 3 +++ > kernel/scs.c | 19 +++++++++++++++++++ > mm/page_alloc.c | 6 ++++++ > mm/vmstat.c | 3 +++ > 6 files changed, 41 insertions(+) > > diff --git a/drivers/base/node.c b/drivers/base/node.c > index 296546ffed6c..111e58ec231e 100644 > --- a/drivers/base/node.c > +++ b/drivers/base/node.c > @@ -415,6 +415,9 @@ static ssize_t node_read_meminfo(struct device > *dev, > "Node %d AnonPages: %8lu kB\n" > "Node %d Shmem: %8lu kB\n" > "Node %d KernelStack: %8lu kB\n" > +#ifdef CONFIG_SHADOW_CALL_STACK > + "Node %d ShadowCallStack:%8lu kB\n" > +#endif > "Node %d PageTables: %8lu kB\n" > "Node %d NFS_Unstable: %8lu kB\n" > "Node %d Bounce: %8lu kB\n" > @@ -438,6 +441,9 @@ static ssize_t node_read_meminfo(struct device > *dev, > nid, K(node_page_state(pgdat, NR_ANON_MAPPED)), > nid, K(i.sharedram), > nid, sum_zone_node_page_state(nid, NR_KERNEL_STACK_KB), > +#ifdef CONFIG_SHADOW_CALL_STACK > + nid, sum_zone_node_page_state(nid, NR_KERNEL_SCS_BYTES) / > 1024, > +#endif > nid, K(sum_zone_node_page_state(nid, NR_PAGETABLE)), > nid, K(node_page_state(pgdat, NR_UNSTABLE_NFS)), > nid, K(sum_zone_node_page_state(nid, NR_BOUNCE)), > diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c > index 8c1f1bb1a5ce..49768005a79e 100644 > --- a/fs/proc/meminfo.c > +++ b/fs/proc/meminfo.c > @@ -103,6 +103,10 @@ static int meminfo_proc_show(struct seq_file *m, > void *v) > show_val_kb(m, "SUnreclaim: ", sunreclaim); > seq_printf(m, "KernelStack: %8lu kB\n", > global_zone_page_state(NR_KERNEL_STACK_KB)); > +#ifdef CONFIG_SHADOW_CALL_STACK > + seq_printf(m, "ShadowCallStack:%8lu kB\n", > + global_zone_page_state(NR_KERNEL_SCS_BYTES) / 1024); > +#endif > show_val_kb(m, "PageTables: ", > global_zone_page_state(NR_PAGETABLE)); > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > index bda20282746b..fcb8c1708f9e 100644 > --- a/include/linux/mmzone.h > +++ b/include/linux/mmzone.h > @@ -200,6 +200,9 @@ enum zone_stat_item { > NR_MLOCK, /* mlock()ed pages found and moved off LRU */ > NR_PAGETABLE, /* used for pagetables */ > NR_KERNEL_STACK_KB, /* measured in KiB */ > +#if IS_ENABLED(CONFIG_SHADOW_CALL_STACK) Is there any reason why you're not consistently using only one of "#if IS_ENABLED(...)" or "#ifdef ...", but instead a mix of both? Thanks, M. -- Jazz is not dead. It just smells funny...
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.