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=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 162A1C2D0EC for ; Tue, 7 Apr 2020 20:08:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C0EC42074B for ; Tue, 7 Apr 2020 20:08:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AzmsIQiT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0EC42074B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6BCE48E0011; Tue, 7 Apr 2020 16:08:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 66D418E0001; Tue, 7 Apr 2020 16:08:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55C198E0011; Tue, 7 Apr 2020 16:08:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id 3A48F8E0001 for ; Tue, 7 Apr 2020 16:08:09 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id EBEC6180AD802 for ; Tue, 7 Apr 2020 20:08:08 +0000 (UTC) X-FDA: 76682145456.01.cook27_ce6e24a73f29 X-HE-Tag: cook27_ce6e24a73f29 X-Filterd-Recvd-Size: 3822 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Apr 2020 20:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586290087; 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=pN+gkxMesJKsy+L8oStv/TkSI0ntYQt3xD3UKdBvVD0=; b=AzmsIQiTR2h8Z0cEaMB3AGuPdtXiUiwky0A5F7bWKOugWR1cod1b3y1WOnZaVCXd7A+7Vk 6yrI3gpnG/WRFhPs8+Iu1bRR6X5OAHVAoL6b1rTsHgdrPWdPI8+GD9yOeb+ENLxqhGaQXe a+/CNMOXGTiVksn12C/mCuv8PoNQM4s= 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-384-6pjcTtFVMvC_rgW4P24pzQ-1; Tue, 07 Apr 2020 16:08:05 -0400 X-MC-Unique: 6pjcTtFVMvC_rgW4P24pzQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E0535107ACC9; Tue, 7 Apr 2020 20:08:03 +0000 (UTC) Received: from llong.remote.csb (ovpn-117-180.rdu2.redhat.com [10.10.117.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06F3C385; Tue, 7 Apr 2020 20:07:58 +0000 (UTC) Subject: Re: [PATCH v2] mm: Add kvfree_sensitive() for freeing sensitive data objects To: Matthew Wilcox Cc: Andrew Morton , David Howells , Jarkko Sakkinen , James Morris , "Serge E. Hallyn" , linux-mm@kvack.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds , Joe Perches , David Rientjes References: <20200406185827.22249-1-longman@redhat.com> <20200406200016.GJ21484@bombadil.infradead.org> From: Waiman Long Organization: Red Hat Message-ID: Date: Tue, 7 Apr 2020 16:07:58 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20200406200016.GJ21484@bombadil.infradead.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 4/6/20 4:00 PM, Matthew Wilcox wrote: > On Mon, Apr 06, 2020 at 02:58:27PM -0400, Waiman Long wrote: >> +/** >> + * kvfree_sensitive - free a data object containing sensitive information >> + * @addr - address of the data object to be freed >> + * @len - length of the data object > Did you try building this with W=1? I believe this is incorrect kerneldoc. > It should be @addr: and @len: > > Also, it reads better in the htmldocs if you capitalise the first letter > of each sentence and finish with a full stop. > You are right. I use the wrong delimiter here. I just send out a v3 patch to fix that. Thanks for noticing it. >> @@ -914,7 +911,7 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen) >> */ >> if (ret > key_data_len) { >> if (unlikely(key_data)) >> - __kvzfree(key_data, key_data_len); >> + kvfree_sensitive(key_data, key_data_len); > I'd drop the test of key_data here. > I would like to keep the unlikely tag here to emphaize the fact that this path should not be taken. I have comments up a few lines to talk about it, though it didn't show up in the diff. Cheers, Longman