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.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 4817AC28CBC for ; Mon, 4 May 2020 02:57:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F02DD206EB for ; Mon, 4 May 2020 02:57:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LfAEUAqX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F02DD206EB 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 84EA58E0005; Sun, 3 May 2020 22:57:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7FF7F8E0001; Sun, 3 May 2020 22:57:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 714D58E0005; Sun, 3 May 2020 22:57:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 561238E0001 for ; Sun, 3 May 2020 22:57:31 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0D4F23D15 for ; Mon, 4 May 2020 02:57:31 +0000 (UTC) X-FDA: 76777525902.19.bears52_7614073e4249 X-HE-Tag: bears52_7614073e4249 X-Filterd-Recvd-Size: 4075 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 May 2020 02:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588561050; 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=gF7rcvELgQd39eUzjQBEmRMoEPlsByjPKGkWb8q9nQI=; b=LfAEUAqXuZ3IjTdrmIupTzbiBW5P5n8b6jj/7ComDDPwOUkzxytp/nxBelxJw2sRF+c322 bzruhw7d0e+T13mWzZe6khJ0ZoCuVH0qfCUL3sUdoAVvdMFaLNMjdrYB1U0hk3ZJg0Bh/1 XULesRM9VWz6VMDB9BTkM875Kk9qTws= 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-124-aDfPBMSwPrKk4IKjU-8VMQ-1; Sun, 03 May 2020 22:57:28 -0400 X-MC-Unique: aDfPBMSwPrKk4IKjU-8VMQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5EC57107ACCA; Mon, 4 May 2020 02:57:26 +0000 (UTC) Received: from llong.remote.csb (ovpn-112-227.rdu2.redhat.com [10.10.112.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA5B860BF3; Mon, 4 May 2020 02:57:23 +0000 (UTC) Subject: Re: [PATCH v3] mm: Add kvfree_sensitive() for freeing sensitive data objects To: Andrew Morton Cc: Eric Biggers , 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 , Matthew Wilcox , David Rientjes References: <20200407200318.11711-1-longman@redhat.com> <20200501232224.GC915@sol.localdomain> From: Waiman Long Organization: Red Hat Message-ID: <82fbc32f-3f9e-b876-b998-7714e8597988@redhat.com> Date: Sun, 3 May 2020 22:57:23 -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: <20200501232224.GC915@sol.localdomain> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 5/1/20 7:22 PM, Eric Biggers wrote: > On Tue, Apr 07, 2020 at 04:03:18PM -0400, Waiman Long wrote: >> For kvmalloc'ed data object that contains sensitive information like >> cryptographic key, we need to make sure that the buffer is always >> cleared before freeing it. Using memset() alone for buffer clearing may >> not provide certainty as the compiler may compile it away. To be sure, >> the special memzero_explicit() has to be used. >> >> This patch introduces a new kvfree_sensitive() for freeing those >> sensitive data objects allocated by kvmalloc(). The relevnat places >> where kvfree_sensitive() can be used are modified to use it. >> >> Fixes: 4f0882491a14 ("KEYS: Avoid false positive ENOMEM error on key read") >> Suggested-by: Linus Torvalds >> Signed-off-by: Waiman Long > Looks good, feel free to add: > > Reviewed-by: Eric Biggers > > (I don't really buy the argument that the compiler could compile away memset() > before kvfree(). But I agree with using memzero_explicit() anyway to make the > intent explicit.) > > I don't see this patch in linux-next yet. Who is planning to take this patch? > Presumably David through the keyrings tree, or Andrew through mm? > > - Eric > Andrew, would you mind taking this patch into the mm-tree? Thanks, Longman