Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6743175imu; Wed, 30 Jan 2019 22:06:05 -0800 (PST) X-Google-Smtp-Source: ALg8bN7aiWWm5PqogkiGGp+JqOsK0M2io0rL6pi2AgjmEpPThmufdPKDtkU/Dl7vOw7As/WVUiqO X-Received: by 2002:a17:902:20e9:: with SMTP id v38mr32127672plg.250.1548914765175; Wed, 30 Jan 2019 22:06:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548914765; cv=none; d=google.com; s=arc-20160816; b=glDcr4BUbUhPBU+1jI+NY1PNgDhpyLnuXrrNC64MrcOWGv3QujEFNzrWTTkbQzQuWL nNjY0p7uP69E9hYIzZrFECXAV0j7iKx1ze7LJqOLJispUtIsQrIwvz71Hr5StUeOYfv2 dbpCY226N8F3GhUHdRxMtB4B4KRHy1AGjzcL9ile6NWoQ8cuOne6phHtManoLs1r2hH3 oy1vbWUCL9wvMsdFhaUbMxq+1ZCyp1Ghfa1DB5EaYBH7zxzYFYKKeEVeX7dtnZ8b24tj QQWStpE4T6ymLZq23DxDxP8kIvBv5aB+HhKpiDqrS8alYQRS4dh+FLCS775fZ9jhwfyo TmFQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=pm74jFL5WdkgPbflaRWND5Onh5JGUH4RIyse6+DyrEA=; b=nMXEEiNvBDIugklzT2yufLP4edUdwOzx4tHFRwtFXmtW6cfb0utgsWW5yr/l/vawnv c6/GoSmrR81oqUzH8tW7KJV0PvmhzIrK5z1mi/Pys+oiPANW62+fYhExCNbXP0fv5Gd0 jHy70qBoEP6/nlVz57WrqPH/CBFSIlvyS4/mnZ1PzVQoKO7uauEXMy1+DYRE8kGEGeXn 6+WdQdGFB7j6isK0Nr2NgfVs7pJl2ya27is7/+HMDf1Ei4Nx8V8EkAoRQlGMSYghCH3s w+JmqNhGUi/AQ7YWl4nz+o30H2xKfT+OnSHEumiK9vmLMQMCRAGN+iZnxV+Ft3QS4bMY ebXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b="K83trPq/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=iki.fi Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 18si3454955pgo.331.2019.01.30.22.05.49; Wed, 30 Jan 2019 22:06:05 -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=@messagingengine.com header.s=fm1 header.b="K83trPq/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=iki.fi Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726869AbfAaGEE (ORCPT + 99 others); Thu, 31 Jan 2019 01:04:04 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:58881 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725816AbfAaGEE (ORCPT ); Thu, 31 Jan 2019 01:04:04 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EE552216C5; Thu, 31 Jan 2019 01:04:02 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 31 Jan 2019 01:04:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=pm74jFL5WdkgPbflaRWND5Onh5JGUH4RIyse6+Dyr EA=; b=K83trPq/lRQ5ZAEYokXtzAHdeVPm3lHZ2XLhKPZ1Zsbfke2/k8QO7KTo7 THpV7spAKIn45V3f0rQuImWFcFOUTIQ4jNkjgo4VJIPdyJxtp3HF8fxNEKbJjUPD nXpxfqnLiHQB3k3oSQ9aPSEzwmNhi/NJy07HqBqyFZRShvRauN/0hCJ3au1UIwTG +u9oDb+RzauvtUYLsFzC1Pu9PX18t7HbFyZsL8K2/3fj8ELnW00sTecQLydtKNms ZgfIPB4DtqI0PBbWWkQU3GiVR0QGHxtXUpXNQ4Ryeb+N4iyTbC1YsZphigAEFEIk WZpcKW281KMOD6ZxSR/xd7w0iEpBw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeehgdeklecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepuffvfhfhkffffg ggjggtgfesthejredttdefjeenucfhrhhomheprfgvkhhkrgcugfhnsggvrhhguceophgv nhgsvghrghesihhkihdrfhhiqeenucfkphepkeelrddvjedrfeefrddujeefnecurfgrrh grmhepmhgrihhlfhhrohhmpehpvghnsggvrhhgsehikhhirdhfihenucevlhhushhtvghr ufhiiigvpedt X-ME-Proxy: Received: from Pekka-MacBook.local (89-27-33-173.bb.dnainternet.fi [89.27.33.173]) by mail.messagingengine.com (Postfix) with ESMTPA id DDBC0E40FF; Thu, 31 Jan 2019 01:03:56 -0500 (EST) Subject: Re: [PATCH] mm: Prevent mapping slab pages to userspace To: Matthew Wilcox , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Rik van Riel , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , kernel-hardening@lists.openwall.com, Kees Cook , Michael Ellerman References: <20190125173827.2658-1-willy@infradead.org> From: Pekka Enberg Message-ID: Date: Thu, 31 Jan 2019 08:03:54 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190125173827.2658-1-willy@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/01/2019 19.38, Matthew Wilcox wrote: > It's never appropriate to map a page allocated by SLAB into userspace. > A buggy device driver might try this, or an attacker might be able to > find a way to make it happen. > > Signed-off-by: Matthew Wilcox Acked-by: Pekka Enberg A WARN_ON_ONCE() would be nice here to let those buggy drivers know that they will no longer work. > --- > mm/memory.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/memory.c b/mm/memory.c > index e11ca9dd823f..ce8c90b752be 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -1451,7 +1451,7 @@ static int insert_page(struct vm_area_struct *vma, unsigned long addr, > spinlock_t *ptl; > > retval = -EINVAL; > - if (PageAnon(page)) > + if (PageAnon(page) || PageSlab(page)) > goto out; > retval = -ENOMEM; > flush_dcache_page(page); >