Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757777AbaGOGGW (ORCPT ); Tue, 15 Jul 2014 02:06:22 -0400 Received: from LGEMRELSE6Q.lge.com ([156.147.1.121]:58280 "EHLO lgemrelse6q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751210AbaGOGGT (ORCPT ); Tue, 15 Jul 2014 02:06:19 -0400 X-Original-SENDERIP: 10.177.220.145 X-Original-MAILFROM: iamjoonsoo.kim@lge.com Date: Tue, 15 Jul 2014 15:12:19 +0900 From: Joonsoo Kim To: Andrey Ryabinin Cc: linux-kernel@vger.kernel.org, Dmitry Vyukov , Konstantin Serebryany , Alexey Preobrazhensky , Andrey Konovalov , Yuri Gribov , Konstantin Khlebnikov , Sasha Levin , Michal Marek , Russell King , Thomas Gleixner , Ingo Molnar , Christoph Lameter , Pekka Enberg , David Rientjes , Andrew Morton , linux-kbuild@vger.kernel.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-mm@kvack.org Subject: Re: [RFC/PATCH RESEND -next 20/21] fs: dcache: manually unpoison dname after allocation to shut up kasan's reports Message-ID: <20140715061219.GK11317@js1304-P5Q-DELUXE> References: <1404905415-9046-1-git-send-email-a.ryabinin@samsung.com> <1404905415-9046-21-git-send-email-a.ryabinin@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1404905415-9046-21-git-send-email-a.ryabinin@samsung.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 09, 2014 at 03:30:14PM +0400, Andrey Ryabinin wrote: > We need to manually unpoison rounded up allocation size for dname > to avoid kasan's reports in __d_lookup_rcu. > __d_lookup_rcu may validly read a little beyound allocated size. If it read a little beyond allocated size, IMHO, it is better to allocate correct size. kmalloc(name->len + 1, GFP_KERNEL); --> kmalloc(roundup(name->len + 1, sizeof(unsigned long ), GFP_KERNEL); Isn't it? Thanks. > > Reported-by: Dmitry Vyukov > Signed-off-by: Andrey Ryabinin > --- > fs/dcache.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fs/dcache.c b/fs/dcache.c > index b7e8b20..dff64f2 100644 > --- a/fs/dcache.c > +++ b/fs/dcache.c > @@ -38,6 +38,7 @@ > #include > #include > #include > +#include > #include "internal.h" > #include "mount.h" > > @@ -1412,6 +1413,8 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) > kmem_cache_free(dentry_cache, dentry); > return NULL; > } > + unpoison_shadow(dname, > + roundup(name->len + 1, sizeof(unsigned long))); > } else { > dname = dentry->d_iname; > } > -- > 1.8.5.5 > > -- > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/