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  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]
Date:   Thu, 23 Sep 2021 16:49:17 -0700
From:   Vito Caputo <vcaputo@...garu.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Vito Caputo <vcaputo@...garu.com>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>, Jens Axboe <axboe@...nel.dk>,
        Mark Rutland <mark.rutland@....com>,
        Peter Zijlstra <peterz@...radead.org>,
        Stefan Metzmacher <metze@...ba.org>,
        Andy Lutomirski <luto@...nel.org>,
        Lai Jiangshan <laijs@...ux.alibaba.com>,
        Christian Brauner <christian.brauner@...ntu.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "Kenta.Tada@...y.com" <Kenta.Tada@...y.com>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Michael WeiƟ <michael.weiss@...ec.fraunhofer.de>,
        Anand K Mistry <amistry@...gle.com>,
        Alexey Gladkov <legion@...nel.org>,
        Michal Hocko <mhocko@...e.com>, Helge Deller <deller@....de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Andrea Righi <andrea.righi@...onical.com>,
        Ohhoon Kwon <ohoono.kwon@...sung.com>,
        Kalesh Singh <kaleshsingh@...gle.com>,
        YiFei Zhu <yifeifz2@...inois.edu>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        linux-kernel@...r.kernel.org, x86@...nel.org,
        linux-fsdevel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] proc: Disable /proc/$pid/wchan

On Thu, Sep 23, 2021 at 04:31:05PM -0700, Kees Cook wrote:
> The /proc/$pid/wchan file has been broken by default on x86_64 for 4
> years now[1]. As this remains a potential leak of either kernel
> addresses (when symbolization fails) or limited observation of kernel
> function progress, just remove the contents for good.
> 
> Unconditionally set the contents to "0" and also mark the wchan
> field in /proc/$pid/stat with 0.
> 
> This leaves kernel/sched/fair.c as the only user of get_wchan(). But
> again, since this was broken for 4 years, was this profiling logic
> actually doing anything useful?
> 
> [1] https://lore.kernel.org/lkml/20210922001537.4ktg3r2ky3b3r6yp@treble/
> 
> Cc: Josh Poimboeuf <jpoimboe@...hat.com>
> Cc: Vito Caputo <vcaputo@...garu.com>
> Signed-off-by: Kees Cook <keescook@...omium.org>
<snip>


Please don't deliberately break WCHANs wholesale.  This is a very
useful tool for sysadmins to get a vague sense of where processes are
spending time in the kernel on production systems without affecting
performance or having to restart things under instrumentation.

I don't see how providing the symbol name of a given task's kernel
function, especially if shallow near the user->kernel entrypoint, is a
worrisome information leak.  Just make sure it's not failing open with
addresses like my original report documented seems to happen
spuriously as-is w/kallsyms.

When I worked full-time as a sysadmin WCHAN's were regularly the first
thing to look at in `ps -o stat,wchan | grep D` when things were
falling over.  e.g.:

```
root@...lls:/root# ps -o stat,wchan | grep D
D    io_schedule
```

Furthermore this is a well documented on dead trees and understood
*nix/posix system observation technique.  Even the POSIX ps(1) man
page documents it:

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html

Frankly I'm a bit mortified that I have to write this email.

Today I'm hoping to test Josh's patch @
https://lore.kernel.org/all/20210831083625.59554-1-zhengqi.arch@bytedance.com/

Thanks,
Vito Caputo

Powered by blists - more mailing lists