Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1237258
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan |
| Date | 2015-10-01 12:40 +0200 |
| Message-ID | <qeJrk-1qD-19@gated-at.bofh.it> (permalink) |
| References | (5 earlier) <qex6O-aB-5@gated-at.bofh.it> <qeGWu-5Xc-21@gated-at.bofh.it> <qeHSy-7yF-5@gated-at.bofh.it> <qeIlA-8lU-13@gated-at.bofh.it> <qeJ7Y-13Z-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
* Andrey Ryabinin <ryabinin.a.a@gmail.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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] arch/x86: fix out-of-bounds in get_wchan() Dmitry Vyukov <dvyukov@google.com> - 2015-09-28 11:10 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Borislav Petkov <bp@alien8.de> - 2015-09-28 11:40 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Dmitry Vyukov <dvyukov@google.com> - 2015-09-28 11:50 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Borislav Petkov <bp@alien8.de> - 2015-09-28 12:30 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Dmitry Vyukov <dvyukov@google.com> - 2015-09-28 12:40 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Borislav Petkov <bp@alien8.de> - 2015-09-28 13:00 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Dmitry Vyukov <dvyukov@google.com> - 2015-09-28 12:00 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Borislav Petkov <bp@alien8.de> - 2015-09-28 12:40 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2015-09-28 17:50 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Dmitry Vyukov <dvyukov@google.com> - 2015-09-28 18:10 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Thomas Gleixner <tglx@linutronix.de> - 2015-09-28 18:40 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Andy Lutomirski <luto@amacapital.net> - 2015-09-29 20:20 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Andy Lutomirski <luto@amacapital.net> - 2015-09-29 20:40 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Borislav Petkov <bp@alien8.de> - 2015-09-29 20:50 +0200
[PATCH] fs/proc: Don't expose absolute kernel addresses via wchan Ingo Molnar <mingo@kernel.org> - 2015-09-30 09:20 +0200
Re: [PATCH] fs/proc: Don't expose absolute kernel addresses via wchan Thomas Gleixner <tglx@linutronix.de> - 2015-09-30 09:40 +0200
[PATCH v2] fs/proc: Don't expose absolute kernel addresses via wchan Ingo Molnar <mingo@kernel.org> - 2015-09-30 16:00 +0200
Re: [PATCH v2] fs/proc: Don't expose absolute kernel addresses via wchan Thomas Gleixner <tglx@linutronix.de> - 2015-09-30 22:40 +0200
Re: [PATCH v2] fs/proc: Don't expose absolute kernel addresses via wchan Kees Cook <keescook@chromium.org> - 2015-09-30 23:30 +0200
Re: [PATCH v2] fs/proc: Don't expose absolute kernel addresses via wchan Thomas Gleixner <tglx@linutronix.de> - 2015-09-30 23:40 +0200
[PATCH v3] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Ingo Molnar <mingo@kernel.org> - 2015-10-01 10:00 +0200
Re: [PATCH v3] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2015-10-01 11:00 +0200
Re: [PATCH v3] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Ingo Molnar <mingo@kernel.org> - 2015-10-01 11:30 +0200
Re: [PATCH v3] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2015-10-01 12:20 +0200
Re: [PATCH v3] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Ingo Molnar <mingo@kernel.org> - 2015-10-01 12:40 +0200
Re: [PATCH v3] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2015-10-01 12:50 +0200
[PATCH v5] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Ingo Molnar <mingo@kernel.org> - 2015-10-01 13:00 +0200
[PATCH v4] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Ingo Molnar <mingo@kernel.org> - 2015-10-01 11:40 +0200
[tip:core/debug] fs/proc, core/debug: Don' t expose absolute kernel addresses via wchan tip-bot for Ingo Molnar <tipbot@zytor.com> - 2015-10-01 15:00 +0200
Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan() Thomas Gleixner <tglx@linutronix.de> - 2015-09-30 10:10 +0200
csiph-web