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 1CC61C433E0 for ; Tue, 7 Jul 2020 07:44:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DCD7F206E2 for ; Tue, 7 Jul 2020 07:44:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCD7F206E2 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 833836B0068; Tue, 7 Jul 2020 03:44:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7BED26B006C; Tue, 7 Jul 2020 03:44:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6859F6B006E; Tue, 7 Jul 2020 03:44:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0172.hostedemail.com [216.40.44.172]) by kanga.kvack.org (Postfix) with ESMTP id 501D06B0068 for ; Tue, 7 Jul 2020 03:44:29 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0B588180AD804 for ; Tue, 7 Jul 2020 07:44:29 +0000 (UTC) X-FDA: 77010492258.12.slip15_490857b26eb2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id D56FA1800E91F for ; Tue, 7 Jul 2020 07:44:28 +0000 (UTC) X-HE-Tag: slip15_490857b26eb2 X-Filterd-Recvd-Size: 4774 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Jul 2020 07:44:28 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id a6so1130715wmm.0 for ; Tue, 07 Jul 2020 00:44:28 -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:in-reply-to; bh=F4aqx7HxhCSSKHXwc2697sIHhQdT/BBdsfLF62DEQE4=; b=hq0Mr54wLTqnwiC0yivTmWfQ6jqXV21yBdkJruPCEzt5UYbf4Jh25dOXqEZuMu4Gp2 qxLR3uZ+RaYUIqFJ76QBJKcXs5aNWpflIwG2Vx4l2fs2p7XEXXPy4LSFSpn7YhVzDFeh rQPJpj3nxFujPJStI/k0+5dyLsP4gqua9TuI85R9bafvqWhS2o5zp2IUO2d2a8KXLFGZ Nvm+ehs9Umf54UZxtoLyd2qv7cwkDTvB5cuGaPBI1smiJ1bTilyqOJnsBm3g3mum0Fe8 9ONU+9vhFz4365WTok0qzgyofpkq5D80wDYRlN+ue5zikRerqxuOgc30koaqI/mcwo6X jjxg== X-Gm-Message-State: AOAM531Vv9jrgGDcVw0B03mVQ4KZfLQKHC8bPkqLb4Jeg0nmiA+xmHXc 5IGf1/Llr25rVT0Cv1ISNbL3w48p X-Google-Smtp-Source: ABdhPJx+I2TIfUFvZS7RzpHU0dX1TjZmj/O3FD7sf6peHipy/sldWFpAe42dJn2scLZ0GHRhPo4TxQ== X-Received: by 2002:a7b:c197:: with SMTP id y23mr2950573wmi.114.1594107867373; Tue, 07 Jul 2020 00:44:27 -0700 (PDT) Received: from localhost (ip-37-188-179-51.eurotel.cz. [37.188.179.51]) by smtp.gmail.com with ESMTPSA id q7sm15968740wra.56.2020.07.07.00.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2020 00:44:26 -0700 (PDT) Date: Tue, 7 Jul 2020 09:44:25 +0200 From: Michal Hocko To: Jann Horn Cc: Alexander Graf , Pavel Machek , "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" , "fweimer@redhat.com" , "keescook@chromium.org" , "luto@amacapital.net" , "wad@chromium.org" , "mingo@kernel.org" , "bonzini@gnu.org" , "MacCarthaigh, Colm" , "Singh, Balbir" , "Sandu, Andrei" , "Brooker, Marc" , "Weiss, Radu" , "Manwaring, Derek" Subject: Re: [RFC]: mm,power: introduce MADV_WIPEONSUSPEND Message-ID: <20200707074425.GC3820@dhcp22.suse.cz> References: <20200703224411.GC25072@amd> <20200704114820.GA16083@amd> <57ab4fb3-3f82-d34f-ad74-2214b45a4dd9@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: D56FA1800E91F X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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 06-07-20 14:52:07, Jann Horn wrote: > On Mon, Jul 6, 2020 at 2:27 PM Alexander Graf wrote: > > Unless we create a vsyscall that returns both the PID as well as the > > epoch and thus handles fork *and* suspend. I need to think about this a > > bit more :). > > You can't reliably detect forking by checking the PID if it is > possible for multiple forks to be chained before the reuse check runs: > > - pid 1000 remembers its PID > - pid 1000 forks, creating child pid 1001 > - pid 1000 exits and is waited on by init > - the pid allocator wraps around > - pid 1001 forks, creating child pid 1000 > - child with pid 1000 tries to check for forking, determines that its > PID is 1000, and concludes that it is still the original process I must be really missing something here because I really fail to see why there has to be something new even invented. Sure, checking for pid is certainly a suboptimal solution because pids are terrible tokens to work with. We do have a concept of file descriptors which a much better and supports signaling. There is a clear source of the signal IIUC (migration) and there are consumers to act upon that (e.g. crypto backends). So what does really prevent to use a standard signal delivery over fd for this usecase? -- Michal Hocko SUSE Labs