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=-5.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 A8BF9C433E0 for ; Mon, 15 Jun 2020 18:42:39 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 51C042071A for ; Mon, 15 Jun 2020 18:42:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Qdmw/PJx"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Qdmw/PJx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51C042071A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49m0Z52NPzzDqcG for ; Tue, 16 Jun 2020 04:42:37 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=207.211.31.120; helo=us-smtp-1.mimecast.com; envelope-from=longman@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Qdmw/PJx; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Qdmw/PJx; dkim-atps=neutral Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49m0Wt5Yx4zDqWR for ; Tue, 16 Jun 2020 04:40:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592246435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3LdVapGy9WTsAkwpfNEzCTfQe3Pij8/lM5ySXZsHExs=; b=Qdmw/PJxLK31/rKmKgWbE5yAY+4i+gsfVEBtEc5ToE9B/FlegLfNgeLIEfjWVedKb+Y3z+ Ycm1/NjjL9Q+v0I8qj/IlOhBg48Vph4+42maRH5yobUN7AM1PVkzEfbgROmMIUaUwRj4yL DHGm6MQRL2VNnBptPlwJW/1yX6HdQV8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592246435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3LdVapGy9WTsAkwpfNEzCTfQe3Pij8/lM5ySXZsHExs=; b=Qdmw/PJxLK31/rKmKgWbE5yAY+4i+gsfVEBtEc5ToE9B/FlegLfNgeLIEfjWVedKb+Y3z+ Ycm1/NjjL9Q+v0I8qj/IlOhBg48Vph4+42maRH5yobUN7AM1PVkzEfbgROmMIUaUwRj4yL DHGm6MQRL2VNnBptPlwJW/1yX6HdQV8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-513-n3G_ZfGUONug8wkjJytxqA-1; Mon, 15 Jun 2020 14:40:12 -0400 X-MC-Unique: n3G_ZfGUONug8wkjJytxqA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E5F43184D144; Mon, 15 Jun 2020 18:40:06 +0000 (UTC) Received: from llong.remote.csb (ovpn-117-41.rdu2.redhat.com [10.10.117.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3972B5D9CC; Mon, 15 Jun 2020 18:40:00 +0000 (UTC) Subject: Re: [PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive() To: Dan Carpenter References: <20200413211550.8307-1-longman@redhat.com> <20200413211550.8307-2-longman@redhat.com> <20200615180753.GJ4151@kadam> From: Waiman Long Organization: Red Hat Message-ID: <9d084be2-29a3-7757-9386-20dbaeb5fc24@redhat.com> Date: Mon, 15 Jun 2020 14:39:59 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200615180753.GJ4151@kadam> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-cifs@vger.kernel.org, linux-wireless@vger.kernel.org, Jarkko Sakkinen , virtualization@lists.linux-foundation.org, David Howells , linux-mm@kvack.org, linux-sctp@vger.kernel.org, target-devel@vger.kernel.org, kasan-dev@googlegroups.com, cocci@systeme.lip6.fr, devel@driverdev.osuosl.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, x86@kernel.org, James Morris , Matthew Wilcox , linux-stm32@st-md-mailman.stormreply.com, intel-wired-lan@lists.osuosl.org, David Rientjes , "Serge E. Hallyn" , linux-pm@vger.kernel.org, ecryptfs@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-fscrypt@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-btrfs@vger.kernel.org, linux-integrity@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-nfs@vger.kernel.org, Linus Torvalds , samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, tipc-discussion@lists.sourceforge.net, linux-crypto@vger.kernel.org, netdev@vger.kernel.org, Joe Perches , Andrew Morton , linux-wpan@vger.kernel.org, wireguard@lists.zx2c4.com, linux-ppp@vger.kernel.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 6/15/20 2:07 PM, Dan Carpenter wrote: > On Mon, Apr 13, 2020 at 05:15:49PM -0400, Waiman Long wrote: >> diff --git a/mm/slab_common.c b/mm/slab_common.c >> index 23c7500eea7d..c08bc7eb20bd 100644 >> --- a/mm/slab_common.c >> +++ b/mm/slab_common.c >> @@ -1707,17 +1707,17 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags) >> EXPORT_SYMBOL(krealloc); >> >> /** >> - * kzfree - like kfree but zero memory >> + * kfree_sensitive - Clear sensitive information in memory before freeing >> * @p: object to free memory of >> * >> * The memory of the object @p points to is zeroed before freed. >> - * If @p is %NULL, kzfree() does nothing. >> + * If @p is %NULL, kfree_sensitive() does nothing. >> * >> * Note: this function zeroes the whole allocated buffer which can be a good >> * deal bigger than the requested buffer size passed to kmalloc(). So be >> * careful when using this function in performance sensitive code. >> */ >> -void kzfree(const void *p) >> +void kfree_sensitive(const void *p) >> { >> size_t ks; >> void *mem = (void *)p; >> @@ -1725,10 +1725,10 @@ void kzfree(const void *p) >> if (unlikely(ZERO_OR_NULL_PTR(mem))) >> return; >> ks = ksize(mem); >> - memset(mem, 0, ks); >> + memzero_explicit(mem, ks); > ^^^^^^^^^^^^^^^^^^^^^^^^^ > This is an unrelated bug fix. It really needs to be pulled into a > separate patch by itself and back ported to stable kernels. > >> kfree(mem); >> } >> -EXPORT_SYMBOL(kzfree); >> +EXPORT_SYMBOL(kfree_sensitive); >> >> /** >> * ksize - get the actual amount of memory allocated for a given object > regards, > dan carpenter > Thanks for the suggestion. I will break it out and post a version soon. Cheers, Longman