Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1487288ybh; Sun, 8 Mar 2020 05:36:57 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvowTYf9i1oyw4lIEhImEW9E8pAOoV7Y5prvjwzL9kCBmbfbkCjs+DPDz+mRSTqwFc9JeP7 X-Received: by 2002:a05:6830:1e34:: with SMTP id t20mr9927044otr.79.1583671016927; Sun, 08 Mar 2020 05:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583671016; cv=none; d=google.com; s=arc-20160816; b=cxTf4KG48P15/b7X7xUHodY9Jh+VBCk9UGyesxJxsxtfze2PKA/o0tM8kUnjuw8l/A izAlPkjZLgF+OPO3OA5jm8M2n6wa59vRK9Nbbjyrd4gmv8+ueMUDtGXjPhWK74y5xBnK ZbO9ucI8TgeIZiQMs6ci1atVPnr8DmIO9UnCZzowzlXrOU7FS4OWOddNLLABExwcv/7n cvHDEeiauNkxbJOqtElT3rKaGyaMslV/Di+jJ4TAZVgQkW15BYxxQyezaMghYr/9/uyO grPS/e+5Yt+iSDbeR3vV0iB9V/inX+olkBta9BmBo+RHRai8+2ZLvclFTitKwqryVtIg q+LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=IiyxS/rAQGOWd77kOuqz3QJtfeBB9AA2GpRhunGswrk=; b=sIhhorubAvfD8HIOcMD8DXKCkaXOOMd5gGZIDQKzGLbS55CO8GS0S+OSckxws21zHK tj3qm/ofacrwAc6t+pcGsmrDTO4XtnSRWwvDvnwXlPH88HbiDU3WWW5TVJrIcTbdNuEp xOwytpZIcjSOuHZ+SwGST0m2tqy4kkYZWKJdclBzxFN0Km2Pha2iP+9fLrH1NATTLsnH cSqdtLdKI750D/YwvXJXolt55L2nMnIEkhuR/2i2l6mFHjh7ciUUDQnVJq7lI73kXVO7 xbRMawY8/mP/Fecw6/hvbv+P/RvadMbWanzOoHZjCXgS4ACm8ULy/f18n2KuBS6Ld+Jn cNRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EoELTO+U; 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 17si2478341oir.132.2020.03.08.05.36.44; Sun, 08 Mar 2020 05:36:56 -0700 (PDT) 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=bombadil.20170209 header.b=EoELTO+U; 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 S1726323AbgCHMgX (ORCPT + 99 others); Sun, 8 Mar 2020 08:36:23 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42442 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726281AbgCHMgX (ORCPT ); Sun, 8 Mar 2020 08:36:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=IiyxS/rAQGOWd77kOuqz3QJtfeBB9AA2GpRhunGswrk=; b=EoELTO+UvK8cEeBI7Bq1jfWu3d ywOUjGWPVgdIUwlDwHNvAnz7A7jt7sRZESaRxJJYcCovlaqfDMi9D93ABJuzkCf9AawCJ5Y9F+smq yrc63tEYVdVPxNUB1bfT9mf+TLYlM83dgg3cnJWkX0hjFFFxhwkB+pfz1epXPfgu6Ml7mHXqS9Spg mAyYIkU7fVneJVUfeA3xN04kctD3HoRFMK3LF3RJ0ZMD8+woUpJnSRpOYiblMsuK5kks28grkLnQh U0W/z1MxHkm84qjJmknzYr8BtNuqQ0PDIFo+eGZvlKB8nF1zpYsBp3Xpq/1/IuN4aM84T0CuQEm92 /DgQQZtQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAvAG-0001S6-TK; Sun, 08 Mar 2020 12:36:16 +0000 Date: Sun, 8 Mar 2020 05:36:16 -0700 From: Matthew Wilcox To: Jaewon Kim Cc: Andrew Morton , walken@google.com, bp@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org, jaewon31.kim@gmail.com Subject: Re: [PATCH] mm: mmap: show vm_unmapped_area error log Message-ID: <20200308123616.GH31215@bombadil.infradead.org> References: <20200304030206.1706-1-jaewon31.kim@samsung.com> <5E605749.9050509@samsung.com> <20200305202443.8de3598558336b1d75afbba7@linux-foundation.org> <5E61EAB6.5080609@samsung.com> <20200307154744.acd523831b45efa8d0fc1dfa@linux-foundation.org> <20200308015802.GD31215@bombadil.infradead.org> <5E64C1D7.3000208@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5E64C1D7.3000208@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 08, 2020 at 06:58:47PM +0900, Jaewon Kim wrote: > On 2020년 03월 08일 10:58, Matthew Wilcox wrote: > > On Sat, Mar 07, 2020 at 03:47:44PM -0800, Andrew Morton wrote: > >> On Fri, 6 Mar 2020 15:16:22 +0900 Jaewon Kim wrote: > >>> Even on 64 bit kernel, the mmap failure can happen for a 32 bit task. > >>> Virtual memory space shortage of a task on mmap is reported to userspace > >>> as -ENOMEM. It can be confused as physical memory shortage of overall > >>> system. > > But userspace can trigger this printk. We don't usually allow printks > > under those circumstances, even ratelimited. > Hello thank you your comment. > > Yes, userspace can trigger printk, but this was useful for to know why > a userspace task was crashed. There seems to be still many userspace > applications which did not check error of mmap and access invalid address. > > Additionally in my AARCH64 Android environment, display driver tries to > get userspace address to map its display memory. The display driver > report -ENOMEM from vm_unmapped_area and but also from GPU related > address space. > > Please let me know your comment again if this debug is now allowed > in that userspace triggered perspective. The scenario that worries us is an attacker being able to fill the log files and so also fill (eg) the /var partition. Once it's full, future kernel messages cannot be stored anywhere and so there will be no traces of their privilege escalation. Maybe a tracepoint would be a better idea? Usually they are disabled, but they can be enabled by a sysadmin to gain insight into why an application is crashing.