Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp5029055imm; Mon, 14 May 2018 18:13:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr67cMYgSq3S4LJZ1lB/2A1NPpdxRTMPFuQeRByhKRENxXESiN//0et4TfYNe36RaYRi49L X-Received: by 2002:a17:902:bf08:: with SMTP id bi8-v6mr11940326plb.353.1526346821114; Mon, 14 May 2018 18:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526346821; cv=none; d=google.com; s=arc-20160816; b=fmJWRlfRNVAIfYcK1PF5rpHOVzpZhkPgAMvyFbzuNm/3UsBUR3sH0zxCRw9HE0x6ov v4W/z2uu0XO4nXCSg/FOsIPouYnio5ry0cYEDXdRGBp7YZrhijj4y0d2QApSrt1tv4Eh /tYtHowBp9fDFziyaRseA7NJy61nuc/DXL6F6VuLk3rXZf6sq3avBLa8O8ZLJ8yMQHd1 h6BFOhgJSThN4LzetKfxA8w13oSp73zGQlUNCVtduujZ0LPNNQSLuvCKWmeA5zVun/Kf Y6oWB+G+0x/cVcPE+EEsRanSv9VZXRAvalhWVIDYuP33qF4IMNr619LXAFRQzIwG1N/L uOLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=m2PFIBbENUNoXxIt3vDwPskphQmoJkwprT5cYig9Jkk=; b=XJXE96V4Uc+gNLqhEhhNYxfDpsFEX1gTSMsCNxxGzuGVa4vfNx00+xXvI2MDdlNsAe HbqvXaq8WXaO/rIVBk3A5QIEZJofr469zJC8mu5rM0LrIzG71S63Mh3e2x9goBqffzIM 9r/iqK5pv/pZnXXds8JPDoMYQAJXfThCmyeZV9QlPr2Fq7K0jFvW8xtGn0mytXyTs6Kx hDJm0lOTDXRBA8E0iWOuy9JQpLfXDy3kJkPT2esUpsWGSEmNGm+x6T94JJP8ce3LoUu1 d576uVD7xFGbTozBMGpQnozHVYherFdXcNs7kgDwXrr1naevtnKlLmKxlW0YHZZoyeL0 M6mA== 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 e1-v6si8514764pgr.167.2018.05.14.18.13.25; Mon, 14 May 2018 18:13:41 -0700 (PDT) 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 S1752169AbeEOBNP (ORCPT + 99 others); Mon, 14 May 2018 21:13:15 -0400 Received: from lgeamrelo13.lge.com ([156.147.23.53]:42045 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752024AbeEOBNN (ORCPT ); Mon, 14 May 2018 21:13:13 -0400 Received: from unknown (HELO lgemrelse7q.lge.com) (156.147.1.151) by 156.147.23.53 with ESMTP; 15 May 2018 10:13:11 +0900 X-Original-SENDERIP: 156.147.1.151 X-Original-MAILFROM: iamjoonsoo.kim@lge.com Received: from unknown (HELO localhost) (10.177.220.142) by 156.147.1.151 with ESMTP; 15 May 2018 10:13:11 +0900 X-Original-SENDERIP: 10.177.220.142 X-Original-MAILFROM: iamjoonsoo.kim@lge.com Date: Tue, 15 May 2018 10:13:11 +0900 From: Joonsoo Kim To: Mikulas Patocka Cc: Matthew Wilcox , Michal Hocko , David Miller , Andrew Morton , linux-mm@kvack.org, eric.dumazet@gmail.com, edumazet@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, virtualization@lists.linux-foundation.org, dm-devel@redhat.com, Vlastimil Babka , Christoph Lameter , Pekka Enberg , David Rientjes Subject: Re: [PATCH v3] kvmalloc: always use vmalloc if CONFIG_DEBUG_SG Message-ID: <20180515011311.GA32447@js1304-desktop> References: <20180420210200.GH10788@bombadil.infradead.org> <20180421144757.GC14610@bombadil.infradead.org> <20180423151545.GU17484@dhcp22.suse.cz> <20180424034643.GA26636@bombadil.infradead.org> <20180424171651.GC30577@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Mikulas. On Tue, Apr 24, 2018 at 02:41:47PM -0400, Mikulas Patocka wrote: > > > On Tue, 24 Apr 2018, Matthew Wilcox wrote: > > > On Tue, Apr 24, 2018 at 08:29:14AM -0400, Mikulas Patocka wrote: > > > > > > > > > On Mon, 23 Apr 2018, Matthew Wilcox wrote: > > > > > > > On Mon, Apr 23, 2018 at 08:06:16PM -0400, Mikulas Patocka wrote: > > > > > Some bugs (such as buffer overflows) are better detected > > > > > with kmalloc code, so we must test the kmalloc path too. > > > > > > > > Well now, this brings up another item for the collective TODO list -- > > > > implement redzone checks for vmalloc. Unless this is something already > > > > taken care of by kasan or similar. > > > > > > The kmalloc overflow testing is also not ideal - it rounds the size up to > > > the next slab size and detects buffer overflows only at this boundary. > > > > > > Some times ago, I made a "kmalloc guard" patch that places a magic number > > > immediatelly after the requested size - so that it can detect overflows at > > > byte boundary > > > ( https://www.redhat.com/archives/dm-devel/2014-September/msg00018.html ) > > > > > > That patch found a bug in crypto code: > > > ( http://lkml.iu.edu/hypermail/linux/kernel/1409.1/02325.html ) > > > > Is it still worth doing this, now we have kasan? > > The kmalloc guard has much lower overhead than kasan. I skimm at your code and it requires rebuilding the kernel. I think that if rebuilding is required as the same with the KASAN, using the KASAN is better since it has far better coverage for detection the bug. However, I think that if the redzone can be setup tightly without rebuild, it would be worth implementing. I have an idea to implement it only for the SLUB. Could I try it? (I'm asking this because I'm inspired from the above patch.) :) Or do you wanna try it? Thanks.