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=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 5DA75C47254 for ; Fri, 1 May 2020 23:22:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1D1D8216FD for ; Fri, 1 May 2020 23:22:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="nTfYKjej" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D1D8216FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A0DA78E0005; Fri, 1 May 2020 19:22:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9BCA58E0001; Fri, 1 May 2020 19:22:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8AB948E0005; Fri, 1 May 2020 19:22:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id 731FA8E0001 for ; Fri, 1 May 2020 19:22:27 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 373836110 for ; Fri, 1 May 2020 23:22:27 +0000 (UTC) X-FDA: 76769726334.12.farm34_327c6f9ae1010 X-HE-Tag: farm34_327c6f9ae1010 X-Filterd-Recvd-Size: 3015 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Fri, 1 May 2020 23:22:26 +0000 (UTC) Received: from sol.localdomain (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8475D2166E; Fri, 1 May 2020 23:22:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588375346; bh=c2vmIQk/4SDEyjp+ex+5JL9glUnCL/yZZYv7Uw/LnVY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nTfYKjejvcpKTU8bmoZwGhKdSlpuBDhBCH/OTSaohinK1l/idP5/y7M5b6nCvQUQj vbfRRvi6ahGOrvYKiOx/dgwEShx3JlMoHQc+QLNZFculRxZLwOInwAvyg2n96UmDmx eqoBkAprwqouAwDxHAVtTmTGvMae63VlN5J1A0AA= Date: Fri, 1 May 2020 16:22:24 -0700 From: Eric Biggers To: Waiman Long 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 , Matthew Wilcox , David Rientjes Subject: Re: [PATCH v3] mm: Add kvfree_sensitive() for freeing sensitive data objects Message-ID: <20200501232224.GC915@sol.localdomain> References: <20200407200318.11711-1-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200407200318.11711-1-longman@redhat.com> 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 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