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.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 877FDC2BA1B for ; Mon, 6 Apr 2020 18:06:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5428A206F5 for ; Mon, 6 Apr 2020 18:06:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="hycTOvQu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5428A206F5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E5D878E000F; Mon, 6 Apr 2020 14:06:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE6D38E000D; Mon, 6 Apr 2020 14:06:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C87A98E000F; Mon, 6 Apr 2020 14:06:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0200.hostedemail.com [216.40.44.200]) by kanga.kvack.org (Postfix) with ESMTP id AB2CF8E000D for ; Mon, 6 Apr 2020 14:06:22 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6E56D3A92 for ; Mon, 6 Apr 2020 18:06:22 +0000 (UTC) X-FDA: 76678209804.19.grape95_379a1e782d01b X-HE-Tag: grape95_379a1e782d01b X-Filterd-Recvd-Size: 4469 Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Mon, 6 Apr 2020 18:06:21 +0000 (UTC) Received: by mail-lj1-f196.google.com with SMTP id t17so654980ljc.12 for ; Mon, 06 Apr 2020 11:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BisFcRtdDqZDWx9x/qe3YqGCVBMdPDBaYv2iQPpKZGk=; b=hycTOvQuFUOqWorRTq3COTwoQhv5QArTInVPi3BJzNZEYA8ClFHnf/Pog4SwnExpqW O0t2iPzj1sC3CqfuWGAAmBs3m/sWjxm/70oydN4qonvFZVSKIYy24kF2rhRlFk/itgBj OXm3JM0/7A+VH/EVB7RjlP5C0H9ZpQ3DCrkLc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BisFcRtdDqZDWx9x/qe3YqGCVBMdPDBaYv2iQPpKZGk=; b=dgtqd0FJ/w1IT2lhlk0maNz01jkyR4cWqzV27Nlv1+VuLrzo6golgcLWj1WvCtHmxa IFpLhzDnR64Jq3lTbyLYM2Z8J/C1ToE2VW8c2wOuOpEppJ4cLS4Lfeg94spu38/FLHbs q9Xzt9nvju1E5OwRSt5L6ePl9D3/z0POcRgFdgN6R3nwvkOmfAdpY3YMp4jRyRuSeXNI 9isbpObDjbwhBvRxb5ku9oFZOd8tQXenuWvkCphDTHyONa9iCvIx0BYpEMzu4dYlEirh dslEC6nOdKMBYLi6NA8BpXK0lDHbwLKIVW0IGCBBptzNkJtpx6cb9P1e4xrG6J4vnU/h B73w== X-Gm-Message-State: AGi0PuaIMyGrDLEjaHKYjI+iw2+a9uhE/B1LVuXtH80405SSxS5d6rVs Cu0dStSZaYEGnAG3rn5ASieQYct0Uac= X-Google-Smtp-Source: APiQypLE6tjiiJBFXhWNqHTYjSNM+mZK4QMgwczeGxmQ4upPqcZq8+3wY8V8S6byADcxkH5+HivLhw== X-Received: by 2002:a2e:8093:: with SMTP id i19mr319270ljg.12.1586196379913; Mon, 06 Apr 2020 11:06:19 -0700 (PDT) Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com. [209.85.208.172]) by smtp.gmail.com with ESMTPSA id n23sm10278569lji.59.2020.04.06.11.06.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Apr 2020 11:06:18 -0700 (PDT) Received: by mail-lj1-f172.google.com with SMTP id q19so677289ljp.9 for ; Mon, 06 Apr 2020 11:06:18 -0700 (PDT) X-Received: by 2002:a2e:9b8e:: with SMTP id z14mr319344lji.150.1586196377903; Mon, 06 Apr 2020 11:06:17 -0700 (PDT) MIME-Version: 1.0 References: <20200406023700.1367-1-longman@redhat.com> <319765.1586188840@warthog.procyon.org.uk> <19cbf3b1-2c3f-dd0f-a5c6-69ca3f77dd68@redhat.com> In-Reply-To: <19cbf3b1-2c3f-dd0f-a5c6-69ca3f77dd68@redhat.com> From: Linus Torvalds Date: Mon, 6 Apr 2020 11:06:02 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm: Add kvfree_sensitive() for freeing sensitive data objects To: Waiman Long Cc: Joe Perches , David Howells , Andrew Morton , Jarkko Sakkinen , James Morris , "Serge E. Hallyn" , Linux-MM , keyrings@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" 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, Apr 6, 2020 at 10:59 AM Waiman Long wrote: > > I have actually been thinking about that. I saw a couple of cases in the > crypto code where a memzero_explicit() is followed by kfree(). Those can > be replaced by kfree_sensitive. Ack. Doing that (and renaming kvzfree) should be a fairly straightforward coccinelle patch. Somebody (maybe you) asked whether we could just use kvfree_sensitive() for everything, We probably could. The extra test is cheap - much cheaper than the memzero_explicit(). That said, _there_ I think that consistency with regular kfree/kvfree naming means that we might as well keep separate names, and keep the kmalloc->kfree_sensitive and kvmalloc->kvfree_sensitive pairing. Even if technically we could do with just the one function that works for both cases. Linus