Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3372947imb; Tue, 5 Mar 2019 07:49:13 -0800 (PST) X-Google-Smtp-Source: APXvYqxOlzX7ivC6k6mNc/ufb1KpwCLB5GZAjB01BhIKRZ5B6htvtIuY3jpYslbxRNrphz33Lyo9 X-Received: by 2002:a17:902:ea8c:: with SMTP id cv12mr1791400plb.123.1551800953306; Tue, 05 Mar 2019 07:49:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551800953; cv=none; d=google.com; s=arc-20160816; b=p4v+PJfnaseT6KPyen5apkiXmlnXivt2sBIaoRuscpF45Hq8zZKlglRkbiqcaQYIKt IKzM6PZthLys41G7E55X5/GGyy/KtG5znDY/3iCIT6LnvZxhQtMzauyyXm4pplKBR/lp SwpzFlSFe1i/P2cxJkGgdMvqkKPKMy4nUOmvlE4iLuhpu9HGt7TuAdFzY6riR6RMvSwq Raj3A50q4SLKaBqxrA24UEIavigNwgVj4OOjeEgs9nHyp9Mxoxw64CnBo5L+C4Fjtpxm Z7QLu5jNVbl8YTfXtEIcWWHGeNbNbpLMTUfzZ+M4jIi+bCexm1dGh1JINH16yjgmyEfN 2OCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=CmAIyH+dAiiqoSUSc0kf2M2hNfWk2Q0D9uVzdk9oRNg=; b=ZOeZg2kFGBITAirEK0uMcNUvBui+AQXlL9QFRHZ3wVBuVOucneHRQbqgUAVGFK5fvt Ni8ZitaNPONb+SBB0XNabqYiXzKbZXH4hVKsRBtH8UgNG09ZTnVLcpLi1j7pPnFPHsz4 ztowtA+GJ3qO0yHB0nlEVarzbYrX7UrHk26vV4spTuKVENKshQNHbAUxh4nZxAMMQq0G HmCIqdTBVAeh4MToqMn+QG+xQ0n0UvqQOlJDWjrxbePZP2INJsECjlKrRZ9j8Zq1SBpW dAJEo3OOuXobZN8jmr6F1OqEQjRx6au4R8nOiCfFWBDy9FCPzm6/f8BvyDZmmwAAyIMC lDmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ow9VBWH8; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i186si7863030pge.120.2019.03.05.07.48.56; Tue, 05 Mar 2019 07:49:13 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ow9VBWH8; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727729AbfCEOxk (ORCPT + 99 others); Tue, 5 Mar 2019 09:53:40 -0500 Received: from merlin.infradead.org ([205.233.59.134]:32830 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726250AbfCEOxj (ORCPT ); Tue, 5 Mar 2019 09:53:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=CmAIyH+dAiiqoSUSc0kf2M2hNfWk2Q0D9uVzdk9oRNg=; b=ow9VBWH8Yz9vW4jkNKTkmEDkC 3pGeTCxjp6qSQ5Co5PBJR5tA72XqWlJk+NNz8fcU5K7qmiQJSOAveB4zW3Ngnbqt5VXP14eJAtFsl 8F+l4UfDE+JvMYi68bv51oWv2Qt/rXqvCYLAzSDiGmec25t2KpWLBrxuE/CbtHqH/gC02xTThKu6z R3fN4FCtyPReNnG3+inI9TC0BYR8I7HuNzbGG9yAM/IeNXExXuyHVUiAn7emXl1UGdZi8QybCcLEr NpJ8XXt/rr2cCh3OUFtbnSkinTZAH5tB8z3y+D3AlgAL9kTMczWm0SzBjA2ic51AT2B3w+GF9RMxl 9c6HfcD+w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1BRM-0007Bb-RN; Tue, 05 Mar 2019 14:53:09 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7FDD920288BA2; Tue, 5 Mar 2019 15:53:06 +0100 (CET) Date: Tue, 5 Mar 2019 15:53:06 +0100 From: Peter Zijlstra To: Masami Hiramatsu , g@hirez.programming.kicks-ass.net Cc: Linus Torvalds , 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 , 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: <20190305145306.GL32477@hirez.programming.kicks-ass.net> References: <155136980507.2968.15165201054223875356.stgit@devbox> <20190303173954.kliegojbuigqi5tn@inn2.lkp.intel.com> <20190304101434.8429ffffb17813c0e7930130@kernel.org> <20190304180610.2d4f6f08d9ad89d6abae3597@kernel.org> <20190305113635.18f80ea3b1f4fca54b9d21e4@kernel.org> <20190305090729.GF32477@hirez.programming.kicks-ass.net> <20190305225801.a63ac8712105ab2e673be1bc@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190305225801.a63ac8712105ab2e673be1bc@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 05, 2019 at 10:58:01PM +0900, Masami Hiramatsu wrote: > Could you tell me why WARN_ON_ONCE(!in_task()) is needed in access_ok()? That came from here: lkml.kernel.org/r/20190225145240.GB32534@hirez.programming.kicks-ass.net Because in-irq usage is dodgy, since we don't actually know what mm or ds it loaded. > > I dislike that whole KERNEL_DS thing, but obviously that's not something > > that's going away. > > > > Would something like: > > > > WARN_ON_ONCE(!(in_task || segment_eq(get_fs(), USER_DS))) > > > > Work? Then we allow KERNEL_DS in task context, but for interrupt and > > others require USER_DS. > > But what would this mean? I can't understand why we limit using > access_ok() so strictly and narrow the cases. Because it's been a source of bugs. Any sanity checking we can put in seems like a good thing at this point.