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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 60E05C2BA1B for ; Mon, 6 Apr 2020 17:22:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 26C18249EE for ; Mon, 6 Apr 2020 17:22:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26C18249EE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B23F78E0051; Mon, 6 Apr 2020 13:22:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ADEA68E000D; Mon, 6 Apr 2020 13:22:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99B058E0051; Mon, 6 Apr 2020 13:22:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0197.hostedemail.com [216.40.44.197]) by kanga.kvack.org (Postfix) with ESMTP id 7D7748E000D for ; Mon, 6 Apr 2020 13:22:25 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 32BCE181AEF1D for ; Mon, 6 Apr 2020 17:22:25 +0000 (UTC) X-FDA: 76678099050.27.park21_6c66977f7af24 X-HE-Tag: park21_6c66977f7af24 X-Filterd-Recvd-Size: 4015 Received: from smtprelay.hostedemail.com (smtprelay0190.hostedemail.com [216.40.44.190]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Mon, 6 Apr 2020 17:22:24 +0000 (UTC) Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id 9B0E52C7C; Mon, 6 Apr 2020 17:22:24 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: page92_6c1d39d59a41b X-Filterd-Recvd-Size: 2829 Received: from XPS-9350.home (unknown [47.151.136.130]) (Authenticated sender: joe@perches.com) by omf18.hostedemail.com (Postfix) with ESMTPA; Mon, 6 Apr 2020 17:22:22 +0000 (UTC) Message-ID: <7eb36a794df38c885689085618a8a4ff9df3dd2c.camel@perches.com> Subject: Re: [PATCH] mm: Add kvfree_sensitive() for freeing sensitive data objects From: Joe Perches To: Linus Torvalds Cc: David Howells , Waiman Long , Andrew Morton , Jarkko Sakkinen , James Morris , "Serge E. Hallyn" , Linux-MM , keyrings@vger.kernel.org, Linux Kernel Mailing List Date: Mon, 06 Apr 2020 10:20:24 -0700 In-Reply-To: References: <20200406023700.1367-1-longman@redhat.com> <319765.1586188840@warthog.procyon.org.uk> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, 2020-04-06 at 10:11 -0700, Linus Torvalds wrote: > On Mon, Apr 6, 2020 at 9:44 AM Joe Perches wrote: > > Dubious assertion. Both end up with zeroed memory. > > You don't understand the function. Another dubious assertion. > You ignored the part where the zeroed memory isn't even the _point_. > > Yes, for kzalloc() it is. There the zero is inherent and important. > People very much depend on it, and it's the whole point of that > function. The 'z' is not silent. > > But for kzfree() it really really isn't. There the zeroing is never > going to be seen by anybody wjho does the right thing, and is not > important at all - it's purely a "let's make sure old contents don't > leak". > > The "zero" part is completely immaterial, it could just as well have > been a "memset(0xaa)" instead. or memfill(0xdeadbeef). > And you didn't seem to understand that kzfree() shouldn't use memset() > in the first place, so it's not even using the same operation. > > You really don't seem to get the whole "kzfree() has absolutely > _nothing_ to do with kzalloc() apart from a dubious implementation > details". API function naming symmetry is good. You ignore or don't quote the kzfree/kfree_sensitive too. Yet I don't say _you_ don't understand something.