From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f70.google.com (mail-vk0-f70.google.com [209.85.213.70]) by kanga.kvack.org (Postfix) with ESMTP id CC68A6B0253 for ; Wed, 10 Jan 2018 15:14:10 -0500 (EST) Received: by mail-vk0-f70.google.com with SMTP id w184so148086vke.1 for ; Wed, 10 Jan 2018 12:14:10 -0800 (PST) Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w187sor6895908vkb.56.2018.01.10.12.14.09 for (Google Transport Security); Wed, 10 Jan 2018 12:14:09 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <1515531365-37423-1-git-send-email-keescook@chromium.org> <1515531365-37423-6-git-send-email-keescook@chromium.org> From: Kees Cook Date: Wed, 10 Jan 2018 12:14:07 -0800 Message-ID: Subject: Re: [PATCH 05/36] usercopy: WARN() on slab cache usercopy region violations Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: To: Christopher Lameter Cc: LKML , David Windsor , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Laura Abbott , Ingo Molnar , Mark Rutland , Linux-MM , linux-xfs@vger.kernel.org, Linus Torvalds , Alexander Viro , Andy Lutomirski , Christoph Hellwig , "David S. Miller" , "Martin K. Petersen" , Paolo Bonzini , Christian Borntraeger , Christoffer Dall , Dave Kleikamp , Jan Kara , Luis de Bethencourt , Marc Zyngier , Rik van Riel , Matthew Garrett , "linux-fsdevel@vger.kernel.org" , linux-arch , Network Development , kernel-hardening@lists.openwall.com On Wed, Jan 10, 2018 at 10:31 AM, Christopher Lameter wrote: > On Tue, 9 Jan 2018, Kees Cook wrote: > >> @@ -3823,11 +3825,9 @@ int __check_heap_object(const void *ptr, unsigned long n, struct page *page, > > Could we do the check in mm_slab_common.c for all allocators and just have > a small function in each allocators that give you the metadata needed for > the object? That could be done, but there would still need to be some implementation-specific checks in the per-implementation side (e.g. red-zone, etc). I'll work up a patch and see if it's less ugly than what I've currently got. :) >> + * carefully audit the whitelist range). >> + */ >> int report_usercopy(const char *name, const char *detail, bool to_user, >> unsigned long offset, unsigned long len) >> { > > Should this not be added earlier? This seemed like the best place to add this since it's where the WARN is being added, so it's a bit more help for anyone looking at the code. -Kees -- Kees Cook Pixel Security -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org