Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4406905ybb; Tue, 14 Apr 2020 06:45:04 -0700 (PDT) X-Google-Smtp-Source: APiQypJ/P9TVTy8mUyKNf+OlMxY1pMMWfnOnCfdM5N6t4A6vPZYKBBFdt1KRiOYI++pYZc9TNZY5 X-Received: by 2002:aa7:c251:: with SMTP id y17mr20499421edo.117.1586871904191; Tue, 14 Apr 2020 06:45:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586871904; cv=none; d=google.com; s=arc-20160816; b=Ir3moL5ObBHlpHvElxgAp9c1z6sdz/n7emeaZ4SfFMStvAvgJffu1oi5I0SA28ZjTm 1zCwMHbzmvb8jbmEvNCKcFz8rxUN8spEPRFmSuy64hqewAnMA9j+KtA9rId4m3JGVeBt FZGt0D+VTn1W7rKYpRGi7BBxB4HszIjWBXTbepl7fzDdKB7JUIeSKRq4jkXmwg+Zi+kZ MKVOJS8E0AHAI/mRpUMYiqwqXHudTPHHlzVnKCIEzcYCjww018gT6LiCCCLyawSrUGS2 wo6HxD3moFpRBEA9wiXF9YddjLfeZ149R78/d3D8OyrXrNGO5Ny2CUTGuMLPsy1Yqz61 wx1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=GtP40NBc6K+wY7TevCqJVJVyGGxw6eyhk3x6njvRZbI=; b=vTEiGYEBfDNTCdcwJGmeob5aAKItaPueeeW5/z24XBLUxTQyEuqKJrR+q9/FXZMChY //TRGLgtf1CEuSBdPUAGeH1DJK9MhXYXyRp5EBZTMuom/PcRIx6aAFpFESfs9AhqlNjj kvTt/FEdA6X7LwziWVvXrr4jysZZ5BFwklgW9QVhC0KcxGtiSRKz+cnACpkllCf4TPfq q5jojIMOckpBNDBn1YVS4k/rIupwQowi2yHvVr4PdeeX33F2u1kdoiH2Jzpy99n+N5S6 CcuWO/EiQUfuhwpjXp5iowtJJOdn73/bmbffX2sXy38x+iUzL+8r1PM30w8kooLRd7QV lmsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PMRE9MFB; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si8061116eds.127.2020.04.14.06.44.40; Tue, 14 Apr 2020 06:45:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-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=@google.com header.s=20161025 header.b=PMRE9MFB; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390465AbgDNAaE (ORCPT + 99 others); Mon, 13 Apr 2020 20:30:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390483AbgDNAaC (ORCPT ); Mon, 13 Apr 2020 20:30:02 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED8E1C008611 for ; Mon, 13 Apr 2020 17:30:00 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id r4so5232636pgg.4 for ; Mon, 13 Apr 2020 17:30:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=GtP40NBc6K+wY7TevCqJVJVyGGxw6eyhk3x6njvRZbI=; b=PMRE9MFBjRNguCLZJxvQ0tC6cbj5HN/L0mNJHOjg1H5naWvyPaji8Uw6CjXqOQ2azW MhWs/LuNrHlvICFisvb7Cy6SJ3VKQrmiHJlokad5hGoOXcGXzDY3vorrrgpyAZrAVUDE dUN76VdbMCLvs9G10TRyVoj/R2uKEUPKhrkRhwWPh9Qq6Oj8zqhrDAXwnWHye+K8R3ym lDZQumSHVx6+RupP9U0o1EyjztcXPr7zTXefIIyzd+nYkxQBJg3bKkumuWN4k6N/hrZC eN210smaNX58gX6QVglgalvDGfi5xzWfnOSt7/cWPG1d3xQeaexIo7gZ03EO3NRYAH/8 2wUQ== 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:in-reply-to:message-id :references:user-agent:mime-version; bh=GtP40NBc6K+wY7TevCqJVJVyGGxw6eyhk3x6njvRZbI=; b=nB3fSxOrHk4euhfrIfSJxsA1KJ0Wm6UNBIKeoQ/aOKj6QddxrTABDY2shTJzP/rIF7 KRE1+7/j1e6PgMFwPmnU8Gqiwhp0vBfhEKNA3ZaQK26MSd3sXo4y8SkrCRIXlPwe4lRe s3jA0nYteTsZCIoXdmlreYbyrlqJdfLvZVXbiPG/HGvZ+7VmoGtBzyM8x32q/F+9EKT/ 6MQMBsK3C929LCdV/mxxYS3k9nzS5e5tDLRaqRp2HJa4Vp1sHJttAjZiMjdoAQGdeoCR yYlqRgYvaRbPvAuFbn4gjZp8fv9FWP2OiWPZsRSHOxmsR4+mc88jUjDEwU3Os8kpHxpC UjQQ== X-Gm-Message-State: AGi0PuaeGze2KPfAViqoAZX0VXPYDJ6ZF6ntqCGeQKUmrahFy90R0oxZ fzqiuTT5G1L6P29O1pgdKCPgHg== X-Received: by 2002:a62:dd48:: with SMTP id w69mr10144721pff.86.1586824199909; Mon, 13 Apr 2020 17:29:59 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id g11sm10055136pjs.17.2020.04.13.17.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2020 17:29:59 -0700 (PDT) Date: Mon, 13 Apr 2020 17:29:58 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Waiman Long cc: Andrew Morton , David Howells , Jarkko Sakkinen , James Morris , "Serge E. Hallyn" , Linus Torvalds , Joe Perches , Matthew Wilcox , 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() In-Reply-To: <20200413211550.8307-2-longman@redhat.com> Message-ID: References: <20200413211550.8307-1-longman@redhat.com> <20200413211550.8307-2-longman@redhat.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Mon, 13 Apr 2020, 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 Acked-by: David Rientjes