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=-1.0 required=3.0 tests=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 4E30DC433E0 for ; Tue, 7 Jul 2020 07:40:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1B042206E2 for ; Tue, 7 Jul 2020 07:40:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B042206E2 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 A31366B005D; Tue, 7 Jul 2020 03:40:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E2976B0062; Tue, 7 Jul 2020 03:40:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8CFBA6B0068; Tue, 7 Jul 2020 03:40:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0177.hostedemail.com [216.40.44.177]) by kanga.kvack.org (Postfix) with ESMTP id 78F9B6B005D for ; Tue, 7 Jul 2020 03:40:40 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A9F4237F1 for ; Tue, 7 Jul 2020 07:40:39 +0000 (UTC) X-FDA: 77010482598.28.form12_50164fb26eb2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 806CC6C26 for ; Tue, 7 Jul 2020 07:40:39 +0000 (UTC) X-HE-Tag: form12_50164fb26eb2 X-Filterd-Recvd-Size: 4176 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Jul 2020 07:40:39 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id l2so43911945wmf.0 for ; Tue, 07 Jul 2020 00:40:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=mkLi5/2cSGgCl/orCCI+WQ6ij4dPXxM5S2mGX3t0dbo=; b=kyMN9bgEoL4IyT0OlYt74m03/FzrU5NIHVBnBYUhWVmSRMRbuvcopy4JoZZkmBrruQ s00U57DeNgIW8ng5HWAOn7hiL28VjBaW3+Ji+BQ4K/INcJFKZuN76uyag3ysLGi1tVbl 1tDmwrAqUeYcAx8hmOVmASLZ72jhGcK5+L4bQmg+lYx5y2A9gb1C7mqiPuOBewa1ddbN C1ZqhYufaM0L6tWojEXQv+R4QJHb2RIm/EstaZ5eX1ksifbz7UnMkYEvsaz4b3rvE3JZ 8Z1hzVfsBznwZmpUsSAydBgWggTvul4lsmqA8GeTDQQu2l2OrFxrK2nkK6c/pU81/TZl oK2A== X-Gm-Message-State: AOAM531W2x9vZNQaJywlbQnB8fyBXYQW4eFcaLg69bVcaaJ33S+RkhEW /LQM7YxIPCV5xZPDolk4IUU= X-Google-Smtp-Source: ABdhPJxZJEUdcW0X69/BdwNsvMtSqC0D3HaxiNuMfjIEkWNL/6j1aTh84oerAukVLXiZeh7bk3rWtA== X-Received: by 2002:a05:600c:2f17:: with SMTP id r23mr2639851wmn.167.1594107638192; Tue, 07 Jul 2020 00:40:38 -0700 (PDT) Received: from localhost (ip-37-188-179-51.eurotel.cz. [37.188.179.51]) by smtp.gmail.com with ESMTPSA id e23sm2189282wme.35.2020.07.07.00.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2020 00:40:37 -0700 (PDT) Date: Tue, 7 Jul 2020 09:40:36 +0200 From: Michal Hocko To: Colm =?iso-8859-1?Q?MacC=E1rthaigh?= Cc: "Catangiu, Adrian Costin" , linux-mm@kvack.org, linux-pm@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-api@vger.kernel.org, akpm@linux-foundation.org, rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz, fweimer@redhat.com, keescook@chromium.org, luto@amacapital.net, wad@chromium.org, mingo@kernel.org, bonzini@gnu.org, "Graf (AWS), Alexander" , "Singh, Balbir" , "Sandu, Andrei" , "Brooker, Marc" , "Weiss, Radu" , "Manwaring, Derek" Subject: Re: [RFC]: mm,power: introduce MADV_WIPEONSUSPEND Message-ID: <20200707074036.GB3820@dhcp22.suse.cz> References: <20200703113026.GT18446@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 806CC6C26 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 Fri 03-07-20 18:45:06, Colm MacC=C3=A1rthaigh wrote: >=20 >=20 > On 3 Jul 2020, at 4:30, Michal Hocko wrote: >=20 > > On Fri 03-07-20 10:34:09, Catangiu, Adrian Costin wrote: > > > This patch adds logic to the kernel power code to zero out contents > > > of > > > all MADV_WIPEONSUSPEND VMAs present in the system during its > > > transition > > > to any suspend state equal or greater/deeper than Suspend-to-memory= , > > > known as S3. > >=20 > > How does the application learn that its memory got wiped? S2disk is a= n > > async operation and it can happen at any time during the task executi= on. > > So how does the application work to prevent from corrupted state - e.= g. > > when suspended between two memory loads? >=20 > The usual trick when using MADV_WIPEONFORK, or BSD=E2=80=99s MAP_INHERI= T_ZERO, is to > store a guard variable in the page and to check the variable any time t= hat > random data is generated. Well, MADV_WIPEONFORK is a completely different beast because the forking is under a full control of the parent process and the information about the fork can be forwarded to child process. It is not like the child would reborn into a new world in the middle of the execution. --=20 Michal Hocko SUSE Labs