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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 67A39C433DB for ; Sun, 14 Feb 2021 09:58:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D494364E52 for ; Sun, 14 Feb 2021 09:58:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D494364E52 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 2F42F8D00D0; Sun, 14 Feb 2021 04:58:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A6028D0060; Sun, 14 Feb 2021 04:58:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11FA08D00D0; Sun, 14 Feb 2021 04:58:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0040.hostedemail.com [216.40.44.40]) by kanga.kvack.org (Postfix) with ESMTP id F12028D0060 for ; Sun, 14 Feb 2021 04:58:57 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A3A1A1802EF02 for ; Sun, 14 Feb 2021 09:58:57 +0000 (UTC) X-FDA: 77816424714.06.page13_091327c27631 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 854DA10047A02 for ; Sun, 14 Feb 2021 09:58:57 +0000 (UTC) X-HE-Tag: page13_091327c27631 X-Filterd-Recvd-Size: 7201 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Sun, 14 Feb 2021 09:58:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613296736; 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=Zp3fh8bmhevQAw8R7MoL8KMwwdmbqk0SnEL9PkDxXR0=; b=YSIBezDK2zFd6aXrHkl2BKQ9oL+lXtrvH28kCCGo7jswGOA//wASm7dNYrgOW3kJw+qlVh Onne/f/5p/pyrRDlJwRVPc6vNtcnGQEvVPxHqDLS15ya5oxd/TPlIBXdIlgKt0bprHZ/7t 1yG239P8HKSVpyEHw0qpKn+HBt7jKho= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-397-52_Ac-YkMgGnWqs2bPCJ1A-1; Sun, 14 Feb 2021 04:58:54 -0500 X-MC-Unique: 52_Ac-YkMgGnWqs2bPCJ1A-1 Received: by mail-wr1-f71.google.com with SMTP id e11so5931140wro.19 for ; Sun, 14 Feb 2021 01:58:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=FB1Zi7Y2SkOv/JvlFfpIv8DdC9H5NuowZUsuUzsgYnw=; b=oIbwoWAFF7//PHnXLB7lUCLIOaixwUXDu8IS2iuvS0wp41kwCXVadrIroh5/k50QIO O3ycIRk8EFdqWPnNrAQUBTXzjLNNIxJy2o4TizWy/GrgFzGt1KZttpfqggTdA+6E2ji8 v+SShV0FsxrY9jqR04zBrogThBkE/9EfkOEKTMqWnJCtjd8xoYmpEjM0pHSqkvYz7BNm KOLmnRM8pcgHbAb0hUeNe0bflrFvpMzoeGpG2cIbElLU98QVcVSY4fYrYkf4TGppFgcE ml6Lm0ysElNpVgmEteDPaWFpF4x2R3YrqCBPkQTjnbuS9gQJof1Ity5uKZUusO+81o5B 4mtA== X-Gm-Message-State: AOAM533/E+JNzAB+ssdilC0wvew64s696K925SxA5y8vxODiXy+b06z7 xE2IWdmX58NmBhVlaVXYaD/JPn9x27H/9/0SqKYV5ovBVbGW4qOofrYaEk6/59KHDQOZzLSBnT2 Z+OkCo++tliw= X-Received: by 2002:a7b:c5c1:: with SMTP id n1mr9687099wmk.163.1613296732907; Sun, 14 Feb 2021 01:58:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6AiGKsLxdVOEv3lcfmH3b0B76nApmRsRYcgYL0hyAbXvIT8wdTN/HlT3/mJBi3lug6LzkMg== X-Received: by 2002:a7b:c5c1:: with SMTP id n1mr9687058wmk.163.1613296732697; Sun, 14 Feb 2021 01:58:52 -0800 (PST) Received: from [192.168.3.108] (p4ff23363.dip0.t-ipconnect.de. [79.242.51.99]) by smtp.gmail.com with ESMTPSA id x15sm18554557wro.66.2021.02.14.01.58.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 Feb 2021 01:58:52 -0800 (PST) From: David Hildenbrand Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v17 07/10] mm: introduce memfd_secret system call to create "secret" memory areas Date: Sun, 14 Feb 2021 10:58:44 +0100 Message-Id: <052DACE9-986B-424C-AF8E-D6A4277DE635@redhat.com> References: <20210214091954.GM242749@kernel.org> Cc: David Hildenbrand , Michal Hocko , 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 , 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 In-Reply-To: <20210214091954.GM242749@kernel.org> To: Mike Rapoport X-Mailer: iPhone Mail (18D52) Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 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: > Am 14.02.2021 um 10:20 schrieb Mike Rapoport : >=20 > =EF=BB=BFOn Fri, Feb 12, 2021 at 10:18:19AM +0100, David Hildenbrand wrot= e: >>> On 12.02.21 00:09, Mike Rapoport wrote: >>> On Thu, Feb 11, 2021 at 01:07:10PM +0100, David Hildenbrand wrote: >>>> On 11.02.21 12:27, Mike Rapoport wrote: >>>>> On Thu, Feb 11, 2021 at 10:01:32AM +0100, David Hildenbrand wrote: >>>>=20 >>>> So let's talk about the main user-visible differences to other memfd f= iles >>>> (especially, other purely virtual files like hugetlbfs). With secretme= m: >>>>=20 >>>> - File content can only be read/written via memory mappings. >>>> - File content cannot be swapped out. >>>>=20 >>>> I think there are still valid ways to modify file content using syscal= ls: >>>> e.g., fallocate(PUNCH_HOLE). Things like truncate also seems to work j= ust >>>> fine. >>> These work perfectly with any file, so maybe we should have added >>> memfd_create as a flag to open(2) back then and now the secretmem file >>> descriptors? >>=20 >> I think open() vs memfd_create() makes sense: for open, the path specifi= es >> main properties (tmpfs, hugetlbfs, filesystem). On memfd, there is no su= ch >> path and the "type" has to be specified differently. >>=20 >> Also, open() might open existing files - memfd always creates new files. >=20 > Yes, but still open() returns a handle to a file and memfd_create() retur= ns > a handle to a file. The differences may be well hidden by e.g. O_MEMORY a= nd > than features unique to memfd files will have their set of O_SOMETHING > flags. >=20 Let=E2=80=98s agree to disagree. > It's the same logic that says "we already have an interface that's close > enough and it's fine to add a bunch of new flags there". No, not quite. But let=E2=80=98s agree to disagree. >=20 > And here we come to the question "what are the differences that justify a > new system call?" and the answer to this is very subjective. And as such = we > can continue bikeshedding forever. I think this fits into the existing memfd_create() syscall just fine, and I= heard no compelling argument why it shouldn=E2=80=98t. That=E2=80=98s all = I can say.