From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754523AbcHSKte (ORCPT ); Fri, 19 Aug 2016 06:49:34 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33031 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754170AbcHSKtc (ORCPT ); Fri, 19 Aug 2016 06:49:32 -0400 Date: Fri, 19 Aug 2016 12:31:41 +0200 From: Michal Hocko To: Rik van Riel Cc: Kees Cook , Linus Torvalds , Laura Abbott , linux-kernel@vger.kernel.org, linux-mm@kvack.org, xiaolong.ye@intel.com Subject: Re: [PATCH] usercopy: Skip multi-page bounds checking on SLOB Message-ID: <20160819103140.GB32632@dhcp22.suse.cz> References: <20160817222921.GA25148@www.outflux.net> <1471530118.2581.13.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1471530118.2581.13.camel@redhat.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 18-08-16 10:21:58, Rik van Riel wrote: > On Wed, 2016-08-17 at 15:29 -0700, Kees Cook wrote: > > When an allocator does not mark all allocations as PageSlab, or does > > not > > mark multipage allocations with __GFP_COMP, hardened usercopy cannot > > correctly validate the allocation. SLOB lacks this, so short-circuit > > the checking for the allocators that aren't marked with > > CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR. This also updates the config > > help and corrects a typo in the usercopy comments. > > > > Reported-by: xiaolong.ye@intel.com > > Signed-off-by: Kees Cook > > There may still be some subsystems that do not > go through kmalloc for multi-page allocations, > and also do not use __GFP_COMP > > I do not know whether there are, but if they exist > those would still trip up the same way SLOB got > tripped up before your patch. > > One big question I have for Linus is, do we want > to allow code that does a higher order allocation, > and then frees part of it in smaller orders, or > individual pages, and keeps using the remainder? We even have an API for that alloc_pages_exact. I do not think anybody uses that for copying from/to userspace but this pattern is not all that rare. -- Michal Hocko SUSE Labs