From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 312AAC433DF for ; Thu, 18 Jun 2020 01:26:38 +0000 (UTC) Received: from krantz.zx2c4.com (krantz.zx2c4.com [192.95.5.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D7AF620776 for ; Thu, 18 Jun 2020 01:26:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D7AF620776 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=wireguard-bounces@lists.zx2c4.com Received: by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id b20b23dd; Thu, 18 Jun 2020 01:08:27 +0000 (UTC) Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTPS id 6999f1a7 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Thu, 18 Jun 2020 01:08:25 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id c17so5189312lji.11 for ; Wed, 17 Jun 2020 18:26:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FYdkGKfQbhF4PHnRrzgzko0Pu9PmmGSrtwLwQw3bXCE=; b=USuBEDM3obJ1zssUT3by5z68W+6bA25PIrs/Ar5iDTIEdB+F+KxJheeILyYi3+MLce ay6ux+133FqmMU0FMZLScqKFXxSh0qZ/klcpIt+QlGFrp2DJHn8tlbZHSTScoBseuw5M zAjVq/subiPC1w0IIEX12wdnM+RGuWU7gza1X77Xf5KhSfZPZWBnpKYHtWrSvMeMqjcW 3YpCH5WRZwfuSj0Eh+UjOOGA2r1Nq88ad96Tf9R4x1fhnDZbOLWtgKmLcG3zvu6vGSG/ ZcsydUz5Z6I0KR9+p2Vjn5vvVNk9JYl9k1xytLrkJhprKpmaEJ+n8oUOehM+kv6392fL BjWw== X-Gm-Message-State: AOAM530gHo2DDQT2gOsfBk3gzG1vIj09iAsrxlnRmVLjR3Y7EGNX5Nba UPlIpB7EYJQDAvWwnnhWghvVwg9T1Cg= X-Google-Smtp-Source: ABdhPJzbijHiPBJ8QWNf9hQXsnh9CB5HA28VxqbN6FIY1pPr6HYmH8EGA0XHv2KQOLuy+zTeoR016w== X-Received: by 2002:a05:6402:3106:: with SMTP id dc6mr6587998edb.375.1592393520398; Wed, 17 Jun 2020 04:32:00 -0700 (PDT) Received: from localhost (ip-37-188-158-19.eurotel.cz. [37.188.158.19]) by smtp.gmail.com with ESMTPSA id y62sm12010608edy.61.2020.06.17.04.31.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 04:31:59 -0700 (PDT) Date: Wed, 17 Jun 2020 13:31:57 +0200 From: Michal Hocko To: Matthew Wilcox Cc: dsterba@suse.cz, Joe Perches , Waiman Long , Andrew Morton , David Howells , Jarkko Sakkinen , James Morris , "Serge E. Hallyn" , Linus Torvalds , David Rientjes , Johannes Weiner , Dan Carpenter , "Jason A . Donenfeld" , linux-mm@kvack.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-pm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-amlogic@lists.infradead.org, linux-mediatek@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-ppp@vger.kernel.org, wireguard@lists.zx2c4.com, linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-fscrypt@vger.kernel.org, ecryptfs@vger.kernel.org, kasan-dev@googlegroups.com, linux-bluetooth@vger.kernel.org, linux-wpan@vger.kernel.org, linux-sctp@vger.kernel.org, linux-nfs@vger.kernel.org, tipc-discussion@lists.sourceforge.net, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org Subject: Re: [PATCH v4 0/3] mm, treewide: Rename kzfree() to kfree_sensitive() Message-ID: <20200617113157.GM9499@dhcp22.suse.cz> References: <20200616015718.7812-1-longman@redhat.com> <20200616230130.GJ27795@twin.jikos.cz> <20200617003711.GD8681@bombadil.infradead.org> <20200617071212.GJ9499@dhcp22.suse.cz> <20200617110820.GG8681@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200617110820.GG8681@bombadil.infradead.org> X-BeenThere: wireguard@lists.zx2c4.com X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: Development discussion of WireGuard List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: wireguard-bounces@lists.zx2c4.com Sender: "WireGuard" On Wed 17-06-20 04:08:20, Matthew Wilcox wrote: > On Wed, Jun 17, 2020 at 09:12:12AM +0200, Michal Hocko wrote: > > On Tue 16-06-20 17:37:11, Matthew Wilcox wrote: > > > Not just performance critical, but correctness critical. Since kvfree() > > > may allocate from the vmalloc allocator, I really think that kvfree() > > > should assert that it's !in_atomic(). Otherwise we can get into trouble > > > if we end up calling vfree() and have to take the mutex. > > > > FWIW __vfree already checks for atomic context and put the work into a > > deferred context. So this should be safe. It should be used as a last > > resort, though. > > Actually, it only checks for in_interrupt(). You are right. I have misremembered. You have made me look (thanks) ... > If you call vfree() under > a spinlock, you're in trouble. in_atomic() only knows if we hold a > spinlock for CONFIG_PREEMPT, so it's not safe to check for in_atomic() > in __vfree(). So we need the warning in order that preempt people can > tell those without that there is a bug here. ... Unless I am missing something in_interrupt depends on preempt_count() as well so neither of the two is reliable without PREEMPT_COUNT configured. -- Michal Hocko SUSE Labs