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.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 7B445C433DB for ; Mon, 8 Feb 2021 11:14:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F2C2B64E82 for ; Mon, 8 Feb 2021 11:14:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2C2B64E82 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 5F0456B0006; Mon, 8 Feb 2021 06:14:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 578B76B006C; Mon, 8 Feb 2021 06:14:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4677B6B0073; Mon, 8 Feb 2021 06:14:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0125.hostedemail.com [216.40.44.125]) by kanga.kvack.org (Postfix) with ESMTP id 2C46D6B0006 for ; Mon, 8 Feb 2021 06:14:08 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id EC202181AEF1E for ; Mon, 8 Feb 2021 11:14:07 +0000 (UTC) X-FDA: 77794841334.08.3D0AFFC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 53D1E407F8C1 for ; Mon, 8 Feb 2021 11:14:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612782847; 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=rjBhYigDjL91xEreC6QyJ/Hq5Z8K5dAmnvBeKDYfa7U=; b=e90AczawJx8pSW1PeHpMoq3ukT7qvocx5SAyi7bZilzaBD2+GapsBSzr+5jIzeiGO87gMc tImXa2FZf6SvrSxbSwDNBwfEaPWR+q2teHGLN1TnmZfyoK2lwhFuDgL59kbcdXTVRxPmpv 552bOAv72GVZDyPUUKuOb6wqI7SI6N4= 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-92-kXoN8HQDORu6M_4PkL4cIg-1; Mon, 08 Feb 2021 06:14:03 -0500 X-MC-Unique: kXoN8HQDORu6M_4PkL4cIg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A00B801976; Mon, 8 Feb 2021 11:13:58 +0000 (UTC) Received: from [10.36.113.240] (ovpn-113-240.ams2.redhat.com [10.36.113.240]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01D995C1D0; Mon, 8 Feb 2021 11:13:50 +0000 (UTC) To: Michal Hocko Cc: Mike Rapoport , Andrew Morton , Alexander Viro , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christopher Lameter , Dan Williams , Dave Hansen , Elena Reshetova , "H. Peter Anvin" , Ingo Molnar , James Bottomley , "Kirill A. Shutemov" , Matthew Wilcox , Mark Rutland , Mike Rapoport , Michael Kerrisk , Palmer Dabbelt , Paul Walmsley , Peter Zijlstra , Rick Edgecombe , Roman Gushchin , Shakeel Butt , Shuah Khan , Thomas Gleixner , Tycho Andersen , Will Deacon , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-nvdimm@lists.01.org, linux-riscv@lists.infradead.org, x86@kernel.org, Hagen Paul Pfeifer , Palmer Dabbelt References: <20210208084920.2884-1-rppt@kernel.org> <20210208084920.2884-9-rppt@kernel.org> <38c0cad4-ac55-28e4-81c6-4e0414f0620a@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Subject: Re: [PATCH v17 08/10] PM: hibernate: disable when there are active secretmem users Message-ID: <770690dc-634a-78dd-0772-3aba1a3beba8@redhat.com> Date: Mon, 8 Feb 2021 12:13:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 53D1E407F8C1 X-Stat-Signature: 34a95bi4dcce96st7rtz78fmxb3jmgc5 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=63.128.21.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1612782847-598838 Content-Transfer-Encoding: quoted-printable 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 08.02.21 11:57, Michal Hocko wrote: > On Mon 08-02-21 11:53:58, David Hildenbrand wrote: >> On 08.02.21 11:51, Michal Hocko wrote: >>> On Mon 08-02-21 11:32:11, David Hildenbrand wrote: >>>> On 08.02.21 11:18, Michal Hocko wrote: >>>>> On Mon 08-02-21 10:49:18, Mike Rapoport wrote: >>>>>> From: Mike Rapoport >>>>>> >>>>>> It is unsafe to allow saving of secretmem areas to the hibernation >>>>>> snapshot as they would be visible after the resume and this essent= ially >>>>>> will defeat the purpose of secret memory mappings. >>>>>> >>>>>> Prevent hibernation whenever there are active secret memory users. >>>>> >>>>> Does this feature need any special handling? As it is effectivelly >>>>> unevictable memory then it should behave the same as other mlock, r= amfs >>>>> which should already disable hibernation as those cannot be swapped= out, >>>>> no? >>>>> >>>> >>>> Why should unevictable memory not go to swap when hibernating? We're= merely >>>> dumping all of our system RAM (including any unmovable allocations) = to swap >>>> storage and the system is essentially completely halted. >>>> >>> My understanding is that mlock is never really made visible via swap >>> storage. >> >> "Using swap storage for hibernation" and "swapping at runtime" are two >> different things. I might be wrong, though. >=20 > Well, mlock is certainly used to keep sensitive information, not only t= o > protect from major/minor faults. >=20 I think you're right in theory, the man page mentions "Cryptographic=20 security software often handles critical bytes like passwords or secret=20 keys as data structures" ... however, I am not aware of any such swap handling and wasn't able to=20 spot it quickly. Let me take a closer look. --=20 Thanks, David / dhildenb