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,UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 9C69FC433DF for ; Mon, 15 Jun 2020 19:11:12 +0000 (UTC) Received: from isis.lip6.fr (isis.lip6.fr [132.227.60.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 1230420739 for ; Mon, 15 Jun 2020 19:11:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ksIm2T40" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1230420739 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=cocci-bounces@systeme.lip6.fr Received: from systeme.lip6.fr (systeme.lip6.fr [132.227.104.7]) by isis.lip6.fr (8.15.2/8.15.2) with ESMTP id 05FJAt9n014954; Mon, 15 Jun 2020 21:10:55 +0200 (CEST) Received: from systeme.lip6.fr (systeme.lip6.fr [127.0.0.1]) by systeme.lip6.fr (Postfix) with ESMTP id 6454A7577; Mon, 15 Jun 2020 21:10:55 +0200 (CEST) Received: from isis.lip6.fr (isis.lip6.fr [132.227.60.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by systeme.lip6.fr (Postfix) with ESMTPS id 9CDE5402B for ; Mon, 15 Jun 2020 20:09:39 +0200 (CEST) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by isis.lip6.fr (8.15.2/8.15.2) with ESMTPS id 05FI9bPt024574 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 15 Jun 2020 20:09:38 +0200 (CEST) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05FI7hca026496; Mon, 15 Jun 2020 18:08:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=EdV85x/l0ZQB7qs/RGol05XelTO/TGwy+i5Nwcf8gRM=; b=ksIm2T40o14OrDnPOVl41oLfXflESyB3DKHmSrY07W8hiE/Z7QLC5o1aUTaHPRbSwzbu 9c0NwLH9cAIIrEop8mGTFh8G1XGbz9PddITo/iGjFqouwLRZRmyMPkuv312Tprpn0qqE vsgCBz56dXPpSbVxKCQXClzuApbPztWVszZo40Z9/pDvMf5EwgQrvvf51uoX9UnrZp3o w/4xkBk0XXZDlc2YcrCzTOExgRGYIv3Y4giKzpy8SzyD0DJs8FkiFKoy2usbln1dH7C7 /e2gagyqK7O847BIeVNSzHbKNPgl/68telPWwh1LacJqZVCnTiRrQlKn7a2GbDXIJ48j 0Q== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 31p6s22cke-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 Jun 2020 18:08:31 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05FHwvkZ051587; Mon, 15 Jun 2020 18:08:30 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 31p6de1e1n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 15 Jun 2020 18:08:30 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 05FI8G7g031730; Mon, 15 Jun 2020 18:08:17 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 15 Jun 2020 11:08:15 -0700 Date: Mon, 15 Jun 2020 21:07:53 +0300 From: Dan Carpenter To: Waiman Long Message-ID: <20200615180753.GJ4151@kadam> References: <20200413211550.8307-1-longman@redhat.com> <20200413211550.8307-2-longman@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200413211550.8307-2-longman@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9653 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=930 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006150134 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9653 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 clxscore=1011 mlxscore=0 mlxlogscore=944 priorityscore=1501 phishscore=0 malwarescore=0 suspectscore=2 spamscore=0 cotscore=-2147483648 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006150135 X-Greylist: Sender IP whitelisted, Sender e-mail whitelisted, not delayed by milter-greylist-4.4.3 (isis.lip6.fr [132.227.60.2]); Mon, 15 Jun 2020 21:10:55 +0200 (CEST) X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.4.3 (isis.lip6.fr [132.227.60.2]); Mon, 15 Jun 2020 20:09:39 +0200 (CEST) X-Scanned-By: MIMEDefang 2.78 on 132.227.60.2 X-Scanned-By: MIMEDefang 2.78 on 132.227.60.2 X-Mailman-Approved-At: Mon, 15 Jun 2020 21:10:54 +0200 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 Subject: Re: [Cocci] [PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive() X-BeenThere: cocci@systeme.lip6.fr X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: cocci-bounces@systeme.lip6.fr Errors-To: cocci-bounces@systeme.lip6.fr 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 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: Re: [PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive() Date: Mon, 15 Jun 2020 21:07:53 +0300 Message-ID: <20200615180753.GJ4151@kadam> 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-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20200413211550.8307-2-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+glpam-linux-mediatek=m.gmane-mx.org-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org To: Waiman Long Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Jarkko Sakkinen , virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, David Howells , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, linux-sctp-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, target-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kasan-dev-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, cocci-/FJkirnvOdkvYVN+rsErww@public.gmane.org, devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org, linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, James Morris , Matthew Wilcox , linux-stm32-XDFAJ8BFU24N7RejjzZ/Li2xQDfSxrLKVpNB7YpNyf8@public.gmane.org, intel-wired-lan-qjLDD68F18P21nG7glBr7A@public.gmane.org, David Rientjes , "Serge E. Hallyn" , linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, ecryptfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, linux-fscrypt-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-integrity-u79uwXL29TZNg+MwTxZMZA@public.gmane.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Mon, 15 Jun 2020 21:07:53 +0300 Subject: [Intel-wired-lan] [PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive() In-Reply-To: <20200413211550.8307-2-longman@redhat.com> References: <20200413211550.8307-1-longman@redhat.com> <20200413211550.8307-2-longman@redhat.com> Message-ID: <20200615180753.GJ4151@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: intel-wired-lan@osuosl.org List-ID: 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Mon, 15 Jun 2020 18:07:53 +0000 Subject: Re: [PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive() Message-Id: <20200615180753.GJ4151@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit List-Id: References: <20200413211550.8307-1-longman@redhat.com> <20200413211550.8307-2-longman@redhat.com> In-Reply-To: <20200413211550.8307-2-longman@redhat.com> To: Waiman Long 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 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 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.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED,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 959F0C433DF for ; Mon, 15 Jun 2020 18:09:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 58E552080D for ; Mon, 15 Jun 2020 18:09:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LBQKrEpP"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ksIm2T40" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 58E552080D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zg/gT4LLKE3veKsEzhQnS9H3+zi29NJdRcM52PNT3Ow=; b=LBQKrEpPGFIIrr d3ATB9+TsqSd8PP29RALOE4kDzLbFodsFf0m1KGlW+jURXNPblcomvFyqxxkicB364o+f54hK4nbH oj4ZthL+81sIr1gN/X3ZzSg8D/k/Jx+sBpBK4Po6/3jpJcc7LhVuROE6gG6c4sVr+OU9TFUYn2mNb y6X9VRJVkvInSzeXfHUiwQXSYFp5fKOvWcCIFuHemkg1o/ZUjJPoJVa8+g96NRk5M1fB4LOcvEXaT NV4h/xbxDPF4sTMvUzrhG/4MLVzgdd0UWrn8kfulBgUEFOOO/ziMnnG1SX9sZur5HznLnUyYectda Tnfgu6Uikp6u+VhmWsOA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jktXV-0006va-Ss; Mon, 15 Jun 2020 18:08:57 +0000 Received: from userp2130.oracle.com ([156.151.31.86]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jktXS-0006ts-CE; Mon, 15 Jun 2020 18:08:55 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05FI7hca026496; Mon, 15 Jun 2020 18:08:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=EdV85x/l0ZQB7qs/RGol05XelTO/TGwy+i5Nwcf8gRM=; b=ksIm2T40o14OrDnPOVl41oLfXflESyB3DKHmSrY07W8hiE/Z7QLC5o1aUTaHPRbSwzbu 9c0NwLH9cAIIrEop8mGTFh8G1XGbz9PddITo/iGjFqouwLRZRmyMPkuv312Tprpn0qqE vsgCBz56dXPpSbVxKCQXClzuApbPztWVszZo40Z9/pDvMf5EwgQrvvf51uoX9UnrZp3o w/4xkBk0XXZDlc2YcrCzTOExgRGYIv3Y4giKzpy8SzyD0DJs8FkiFKoy2usbln1dH7C7 /e2gagyqK7O847BIeVNSzHbKNPgl/68telPWwh1LacJqZVCnTiRrQlKn7a2GbDXIJ48j 0Q== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 31p6s22cke-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 Jun 2020 18:08:31 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05FHwvkZ051587; Mon, 15 Jun 2020 18:08:30 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 31p6de1e1n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 15 Jun 2020 18:08:30 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 05FI8G7g031730; Mon, 15 Jun 2020 18:08:17 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 15 Jun 2020 11:08:15 -0700 Date: Mon, 15 Jun 2020 21:07:53 +0300 From: Dan Carpenter To: Waiman Long Subject: Re: [PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive() Message-ID: <20200615180753.GJ4151@kadam> References: <20200413211550.8307-1-longman@redhat.com> <20200413211550.8307-2-longman@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200413211550.8307-2-longman@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9653 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=930 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006150134 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9653 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 clxscore=1011 mlxscore=0 mlxlogscore=944 priorityscore=1501 phishscore=0 malwarescore=0 suspectscore=2 spamscore=0 cotscore=-2147483648 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006150135 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200615_110854_559395_8D04426C X-CRM114-Status: GOOD ( 16.96 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic 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.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,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 69CF8C433E1 for ; Mon, 15 Jun 2020 18:09:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4524F2080D for ; Mon, 15 Jun 2020 18:09:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ksIm2T40" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731179AbgFOSJm (ORCPT ); Mon, 15 Jun 2020 14:09:42 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:55738 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728585AbgFOSJm (ORCPT ); Mon, 15 Jun 2020 14:09:42 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05FI7hca026496; Mon, 15 Jun 2020 18:08:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=EdV85x/l0ZQB7qs/RGol05XelTO/TGwy+i5Nwcf8gRM=; b=ksIm2T40o14OrDnPOVl41oLfXflESyB3DKHmSrY07W8hiE/Z7QLC5o1aUTaHPRbSwzbu 9c0NwLH9cAIIrEop8mGTFh8G1XGbz9PddITo/iGjFqouwLRZRmyMPkuv312Tprpn0qqE vsgCBz56dXPpSbVxKCQXClzuApbPztWVszZo40Z9/pDvMf5EwgQrvvf51uoX9UnrZp3o w/4xkBk0XXZDlc2YcrCzTOExgRGYIv3Y4giKzpy8SzyD0DJs8FkiFKoy2usbln1dH7C7 /e2gagyqK7O847BIeVNSzHbKNPgl/68telPWwh1LacJqZVCnTiRrQlKn7a2GbDXIJ48j 0Q== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 31p6s22cke-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 Jun 2020 18:08:31 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05FHwvkZ051587; Mon, 15 Jun 2020 18:08:30 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 31p6de1e1n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 15 Jun 2020 18:08:30 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 05FI8G7g031730; Mon, 15 Jun 2020 18:08:17 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 15 Jun 2020 11:08:15 -0700 Date: Mon, 15 Jun 2020 21:07:53 +0300 From: Dan Carpenter To: Waiman Long Cc: Andrew Morton , David Howells , Jarkko Sakkinen , James Morris , "Serge E. Hallyn" , Linus Torvalds , Joe Perches , Matthew Wilcox , David Rientjes , samba-technical@lists.samba.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, linux-sctp@vger.kernel.org, target-devel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, devel@driverdev.osuosl.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, x86@kernel.org, kasan-dev@googlegroups.com, cocci@systeme.lip6.fr, linux-wpan@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-crypto@vger.kernel.org, linux-pm@vger.kernel.org, ecryptfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-cifs@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.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, wireguard@lists.zx2c4.com, linux-ppp@vger.kernel.org, linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-btrfs@vger.kernel.org Subject: Re: [PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive() Message-ID: <20200615180753.GJ4151@kadam> 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> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9653 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=930 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006150134 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9653 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 clxscore=1011 mlxscore=0 mlxlogscore=944 priorityscore=1501 phishscore=0 malwarescore=0 suspectscore=2 spamscore=0 cotscore=-2147483648 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006150135 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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 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.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=ham 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 29F78C433E0 for ; Mon, 15 Jun 2020 18:09:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 DEBFC2080D for ; Mon, 15 Jun 2020 18:09:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="N/bV06Ug"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ksIm2T40" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DEBFC2080D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=126jVklmuqdvgCrIDzstgeRP5WNlNXjZ42HK1ZylNCo=; b=N/bV06UgqfgSBU F+KY2Nc8YiVJVSZcOsvJi/Nm9Dp36IzNYwzu4GuxEliWd7CY9OTmXhb2Io6DtIlIAofKIz+hTquKY 2D+N15vOezMqQsVwxUuo19mrQvRzAwP6GDc0ZmNgAJxgxQT7dkG4cn6iv+izMyh3Yrs+S1AyaspMH HTxXe36I/5gOB3a/c2O7BFQ+j2naU5Ie1Laz9F6I81MXt6xRHZFcwASsT1rZLKINKf9QaZh+RXFgo /VJ0F0VGzcMYpMGuZqKdvcwS5lNW1MCLOuu0svP+QXfE7VSVE0tfHPb85JG4bWdgTn2kUyMg2DxW7 pypcLBeptbcXfErPwMdA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jktXV-0006un-B4; Mon, 15 Jun 2020 18:08:57 +0000 Received: from userp2130.oracle.com ([156.151.31.86]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jktXS-0006ts-CE; Mon, 15 Jun 2020 18:08:55 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05FI7hca026496; Mon, 15 Jun 2020 18:08:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=EdV85x/l0ZQB7qs/RGol05XelTO/TGwy+i5Nwcf8gRM=; b=ksIm2T40o14OrDnPOVl41oLfXflESyB3DKHmSrY07W8hiE/Z7QLC5o1aUTaHPRbSwzbu 9c0NwLH9cAIIrEop8mGTFh8G1XGbz9PddITo/iGjFqouwLRZRmyMPkuv312Tprpn0qqE vsgCBz56dXPpSbVxKCQXClzuApbPztWVszZo40Z9/pDvMf5EwgQrvvf51uoX9UnrZp3o w/4xkBk0XXZDlc2YcrCzTOExgRGYIv3Y4giKzpy8SzyD0DJs8FkiFKoy2usbln1dH7C7 /e2gagyqK7O847BIeVNSzHbKNPgl/68telPWwh1LacJqZVCnTiRrQlKn7a2GbDXIJ48j 0Q== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 31p6s22cke-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 Jun 2020 18:08:31 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05FHwvkZ051587; Mon, 15 Jun 2020 18:08:30 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 31p6de1e1n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 15 Jun 2020 18:08:30 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 05FI8G7g031730; Mon, 15 Jun 2020 18:08:17 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 15 Jun 2020 11:08:15 -0700 Date: Mon, 15 Jun 2020 21:07:53 +0300 From: Dan Carpenter To: Waiman Long Subject: Re: [PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive() Message-ID: <20200615180753.GJ4151@kadam> References: <20200413211550.8307-1-longman@redhat.com> <20200413211550.8307-2-longman@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200413211550.8307-2-longman@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9653 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=930 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006150134 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9653 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 clxscore=1011 mlxscore=0 mlxlogscore=944 priorityscore=1501 phishscore=0 malwarescore=0 suspectscore=2 spamscore=0 cotscore=-2147483648 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006150135 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200615_110854_559395_8D04426C X-CRM114-Status: GOOD ( 16.96 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek 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,UNPARSEABLE_RELAY,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 30411C433E0 for ; Mon, 15 Jun 2020 18:11:02 +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 D0F1E2080D for ; Mon, 15 Jun 2020 18:11:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ksIm2T40" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D0F1E2080D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.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 49lzsb5S8VzDqdV for ; Tue, 16 Jun 2020 04:10:59 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=oracle.com (client-ip=156.151.31.86; helo=userp2130.oracle.com; envelope-from=dan.carpenter@oracle.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2020-01-29 header.b=ksIm2T40; dkim-atps=neutral Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (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 49lzqL3bF7zDqM9 for ; Tue, 16 Jun 2020 04:09:01 +1000 (AEST) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05FI7hca026496; Mon, 15 Jun 2020 18:08:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=EdV85x/l0ZQB7qs/RGol05XelTO/TGwy+i5Nwcf8gRM=; b=ksIm2T40o14OrDnPOVl41oLfXflESyB3DKHmSrY07W8hiE/Z7QLC5o1aUTaHPRbSwzbu 9c0NwLH9cAIIrEop8mGTFh8G1XGbz9PddITo/iGjFqouwLRZRmyMPkuv312Tprpn0qqE vsgCBz56dXPpSbVxKCQXClzuApbPztWVszZo40Z9/pDvMf5EwgQrvvf51uoX9UnrZp3o w/4xkBk0XXZDlc2YcrCzTOExgRGYIv3Y4giKzpy8SzyD0DJs8FkiFKoy2usbln1dH7C7 /e2gagyqK7O847BIeVNSzHbKNPgl/68telPWwh1LacJqZVCnTiRrQlKn7a2GbDXIJ48j 0Q== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 31p6s22cke-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 Jun 2020 18:08:31 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05FHwvkZ051587; Mon, 15 Jun 2020 18:08:30 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 31p6de1e1n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 15 Jun 2020 18:08:30 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 05FI8G7g031730; Mon, 15 Jun 2020 18:08:17 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 15 Jun 2020 11:08:15 -0700 Date: Mon, 15 Jun 2020 21:07:53 +0300 From: Dan Carpenter To: Waiman Long Subject: Re: [PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive() Message-ID: <20200615180753.GJ4151@kadam> 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> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9653 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=930 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006150134 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9653 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 clxscore=1011 mlxscore=0 mlxlogscore=944 priorityscore=1501 phishscore=0 malwarescore=0 suspectscore=2 spamscore=0 cotscore=-2147483648 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006150135 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 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 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.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=ham 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 26EDCC433DF for ; Mon, 15 Jun 2020 18:09:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 E319B2080D for ; Mon, 15 Jun 2020 18:09:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VF4noTAI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ksIm2T40" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E319B2080D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lyr2h31d5yYG/FLnbJCzTr+V/ihMjavpYSknMXP35Yc=; b=VF4noTAI+TSYsu ylw5W2hVizVrr/6qSSydp1XLjvSAXs9rVxm9ibCwyYXq4BQaEFE60Bczo6Fz71PNvvUb//nym0QPQ URztNjwZdvqKTKIIus80To/oTKhduRZYgkl8cTYbHJ7jmu7LKXucgUO8PXM9dFOiGJfPpN+ZJ6w1d G2dZrUW76Jozi8s4cwUjJKAW9oHXfW9Gc7JJ9DRpDkVCJCCsljqzJvKtoW73DFmglTRyM1acrdegu ycmPptxc1fOSakFdPxVcXejVoRms8IaT6OjtRI4qV0ZBtIGxBDYmb61DYxNJ0Md8nJdNGopK9SlnE hXtfAD7r2NtQ3sCGanxA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jktXX-0006wK-9M; Mon, 15 Jun 2020 18:08:59 +0000 Received: from userp2130.oracle.com ([156.151.31.86]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jktXS-0006ts-CE; Mon, 15 Jun 2020 18:08:55 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05FI7hca026496; Mon, 15 Jun 2020 18:08:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=EdV85x/l0ZQB7qs/RGol05XelTO/TGwy+i5Nwcf8gRM=; b=ksIm2T40o14OrDnPOVl41oLfXflESyB3DKHmSrY07W8hiE/Z7QLC5o1aUTaHPRbSwzbu 9c0NwLH9cAIIrEop8mGTFh8G1XGbz9PddITo/iGjFqouwLRZRmyMPkuv312Tprpn0qqE vsgCBz56dXPpSbVxKCQXClzuApbPztWVszZo40Z9/pDvMf5EwgQrvvf51uoX9UnrZp3o w/4xkBk0XXZDlc2YcrCzTOExgRGYIv3Y4giKzpy8SzyD0DJs8FkiFKoy2usbln1dH7C7 /e2gagyqK7O847BIeVNSzHbKNPgl/68telPWwh1LacJqZVCnTiRrQlKn7a2GbDXIJ48j 0Q== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 31p6s22cke-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 Jun 2020 18:08:31 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05FHwvkZ051587; Mon, 15 Jun 2020 18:08:30 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 31p6de1e1n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 15 Jun 2020 18:08:30 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 05FI8G7g031730; Mon, 15 Jun 2020 18:08:17 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 15 Jun 2020 11:08:15 -0700 Date: Mon, 15 Jun 2020 21:07:53 +0300 From: Dan Carpenter To: Waiman Long Subject: Re: [PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive() Message-ID: <20200615180753.GJ4151@kadam> References: <20200413211550.8307-1-longman@redhat.com> <20200413211550.8307-2-longman@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200413211550.8307-2-longman@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9653 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=930 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006150134 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9653 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 clxscore=1011 mlxscore=0 mlxlogscore=944 priorityscore=1501 phishscore=0 malwarescore=0 suspectscore=2 spamscore=0 cotscore=-2147483648 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006150135 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200615_110854_559395_8D04426C X-CRM114-Status: GOOD ( 16.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel