Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6517469imu; Wed, 30 Jan 2019 16:38:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN6tkKZoT2LkzSchWjaqGRl23rj0ak3nCst4EFp5HmHJbtLihmpcAzSWAzmbiv/cPNHHa/r3 X-Received: by 2002:a62:2fc3:: with SMTP id v186mr32926658pfv.82.1548895100634; Wed, 30 Jan 2019 16:38:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548895100; cv=none; d=google.com; s=arc-20160816; b=btp3AGPbwOWJIi9YoV72mXuT/a1BdzcD1atoX8XwZmdigg70riMct5rqmrkX0bJyuZ igm3NrcVM7Qfbq0E59+MhSe+xJOhgmJW7csmUrRdTU9mD0x/uJHE1OJ4cY0P7p6oMVFM mlpa5wCgyE+ldVtsu41nwJHTVHv47KK+liT+xwhK8dAwWdOYhNunESPYvXDIOnK2RYo1 QpNqqTzz5U6cy04VgYepkkY9Rqd7jlL/FWPy6e0hvqkrCW3YJLojnRY3+HUQBgY5XthE Poaq4JoK/MyLld3QMZJzkkQWzhMcnab0kTZLhUZR4KZ0IEWkzYwiPDddjGSHyjLsLtTM dq2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=Ba/ZquchCI/MsVbe5dlaq3EKgO5oor9re6645PZ1Yf4=; b=ND7MINUNtBap/7W8XPIUVjYnXDHj5e820q7fikksbgc3mU2lDZ/tRU9PozHJ9jNVzc 1RM6RZIWyLRF+eN9i1TeLwG31T0TxFdxAjhE1xgmzFd1YN0NwaVuuVkf/0VP8IeKX7f1 bI9H1pTRKBb4h+CXYUkRdNKjHCPrkkluZ31ZGC3Zvx5KpxGnLm72UdXdsTY/R5GEfTwk UlZORy8zAfC6iT3hvKQynntjJd33jJo64StESSoT7ujf5YZXkhCO4flpjCI0PGdGE5H0 V5ZkdmDWmh5Li+T664wrMPn/siMyux+uSSHK34HENSDay18QT6G1NNjz1Bs65x0jDsHg MPMw== ARC-Authentication-Results: i=1; mx.google.com; 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 z18si2873114plo.89.2019.01.30.16.38.04; Wed, 30 Jan 2019 16:38:20 -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; 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 S1726974AbfAaAhS (ORCPT + 99 others); Wed, 30 Jan 2019 19:37:18 -0500 Received: from ozlabs.org ([203.11.71.1]:59785 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725768AbfAaAhR (ORCPT ); Wed, 30 Jan 2019 19:37:17 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 43qhBt41SKz9sDB; Thu, 31 Jan 2019 11:37:10 +1100 (AEDT) From: Michael Ellerman To: Matthew Wilcox , Andrew Morton Cc: Matthew Wilcox , 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 Subject: Re: [PATCH] mm: Prevent mapping slab pages to userspace In-Reply-To: <20190125173827.2658-1-willy@infradead.org> References: <20190125173827.2658-1-willy@infradead.org> Date: Thu, 31 Jan 2019 11:37:10 +1100 Message-ID: <87bm3xpsqx.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Matthew Wilcox writes: > 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 > --- > 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); Thanks for turning this into an actual patch. cheers