Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp392628ybz; Wed, 15 Apr 2020 10:42:36 -0700 (PDT) X-Google-Smtp-Source: APiQypLvkYOVfNg6NuAxxG5inAxFJafgRqLxMh12U5VUZHqtWjGv41IrKkoCXFZxVXhvmc2qkKjZ X-Received: by 2002:aa7:db88:: with SMTP id u8mr26869885edt.366.1586972556558; Wed, 15 Apr 2020 10:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586972556; cv=none; d=google.com; s=arc-20160816; b=DDUICrH2+7kVKeSPjBCyXWFsJ2ikcXS/l+GIiiY/xV1uQwmYA9XdTkdsdMHrk2WSmB EjcjnU9cUY7FmUwqWt5QQs4VGpJgnKb0DXxeeVXYQDysbIaogoNgxLoH3cPh+xIMHgbe sa9THVwv2G4Cv1y5M8H7/qZrcgwZbW8H8rua2vZKVCXVrdt1Py3BpvKA9SItvsB72ud7 oD7k3Ih4Zoi1S39t3L69GW1cvm8uIRB4qIQ19RIfLKVjUD8gA2iXbUYG3DoeTrhFxXwz LgUZcpC7FFfwAjgUTpjLX1YNpmWRCqnKwJN1uTJdhtsrj75b4OUyAVEC46AKUrDpa9Tj kInw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=ZSEHFc2eh+N6K60wyVHbBWfK0AmjMN90oe2OMNtMMJ0=; b=HEsvFgzNLBegheK0xVCzcCbxzJFs6cin7eIE1oepjK1XhbxsHvOBXjU8WAPD6a4SvS HGu0M2X7ogmrvqb05BfwRYUn5ryFbaoiFvGCkONE5nhUubbPWHT5ydgxVK2BgdRWM64V Q2Bw277bQJSA7jwUvxyFwqWWV87WdkcxjE4DzgKHEXAW8hVQlLvH+mkqPhvlMxcDqczz 1AZA3HgfAT9J3Kd5NeaYIrswYrNVSrsi563dMbyBH3N7Bot2bs74q2E9SIAfXrG2PclQ ushSToxnhBg/QwtFG3lvgo1qU+gF2BtxCdyaVubNCaTupoh4TeEF6dbOzsbY1bCWzkmk z97g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si11461621edj.96.2020.04.15.10.42.04; Wed, 15 Apr 2020 10:42:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437309AbgDNJBi (ORCPT + 99 others); Tue, 14 Apr 2020 05:01:38 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:38554 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437280AbgDNJBh (ORCPT ); Tue, 14 Apr 2020 05:01:37 -0400 Received: by mail-wm1-f65.google.com with SMTP id g12so5210235wmh.3; Tue, 14 Apr 2020 02:01:32 -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=ZSEHFc2eh+N6K60wyVHbBWfK0AmjMN90oe2OMNtMMJ0=; b=VZcdmcPfe6bokelP+VcFo/KKk2US9O6S8tRgNtF/gLstaIJygVoMVr8X5z7aVnpfwx jGWGcCIyIgFX1qffbo5S4TmA9T/iLJ2Q0bT9GNRqVXaIfaO26J4K3BvaIU8/N/famYYr /Vzb3JOQMfu9RVXx6Bpfb/EFXzrUyx0L6hYIh3nTQjuAUmNc5PFB2moXYPWzc5+1uoKL VmqQFll+et195bcMN/B5vHfEjmD6kX7vTy47aaOOymqcG0eLYjjDaN7bgl0HghLX6r2H x5fja3K7pItACo6LAcf8KM9Q8pUzmB7j4w5YTazUVAxnL3Ecgxz4soRhBQlJPpMXAquC JSTQ== X-Gm-Message-State: AGi0PuaRcU49yxnL2rzL+ZED8gAyGbXieOsW7r3oPqKXnqp2UpcU96/U XwPSodKQc3rqeZ01ta/hip0= X-Received: by 2002:a1c:a913:: with SMTP id s19mr23660673wme.134.1586854891811; Tue, 14 Apr 2020 02:01:31 -0700 (PDT) Received: from localhost (ip-37-188-180-223.eurotel.cz. [37.188.180.223]) by smtp.gmail.com with ESMTPSA id n6sm18637096wrs.81.2020.04.14.02.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 02:01:30 -0700 (PDT) Date: Tue, 14 Apr 2020 11:01:29 +0200 From: Michal Hocko To: Waiman Long Cc: Andrew Morton , David Howells , Jarkko Sakkinen , James Morris , "Serge E. Hallyn" , Linus Torvalds , Joe Perches , Matthew Wilcox , David Rientjes , linux-mm@kvack.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-crypto@vger.kernel.org, linux-s390@vger.kernel.org, linux-pm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-mediatek@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.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, samba-technical@lists.samba.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, cocci@systeme.lip6.fr, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org Subject: Re: [PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive() Message-ID: <20200414090129.GE4629@dhcp22.suse.cz> References: <20200413211550.8307-1-longman@redhat.com> <20200413211550.8307-2-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200413211550.8307-2-longman@redhat.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon 13-04-20 17:15:49, Waiman Long wrote: > As said by Linus: > > A symmetric naming is only helpful if it implies symmetries in use. > Otherwise it's actively misleading. > > In "kzalloc()", the z is meaningful and an important part of what the > caller wants. > > In "kzfree()", the z is actively detrimental, because maybe in the > future we really _might_ want to use that "memfill(0xdeadbeef)" or > something. The "zero" part of the interface isn't even _relevant_. > > The main reason that kzfree() exists is to clear sensitive information > that should not be leaked to other future users of the same memory > objects. > > Rename kzfree() to kfree_sensitive() to follow the example of the > recently added kvfree_sensitive() and make the intention of the API > more explicit. In addition, memzero_explicit() is used to clear the > memory to make sure that it won't get optimized away by the compiler. > > The renaming is done by using the command sequence: > > git grep -w --name-only kzfree |\ > xargs sed -i 's/\bkzfree\b/kfree_sensitive/' > > followed by some editing of the kfree_sensitive() kerneldoc and the > use of memzero_explicit() instead of memset(). > > Suggested-by: Joe Perches > Signed-off-by: Waiman Long Makes sense. I haven't checked all the conversions and will rely on the script doing the right thing. The core MM part is correct. Acked-by: Michal Hocko -- Michal Hocko SUSE Labs