Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp252092ybz; Wed, 15 Apr 2020 08:07:33 -0700 (PDT) X-Google-Smtp-Source: APiQypJLhGV1xsvvvPoLt4zvqbeaQKkWaJdJDorRp0iUSgzN8KTooec+s5HkXDm5cCPoF+z7zTD9 X-Received: by 2002:a17:906:43c6:: with SMTP id j6mr5026322ejn.39.1586963253298; Wed, 15 Apr 2020 08:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586963253; cv=none; d=google.com; s=arc-20160816; b=yyATAzh+8KrZU3d/pUwVHvz4baDH1Q+zTDbEvHRYx2rETvsaVqNgW9SDu9Wn8btBxb oVJqJBzDTEQyla1EUjZVwsFjPzgOFmZo8oGqdGYj2k3vjDMUn0W/mmqC/3+1IpbAbQ+G Km6HMS+ubMzCAKWiXrOq/+kLRE2XeG6pHdaQXPoq744dGHrPPAwdnM2q38hz4WV+tZpK eE2uaJfXop6twE+VYCZ70FawuNUi3BBiq8L7cX8bJ+AwwgGaSxc7C8UDi3MeDvEvFJu1 3ntdoDuVqeZwreYPSNTtmQzUkS+q7ecAcw3iQlaHBkyb6GOvUOi7BsloE7UGA2vft8Zr whww== 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 :dkim-signature; bh=ef3HLI/XX5ogd42JRuoGnEbb/Ln3ZxgvuLj5jaeUWkI=; b=uv0kV8m4vorXCuPIHtLWpZ8T4vw+vPs9i/boNaVsMV5+eXii+pWA9O9wJsAIBAZ7s7 diM3o/dCkNZt+jdraZQaNYBaooUhNCdtsavCNmsMU8XfWGLdSjeVIOo1OAqaVfTKN1gY Zu9nlY2qAc0KVG6F1wLo/dKPhmCDbi5sxa5OkFGenCxQPr42FRBrtfZn8DpEfmnSRsjk CXL/ohsg2TO8E7Cxfy0HCGI4UY6YUI2XCMHVvtcpB2QOYCSKarUG34RTCcmzZdMiN2CM tSguRXZO8lLtcWcgUOBCpbOsDrvGThVDq988u1Hf8mbIunuywWEmMpmkuh9AqfQNEb2e 64YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=Tcxzc6xC; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cm18si437902edb.130.2020.04.15.08.07.06; Wed, 15 Apr 2020 08:07:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=Tcxzc6xC; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393208AbgDOFBN (ORCPT + 99 others); Wed, 15 Apr 2020 01:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393188AbgDOFBL (ORCPT ); Wed, 15 Apr 2020 01:01:11 -0400 Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32597C0610D5 for ; Tue, 14 Apr 2020 22:01:09 -0700 (PDT) Received: by mail-qv1-xf42.google.com with SMTP id da9so1113486qvb.3 for ; Tue, 14 Apr 2020 22:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ef3HLI/XX5ogd42JRuoGnEbb/Ln3ZxgvuLj5jaeUWkI=; b=Tcxzc6xC3iVTZShTUf3CIv3N8B5ZyCbru12fLV5+tpVooL5/Bo3MM2R4w1+y/qKNnw 9lu0zJBRs+VK1Bc14YzwiZC+K/efs95VT8GzxaoJoz3t2WhfDZxWX+BgsMNU20r8wRPv WS98QN/V8NZIzymtO0juNqdA9Tg6/2OTyjU7Zm1KL9ejebzf7wo1d0uOEsRrlg17M8fg qYmffi6H6MwGLJe4epZjwPPvjWIdIXS0xtejpuhYYUqQSrz2GfoywvJh6tC6sCJVyKe7 xzOQhWdIv/o82YQJCk9DtMPUw2B8iLWuNwugd4l1OepDEbLixuOHRPHRALsrInJO+Rsn o1og== 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=ef3HLI/XX5ogd42JRuoGnEbb/Ln3ZxgvuLj5jaeUWkI=; b=YHtFXXvrdv2KvoncLa/GaVyZTiyZuC9ywdrFS1ALRxF53DR4Had8wx7NaE1tacqI8j DOCwxBm9Ykelh5wB2uMqJLWs/9uBmenG0Lj8/i1H679AJb9UIa46W1W4vn8SlRv/Dn8E NxoWlpO71hnjqebIo7yCLowdVdKcBHorXtKibLzHASusswaqTfk/3IfsLnfXhp1EIVTT 7qZ5di6kMjwJWC/TCrmfqCY4BsFGg7ox+gf3FxvFgc8EfADqtMIM5Uz8PxCcAHaDH3go EsYDPZN8sYO/gh3KT7dnXT3vdqMZ1XpFkI6m9uQK/KM+nvSjIM+e06+9tYS7++A/A+or sLMg== X-Gm-Message-State: AGi0PuZYdqNHwc4FGlYThTMt0yn3bcA33X2nbc4oLSFUkI95DAK4akvF Y6ycMwAwKZXwof2X/+1Ri28hrg== X-Received: by 2002:a0c:e88d:: with SMTP id b13mr3243342qvo.245.1586926868219; Tue, 14 Apr 2020 22:01:08 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::e623]) by smtp.gmail.com with ESMTPSA id 10sm6168833qtp.4.2020.04.14.22.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 22:01:07 -0700 (PDT) Date: Wed, 15 Apr 2020 01:01:06 -0400 From: Johannes Weiner 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: <20200415050106.GA154671@cmpxchg.org> 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-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Mon, Apr 13, 2020 at 05:15:49PM -0400, Waiman Long wrote: > As said by Linus: > > A symmetric naming is only helpful if it implies symmetries in use. > Otherwise it's actively misleading. As the btrfs example proves - people can be tempted by this false symmetry to pair kzalloc with kzfree, which isn't what we wanted. > 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 Looks good to me. Thanks for fixing this very old mistake. Acked-by: Johannes Weiner