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]
Date:   Mon, 4 Mar 2019 10:14:34 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     kernel test robot <lkp@...el.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Shuah Khan <shuah@...nel.org>,
        Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
        Andy Lutomirski <luto@...capital.net>,
        Ingo Molnar <mingo@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Changbin Du <changbin.du@...il.com>,
        Jann Horn <jannh@...gle.com>,
        Kees Cook <keescook@...omium.org>,
        Andy Lutomirski <luto@...nel.org>,
        Alexei Starovoitov <alexei.starovoitov@...il.com>,
        Nadav Amit <namit@...are.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Joel Fernandes <joel@...lfernandes.org>, yhs@...com, lkp@...org
Subject: Re: [uaccess] 780464aed0:
 WARNING:at_arch/x86/include/asm/uaccess.h:#strnlen_user/0x

On Sun, 3 Mar 2019 11:53:58 -0800
Linus Torvalds <torvalds@...ux-foundation.org> wrote:

> On Sun, Mar 3, 2019 at 9:40 AM kernel test robot <lkp@...el.com> wrote:
> >
> > commit: 780464aed08ad00aa6d5f81ac8bef2e714dc8b06 ("[PATCH v5 2/6] uaccess: Use user_access_ok() in user_access_begin()")
> 
> Hmm. Not an upstream commit ID, so this is presumably a backport.
> 
> Ok, let's see what it is using the web link:
> 
> > url: https://github.com/0day-ci/linux/commits/Masami-Hiramatsu/tracing-probes-uaccess-Add-support-user-space-access/20190303-203749
> 
> Yeah, that just gives a github 404 error.
> 
> I'm _assuming_ it's the WARN_ON_IN_IRQ() in the access_ok().

I think it comes from WARN_ON_ONCE(!segment_eq(get_fs(), USER_DS)) in 
user_access_ok(). The call trace shows that strndup_user might be called
from kernel daemon context.

[    4.003505] Call Trace:
[    4.003505]  strndup_user+0x14/0x60
[    4.003505]  ksys_mount+0x30/0xd0
[    4.003505]  ? handle_create+0x1f0/0x1f0
[    4.003505]  devtmpfsd+0x9c/0x190

I guess devtmpfsd has not set USER_DS. Hmm, in that case, how ksys_*()
parameters should be treated? Those APIs will take __user pointers, but
actually, in-kernel callers call ksys_*() with non __user variables.

For example,

static int devtmpfsd(void *p)
{
        char options[] = "mode=0755";
        int *err = p;
        *err = ksys_unshare(CLONE_NEWNS);
        if (*err)
                goto out;
        *err = ksys_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, options);
        if (*err)
...

__force __user casting doesn't help, because these parameters are in kernel
memory, not in user memory. I think if we forcibly set USER_DS, it should
fail on some arch.

Peter, I think we can remove that WARN_ON_ONCE() from user_access_ok(),
since user_access_begin() is not only actually start accessing user, but it
also accessing kernel memory.

> Which doesn't much make sense either (why wouldn't it happen in
> mainline)? But without a useful web link to see what is actually being
> tested, I guess it's not something I can even look at...


Yeah, we need working web link on the report...

Thank you,


-- 
Masami Hiramatsu <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ