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: <20151001103913.GA11812@gmail.com>
Date:	Thu, 1 Oct 2015 12:39:14 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Andrey Ryabinin <ryabinin.a.a@...il.com>
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


* Andrey Ryabinin <ryabinin.a.a@...il.com> wrote:

> I think you misunderstood me.
> Yes, this code currently doesn't use %pX, but it could:
> 
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index b25eee4..f58f66e 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -425,18 +425,7 @@ static int proc_pid_auxv(struct seq_file *m, struct pid_namespace *ns,
>  static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
>                           struct pid *pid, struct task_struct *task)
>  {
> -       unsigned long wchan;
> -       char symname[KSYM_NAME_LEN];
> -
> -       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 {
> -               seq_printf(m, "%s", symname);
> -       }
> +       seq_printf(m, "%ps", get_wchan(task));
>  
>         return 0;
>  }
> 
> 
> There is a problem here, though. %ps will print absolute kernel address instead of symbol name
> if KALLSYMS=n or if resolution of address failed.
> So I was wondering, may be should just fix %ps ?
> i.e. print 0 instead of absolute address if KALLSYMS=n or lookup failure?

There's another problem as well: your change loses the PTRACE_MODE_READ permission 
check.

But ... I think I like it open coded, which is good precisely because it will stay 
invariant even if we change details in the %ps/etc. debug output.

Thanks,

	Ingo
--
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