Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2295016imb; Mon, 4 Mar 2019 01:08:12 -0800 (PST) X-Google-Smtp-Source: APXvYqwEbbAFKjZCh891Ic72WPB5zjJeFWsDyBwAA3iR2ITevf1ue+s1bGySb/4Bm2NUu/OBJex8 X-Received: by 2002:a65:60c7:: with SMTP id r7mr18095441pgv.37.1551690492305; Mon, 04 Mar 2019 01:08:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551690492; cv=none; d=google.com; s=arc-20160816; b=UHZUEbEUXSCnVTR7bvXj8KWaTzkApZQrBw2ucECvzxstGcoz2LZzzvkfZPkKson782 LGJjMdu2OVPTQoX2x3h+Wbc8+drZAAKkVmrPxS4wBIiHrxAzdIJDBRWzlYCHOaT5E72I kAdKGtAWFDGSWalJfu2kVgA2/ZiQkTP7GylgAC52aglKmP314lyPaZEp+SfxPwaQZPIq 9nq9k5CluV4lJVHsXqYIBgzps4/dY8yHy5gCWWcIxnNOgEch86WhZcxbqRS0KMLt7mb4 v5omyK8eK7Tc9O1vAO7auABT6gg6Uug1JvJXcheme3zVs1v1M7WcIyLQgHX4s7Ikcila B9Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=wDKPRgqeCkxXAj6YjjhU4DC1FSkOTJsF40pRZ9GOq+o=; b=F3REkE5WutzHZapzKsxO8wLE+GXPxgRAKJI5HE4KV3vRh6rmiLhdIStWdlsrqDeOR3 lcf2zDWOa3z3sEBBLYX3Ixqd9H/Drur0u2odE65Osi9Y9hUACx43CBbCXlI702P+dYf4 /m/grIFYr6oatnW+OsCXE3HReRp/89+yHKzyJmBD/EilMYNQ2YbFj5I1rNcIkXr0gecc yURzhs8vpC5qEq869DVjTwuuuuAI2KFh9bLLMdDlBCFO+feMmIdzdvA1NTR9xZnkJqHS VNZprcTOGRJ64/iVfJ5qs1a3RAbG6uN5lFKgmzy8cgLlfTY60N/+ZQQp2d5ZOpD5sZwB PHRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PD6FntkM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 38si5156220plc.288.2019.03.04.01.07.56; Mon, 04 Mar 2019 01:08:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PD6FntkM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726173AbfCDJGP (ORCPT + 99 others); Mon, 4 Mar 2019 04:06:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:44260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726029AbfCDJGP (ORCPT ); Mon, 4 Mar 2019 04:06:15 -0500 Received: from devnote (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 13D1A20836; Mon, 4 Mar 2019 09:06:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551690374; bh=JJvivajtjja0EDGoey38hjXrjmXuoDlx4g1FbbwUiVE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PD6FntkMDi+/lbtFT4d01gAq/xYG+AprVLrYlp+R2AYYd5GXtrQIKWBsyDcjmONKf gzxay9TfWvfao4o3sGZDCtHsqebCXM0UJxwp19wc/cE4vd5V/wP4fMRpOxDNHXGY6b CibLC6Q3g9L0ArjcQObOjHXjhhhFWjFgziAlEGz0= Date: Mon, 4 Mar 2019 18:06:10 +0900 From: Masami Hiramatsu To: Linus Torvalds Cc: kernel test robot , Steven Rostedt , Shuah Khan , Linux List Kernel Mailing , Andy Lutomirski , Ingo Molnar , Andrew Morton , Changbin Du , Jann Horn , Kees Cook , Andy Lutomirski , Alexei Starovoitov , Nadav Amit , Peter Zijlstra , Joel Fernandes , yhs@fb.com, lkp@01.org Subject: Re: [uaccess] 780464aed0: WARNING:at_arch/x86/include/asm/uaccess.h:#strnlen_user/0x Message-Id: <20190304180610.2d4f6f08d9ad89d6abae3597@kernel.org> In-Reply-To: References: <155136980507.2968.15165201054223875356.stgit@devbox> <20190303173954.kliegojbuigqi5tn@inn2.lkp.intel.com> <20190304101434.8429ffffb17813c0e7930130@kernel.org> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.30; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 3 Mar 2019 18:37:59 -0800 Linus Torvalds wrote: > On Sun, Mar 3, 2019 at 5:14 PM Masami Hiramatsu wrote: > > > > 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. > > Ahh, yes. > > We've had this before. We've gotten rid of the actual "use system > calls", but we still have some of the init sequence in particular just > calling the wrappers instead. Are those safe if we are in init sequence? > > And yes, ksys_mount() takes __user pointers. > > It would be a lot better to use "do_mount()", which is the interface > that takes actual "char *" pointers. Unfortunately, it still takes a __user pointer. long do_mount(const char *dev_name, const char __user *dir_name, const char *type_page, unsigned long flags, void *data_page) So what we need is long do_mount(const char *dev_name, struct path *dir_path, const char *type_page, unsigned long flags, void *data_page) or introduce kern_do_mount()? Since devtmpfsd calls ksys_chdir() and ksys_chroot(), we need to replace those too. Fortunately, it seems that the last part which we have to fix. Thank you, > > Linus -- Masami Hiramatsu