|
|
Message-ID: <5fb044ec-cf1e-6281-01a9-c845b738914e@linux.com>
Date: Thu, 7 Dec 2017 10:09:27 +0300
From: Alexander Popov <alex.popov@...ux.com>
To: Laura Abbott <labbott@...hat.com>, kernel-hardening@...ts.openwall.com,
Kees Cook <keescook@...omium.org>, PaX Team <pageexec@...email.hu>,
Brad Spengler <spender@...ecurity.net>, Ingo Molnar <mingo@...nel.org>,
Andy Lutomirski <luto@...nel.org>, Tycho Andersen <tycho@...ho.ws>,
Mark Rutland <mark.rutland@....com>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>, Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>, "H . Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>, x86@...nel.org,
"Tobin C. Harding" <me@...in.cc>
Subject: Re: [PATCH RFC v6 5/6] fs/proc: Show STACKLEAK metrics in the /proc
file system
Hello Laura and Kees,
[adding Tobin C. Harding]
On 06.12.2017 22:22, Laura Abbott wrote:
> On 12/05/2017 03:33 PM, Alexander Popov wrote:
>> Introduce CONFIG_STACKLEAK_METRICS providing STACKLEAK information about
>> tasks via the /proc file system. In particular, /proc/<pid>/lowest_stack
>> shows the current lowest_stack value and its final value from the previous
>> syscall. That information can be useful for estimating the STACKLEAK
>> performance impact for different workloads.
>>
>> Signed-off-by: Alexander Popov <alex.popov@...ux.com>
>> ---
>> arch/Kconfig | 11 +++++++++++
>> arch/x86/entry/entry_32.S | 4 ++++
>> arch/x86/entry/entry_64.S | 4 ++++
>> arch/x86/include/asm/processor.h | 3 +++
>> arch/x86/kernel/asm-offsets.c | 3 +++
>> arch/x86/kernel/process_32.c | 3 +++
>> arch/x86/kernel/process_64.c | 3 +++
>> fs/proc/base.c | 14 ++++++++++++++
>> 8 files changed, 45 insertions(+)
[...]
>> +#ifdef CONFIG_STACKLEAK_METRICS
>> +static int proc_lowest_stack(struct seq_file *m, struct pid_namespace *ns,
>> + struct pid *pid, struct task_struct *task)
>> +{
>> + seq_printf(m, "prev_lowest_stack: %pK\nlowest_stack: %pK\n",
>> + (void *)task->thread.prev_lowest_stack,
>> + (void *)task->thread.lowest_stack);
>> + return 0;
>> +}
>> +#endif /* CONFIG_STACKLEAK_METRICS */
>> +
>
> This just prints the hashed value with the new pointer leak work.
> I don't think we want to print the fully exposed value via %px so
> it's not clear how valuable this proc file is now.
Yes, I tested that before sending the patch. I was confused when I saw the
hashed values. But setting kptr_restrict to 1 fixed that for me:
root@...bit:~# cat /proc/2627/lowest_stack
prev_lowest_stack: 00000000ed8ca991
lowest_stack: 0000000040579d76
root@...bit:~# echo 1 > /proc/sys/kernel/kptr_restrict
root@...bit:~# cat /proc/2627/lowest_stack
prev_lowest_stack: ffffc9000094fdb8
lowest_stack: ffffc9000094f9e0
However, Documentation/printk-formats.txt and Documentation/sysctl/kernel.txt
don't specify that behaviour.
Best regards,
Alexander
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.