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=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 6D488C2D0EA for ; Wed, 8 Apr 2020 13:38:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 398D92072A for ; Wed, 8 Apr 2020 13:38:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729203AbgDHNin (ORCPT ); Wed, 8 Apr 2020 09:38:43 -0400 Received: from mga18.intel.com ([134.134.136.126]:33616 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726760AbgDHNim (ORCPT ); Wed, 8 Apr 2020 09:38:42 -0400 IronPort-SDR: qcOm9WP5R5ESi5OFgHO20ROVXOyni0jipJ2DgVeYWRaRxqPLrexL5XH12Aoj4USOtBBBmgfRgh d3L8lazbML1w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2020 06:38:42 -0700 IronPort-SDR: R22WpOEU8IKS8IgdXmswW399/H6U6WiPxgDyUhHCrxA3Ql3xyGoS+vJXGd7pEeMNTNLLln4tnj 6JsvN7gJlfHg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,358,1580803200"; d="scan'208";a="425136945" Received: from eefimov-mobl2.ger.corp.intel.com (HELO localhost) ([10.249.41.73]) by orsmga005.jf.intel.com with ESMTP; 08 Apr 2020 06:38:36 -0700 Date: Wed, 8 Apr 2020 16:38:35 +0300 From: Jarkko Sakkinen To: Waiman Long Cc: Andrew Morton , David Howells , 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: <20200408133835.GA4097@linux.intel.com> 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> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Jarkko Sakkinen David, you want to pick this one? /Jarkko