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.8 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 92BEDC2D0EC for ; Tue, 7 Apr 2020 21:31:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4FE8C20730 for ; Tue, 7 Apr 2020 21:31:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="IG+R0/ry" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FE8C20730 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 0634D8E001F; Tue, 7 Apr 2020 17:31:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 039DB8E0001; Tue, 7 Apr 2020 17:31:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E6ACF8E001F; Tue, 7 Apr 2020 17:31:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) by kanga.kvack.org (Postfix) with ESMTP id CF3878E0001 for ; Tue, 7 Apr 2020 17:31:17 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 95431A8FD for ; Tue, 7 Apr 2020 21:31:17 +0000 (UTC) X-FDA: 76682354994.23.suit58_b3e97c16dc46 X-HE-Tag: suit58_b3e97c16dc46 X-Filterd-Recvd-Size: 4618 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Apr 2020 21:31:17 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id b1so5424404ljp.3 for ; Tue, 07 Apr 2020 14:31:17 -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=iaANTB9nNT6txCWkp5q0unn31Ph9MDDOGwo0378128g=; b=IG+R0/ryQyxsm3aoO9zzMJijTHkszFi1ngFSZdu48/cZWTT+aLwliZsS6eelWRzhug Y4uVdfeOZeYoqfZDuNzkFzie3apptpcnSHImYRC3jQuhjNBu1vpBPHVxFh8BADZ/HBCH KHCUUNqVfwbgte5zG7M9cn/4DkmoO81yuy+s8= 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=iaANTB9nNT6txCWkp5q0unn31Ph9MDDOGwo0378128g=; b=tWU4MjjF0guCLkWmgNceKBKiINqPAdzAeI2BeYveMJDxc5AcD0BTJUmcteoaq2ADb1 aoG92LEjoXBgvy9fRvYQhGnueY2S9Srb3Ez1eISXntYh1OEvstISgb6kEwEdHrUV91zi ZRJtKC88Zznsjl7bntBKuTE8/QjwegKdY3vD2vZwEV2p3Dbw9xJt4Dq5fNrGrvpKFXpb ZSaRGtu5uTuluKEH1Hcr2nVNs/nrrSwY7kdPWhkjkdkkxjS2vugvSCpIADmWYYhFtRR1 p3Dk2lGzd+KWfov3SX0uf5DcohpPx7tE8vVFLlhVpuoZcd4AJ8AL2nKij2Opr6oKC4fU JcIw== X-Gm-Message-State: AGi0Pua2yuDvvOP27KkhEKgk1JXF8lnEdOJJ5AaTKlPq2Rc3udgSMS/w pLPADweUF4bPbGr5jkeESZeoynOE5v4= X-Google-Smtp-Source: APiQypLG9myqZIuk9lzCKnz62/IKznf8P9+FQ7hvtKklRdCmzEv4eunixj/9sjl1fFKQby3NPDBJlg== X-Received: by 2002:a2e:8ec2:: with SMTP id e2mr2849357ljl.252.1586295075163; Tue, 07 Apr 2020 14:31:15 -0700 (PDT) Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com. [209.85.167.46]) by smtp.gmail.com with ESMTPSA id t81sm7194476lff.52.2020.04.07.14.31.13 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Apr 2020 14:31:13 -0700 (PDT) Received: by mail-lf1-f46.google.com with SMTP id f8so3504022lfe.12 for ; Tue, 07 Apr 2020 14:31:13 -0700 (PDT) X-Received: by 2002:ac2:4466:: with SMTP id y6mr2619685lfl.125.1586295072951; Tue, 07 Apr 2020 14:31:12 -0700 (PDT) MIME-Version: 1.0 References: <20200407200318.11711-1-longman@redhat.com> <0fe5dcaf078be61ef21c7f18b750c5dc14c69dd7.camel@perches.com> <67c51b03-192c-3006-5071-452f351aee67@redhat.com> <20200407212447.GA29554@pc636> In-Reply-To: <20200407212447.GA29554@pc636> From: Linus Torvalds Date: Tue, 7 Apr 2020 14:30:56 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] mm: Add kvfree_sensitive() for freeing sensitive data objects To: Uladzislau Rezki Cc: Waiman Long , Joe Perches , Andrew Morton , David Howells , Jarkko Sakkinen , James Morris , "Serge E. Hallyn" , Linux-MM , keyrings@vger.kernel.org, Linux Kernel Mailing List , Matthew Wilcox , David Rientjes 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 Tue, Apr 7, 2020 at 2:25 PM Uladzislau Rezki wrote: > > Seems like there is only one place where we can "sleep". I mean when we > call vfree(). That is free_vmap_area_noflush() -> try_purge_vmap_area_lazy(). > Basically try_purge_vmap_area_lazy() can call the schedule() what is not > allowed for IRQs. Instead of inlining the try_purge_vmap_area_lazy() > into current context we can schedule_work(). And i think it makes sense > from many point of views. I don't think that's the only case. Or rather, that may be the only case of _sleeping_, but we also aren't irq-safe wrt locking. And I'm not just talking about the vmap_purge_lock mutex, but all the spinlocks etc we have. That said, I haven't looked at that code in _ages_. Maybe those things would be trivial to just turn into irq-safe ones and there are no real latency issues anywhere. Linus