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: <CAPAsAGyR8EqT5riJmRPQF-Zh8+POyjYCi4skVDmmexL5oYiexQ@mail.gmail.com>
Date:	Thu, 1 Oct 2015 11:57:28 +0300
From:	Andrey Ryabinin <ryabinin.a.a@...il.com>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	Kees Cook <keescook@...omium.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Andy Lutomirski <luto@...capital.net>,
	Dmitry Vyukov <dvyukov@...gle.com>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andy Lutomirski <luto@...nel.org>,
	Borislav Petkov <bp@...en8.de>,
	Denys Vlasenko <dvlasenk@...hat.com>,
	"x86@...nel.org" <x86@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Kostya Serebryany <kcc@...gle.com>,
	Alexander Potapenko <glider@...gle.com>,
	Andrey Konovalov <andreyknvl@...gle.com>,
	Sasha Levin <sasha.levin@...cle.com>,
	Andi Kleen <ak@...ux.intel.com>,
	kasan-dev <kasan-dev@...glegroups.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH v3] fs/proc, core/debug: Don't expose absolute kernel
 addresses via wchan

2015-10-01 10:57 GMT+03:00 Ingo Molnar <mingo@...nel.org>:
> diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
> index d411ca63c8b6..db64f7d6492d 100644
> --- a/Documentation/filesystems/proc.txt
> +++ b/Documentation/filesystems/proc.txt
> @@ -140,7 +140,8 @@ Table 1-1: Process specific entries in /proc
>   stat          Process status
>   statm         Process memory status information
>   status                Process status in human readable form
> - wchan         If CONFIG_KALLSYMS is set, a pre-decoded wchan
> + wchan         If CONFIG_KALLSYMS=y, wchan (the kernel function the process is
> +               blocked in) symbol string. "0" if not blocked or !KALLSYMS.

/proc/PID/wchan is under #ifdef CONFIG_KALLSYMS.


> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index b25eee4cead5..6f05aabce3aa 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -430,13 +430,10 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
>
>         wchan = get_wchan(task);
>
> -       if (lookup_symbol_name(wchan, symname) < 0) {
> -               if (!ptrace_may_access(task, PTRACE_MODE_READ))
> -                       return 0;
> -               seq_printf(m, "%lu", wchan);
> -       } else {
> +       if (!lookup_symbol_name(wchan, symname))
>                 seq_printf(m, "%s", symname);
> -       }
> +       else
> +               seq_putc(m, '0');

Maybe we should respect 'kptr_restrict' sysctl when we use '%ps', '%pB' etc.
printk formats (AFAIK %ps just prints address if KALLSYMS=n, or lookup failed).
In that case you could just do 'seq_printf(m, "%ps", wchan)'.


OTOH, %ps, %pS are used mostly in debugging, so investigating some crash
in production kernel with no !KALLSYMS and with kptr_restrict != 0
will be a nightmare.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ