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=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 47252C433E6 for ; Sun, 14 Feb 2021 09:20:17 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A954464E12 for ; Sun, 14 Feb 2021 09:20:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A954464E12 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 77C29100EC1E7; Sun, 14 Feb 2021 01:20:16 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=198.145.29.99; helo=mail.kernel.org; envelope-from=rppt@kernel.org; receiver= Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id F2165100EF270 for ; Sun, 14 Feb 2021 01:20:13 -0800 (PST) Received: by mail.kernel.org (Postfix) with ESMTPSA id 2CB2B64D73; Sun, 14 Feb 2021 09:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613294412; bh=IojP/99cv2KZA0UAqkGIVvcnNQXpAQrGnDSYSmISYMk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ggTE3epmRlYiZpCIulQqzfZIZLk/o9Hy+eMY/vtIj4RBJvlbLU6YBe6xW+nn3Nh9o MyYMRX8NGusIKQSvjXjeNrYN2FzXGXOOYKN32wbF5K9UR5i2fL54NWoZ4kzch8O1fz 0j0N6t7YI6VhKfHIfT1MILdmaVlC+bJrUkGBAjCyOCyGfWtt4wmkaNl5ygGD55KRog FpJCiXGCmq9B5RiAfE9vA/ahNtHagvIeFYzLpSK837gPh4weRSFHUqNEb1+FAp4m0u 60OF5nZHG/kKqrkEsLohg2nOPziZfAIwq4U8bxWTmen5x/8iLmJMxF5gj8klmC/iDZ Da8cagTHmtKmw== Date: Sun, 14 Feb 2021 11:19:54 +0200 From: Mike Rapoport To: David Hildenbrand Subject: Re: [PATCH v17 07/10] mm: introduce memfd_secret system call to create "secret" memory areas Message-ID: <20210214091954.GM242749@kernel.org> References: <20210209090938.GP299309@linux.ibm.com> <20210211071319.GF242749@kernel.org> <0d66baec-1898-987b-7eaf-68a015c027ff@redhat.com> <20210211112702.GI242749@kernel.org> <05082284-bd85-579f-2b3e-9b1af663eb6f@redhat.com> <20210211230910.GL242749@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Message-ID-Hash: T4QL7UQHUIOOEMDNCQCGXLO5665T5ZLI X-Message-ID-Hash: T4QL7UQHUIOOEMDNCQCGXLO5665T5ZLI X-MailFrom: rppt@kernel.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation CC: Michal Hocko , Mike Rapoport , Andrew Morton , Alexander Viro , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christopher Lameter , 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 Anders en , 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 X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Fri, Feb 12, 2021 at 10:18:19AM +0100, David Hildenbrand wrote: > 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: > > > > > > So let's talk about the main user-visible differences to other memfd files > > > (especially, other purely virtual files like hugetlbfs). With secretmem: > > > > > > - File content can only be read/written via memory mappings. > > > - File content cannot be swapped out. > > > > > > I think there are still valid ways to modify file content using syscalls: > > > e.g., fallocate(PUNCH_HOLE). Things like truncate also seems to work just > > > 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? > > I think open() vs memfd_create() makes sense: for open, the path specifies > main properties (tmpfs, hugetlbfs, filesystem). On memfd, there is no such > path and the "type" has to be specified differently. > > Also, open() might open existing files - memfd always creates new files. Yes, but still open() returns a handle to a file and memfd_create() returns a handle to a file. The differences may be well hidden by e.g. O_MEMORY and than features unique to memfd files will have their set of O_SOMETHING flags. 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". 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. -- Sincerely yours, Mike. _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org 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=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 F090AC433DB for ; Sun, 14 Feb 2021 09:21:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC4BA60C3E for ; Sun, 14 Feb 2021 09:21:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229806AbhBNJVK (ORCPT ); Sun, 14 Feb 2021 04:21:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:46840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbhBNJUx (ORCPT ); Sun, 14 Feb 2021 04:20:53 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2CB2B64D73; Sun, 14 Feb 2021 09:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613294412; bh=IojP/99cv2KZA0UAqkGIVvcnNQXpAQrGnDSYSmISYMk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ggTE3epmRlYiZpCIulQqzfZIZLk/o9Hy+eMY/vtIj4RBJvlbLU6YBe6xW+nn3Nh9o MyYMRX8NGusIKQSvjXjeNrYN2FzXGXOOYKN32wbF5K9UR5i2fL54NWoZ4kzch8O1fz 0j0N6t7YI6VhKfHIfT1MILdmaVlC+bJrUkGBAjCyOCyGfWtt4wmkaNl5ygGD55KRog FpJCiXGCmq9B5RiAfE9vA/ahNtHagvIeFYzLpSK837gPh4weRSFHUqNEb1+FAp4m0u 60OF5nZHG/kKqrkEsLohg2nOPziZfAIwq4U8bxWTmen5x/8iLmJMxF5gj8klmC/iDZ Da8cagTHmtKmw== Date: Sun, 14 Feb 2021 11:19:54 +0200 From: Mike Rapoport To: David Hildenbrand Cc: 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 Subject: Re: [PATCH v17 07/10] mm: introduce memfd_secret system call to create "secret" memory areas Message-ID: <20210214091954.GM242749@kernel.org> References: <20210209090938.GP299309@linux.ibm.com> <20210211071319.GF242749@kernel.org> <0d66baec-1898-987b-7eaf-68a015c027ff@redhat.com> <20210211112702.GI242749@kernel.org> <05082284-bd85-579f-2b3e-9b1af663eb6f@redhat.com> <20210211230910.GL242749@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 12, 2021 at 10:18:19AM +0100, David Hildenbrand wrote: > 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: > > > > > > So let's talk about the main user-visible differences to other memfd files > > > (especially, other purely virtual files like hugetlbfs). With secretmem: > > > > > > - File content can only be read/written via memory mappings. > > > - File content cannot be swapped out. > > > > > > I think there are still valid ways to modify file content using syscalls: > > > e.g., fallocate(PUNCH_HOLE). Things like truncate also seems to work just > > > 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? > > I think open() vs memfd_create() makes sense: for open, the path specifies > main properties (tmpfs, hugetlbfs, filesystem). On memfd, there is no such > path and the "type" has to be specified differently. > > Also, open() might open existing files - memfd always creates new files. Yes, but still open() returns a handle to a file and memfd_create() returns a handle to a file. The differences may be well hidden by e.g. O_MEMORY and than features unique to memfd files will have their set of O_SOMETHING flags. 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". 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. -- Sincerely yours, Mike. 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=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 B7989C433DB for ; Sun, 14 Feb 2021 09:20:39 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 56F1D64E12 for ; Sun, 14 Feb 2021 09:20:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 56F1D64E12 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Z+FALVtwBoJe3itLAES4cyuvq2POjllJBIK6PQfQj6s=; b=LyOvUl+IgBk+dm8L9mBG0+CfV ggqBzzMmsX05f7sqEudyLnl8tW+i7mzz5tJwajW2q2sFpp/fE7WmmS7tqoypW4NZiLDUcsBkJJUPh WandjqS4SZvteaJLOilPUO3n64alWqhKjmkz6ccvXA4ae5GNflM+ORyKsGCxOsm5ob2/e8tGF9Azs 5SJN/GxZ8DWTP5+ITwoIgjOVyLQ8vwUIbc4jBZfHltzH8iSZGU6sWtwCYGq1pSB8GkX5fMgktQ7Wm qeKot6OeS6E6pavO7V5Fp+vch0XojqHBf4Q77QyhBpaLvFUGcL3+ESXaHf6/HbnuFnubdOfUT/gUP FpSyfvOzw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lBDZk-00081o-BQ; Sun, 14 Feb 2021 09:20:20 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lBDZe-0007zm-DS; Sun, 14 Feb 2021 09:20:15 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2CB2B64D73; Sun, 14 Feb 2021 09:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613294412; bh=IojP/99cv2KZA0UAqkGIVvcnNQXpAQrGnDSYSmISYMk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ggTE3epmRlYiZpCIulQqzfZIZLk/o9Hy+eMY/vtIj4RBJvlbLU6YBe6xW+nn3Nh9o MyYMRX8NGusIKQSvjXjeNrYN2FzXGXOOYKN32wbF5K9UR5i2fL54NWoZ4kzch8O1fz 0j0N6t7YI6VhKfHIfT1MILdmaVlC+bJrUkGBAjCyOCyGfWtt4wmkaNl5ygGD55KRog FpJCiXGCmq9B5RiAfE9vA/ahNtHagvIeFYzLpSK837gPh4weRSFHUqNEb1+FAp4m0u 60OF5nZHG/kKqrkEsLohg2nOPziZfAIwq4U8bxWTmen5x/8iLmJMxF5gj8klmC/iDZ Da8cagTHmtKmw== Date: Sun, 14 Feb 2021 11:19:54 +0200 From: Mike Rapoport To: David Hildenbrand Subject: Re: [PATCH v17 07/10] mm: introduce memfd_secret system call to create "secret" memory areas Message-ID: <20210214091954.GM242749@kernel.org> References: <20210209090938.GP299309@linux.ibm.com> <20210211071319.GF242749@kernel.org> <0d66baec-1898-987b-7eaf-68a015c027ff@redhat.com> <20210211112702.GI242749@kernel.org> <05082284-bd85-579f-2b3e-9b1af663eb6f@redhat.com> <20210211230910.GL242749@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210214_042014_676424_860AD786 X-CRM114-Status: GOOD ( 19.15 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Michal Hocko , Peter Zijlstra , Catalin Marinas , Dave Hansen , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, "H. Peter Anvin" , Christopher Lameter , Shuah Khan , Thomas Gleixner , Elena Reshetova , linux-arch@vger.kernel.org, Tycho Andersen , linux-nvdimm@lists.01.org, Will Deacon , x86@kernel.org, Matthew Wilcox , Mike Rapoport , Ingo Molnar , Michael Kerrisk , Palmer Dabbelt , Arnd Bergmann , James Bottomley , Hagen Paul Pfeifer , Borislav Petkov , Alexander Viro , Andy Lutomirski , Paul Walmsley , "Kirill A. Shutemov" , Dan Williams , linux-arm-kernel@lists.infradead.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , linux-fsdevel@vger.kernel.org, Shakeel Butt , Andrew Morton , Rick Edgecombe , Roman Gushchin Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Fri, Feb 12, 2021 at 10:18:19AM +0100, David Hildenbrand wrote: > 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: > > > > > > So let's talk about the main user-visible differences to other memfd files > > > (especially, other purely virtual files like hugetlbfs). With secretmem: > > > > > > - File content can only be read/written via memory mappings. > > > - File content cannot be swapped out. > > > > > > I think there are still valid ways to modify file content using syscalls: > > > e.g., fallocate(PUNCH_HOLE). Things like truncate also seems to work just > > > 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? > > I think open() vs memfd_create() makes sense: for open, the path specifies > main properties (tmpfs, hugetlbfs, filesystem). On memfd, there is no such > path and the "type" has to be specified differently. > > Also, open() might open existing files - memfd always creates new files. Yes, but still open() returns a handle to a file and memfd_create() returns a handle to a file. The differences may be well hidden by e.g. O_MEMORY and than features unique to memfd files will have their set of O_SOMETHING flags. 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". 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. -- Sincerely yours, Mike. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 8351FC433DB for ; Sun, 14 Feb 2021 09:21:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C20E60C3E for ; Sun, 14 Feb 2021 09:21:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C20E60C3E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8RCbj3aRUZ52/5ex7sMPS1XFgSAWgd98gvPQz8kwcZ8=; b=NmwwE904ECE+p6RPLFKMzUGZr rVvsuJtQfwURK28BKK6KqGQ0Pis7bCW9COsN+sR0g+NKjV/EAhlmJVpvrx/zp8O41wnsjd2aYtjxp OCtWceTHZ0C55ItmZ2zwDr8a/g1wTRru/SqdAqYbeEvvH2dVswykrSPxr9emZGSplcuxXWwnZ8vMq sE7nQL4ynysvG8WBBhTGPBTQHkV4IntrC3sxErhjc8xw2LGshYawBWf6o5wnTaZ4HICOS92nIq3oj zP8dJv293XDHZzZvyW0eiTmMmm1WdfzTGuyg9qe09C9BRZGis878CuRgrJBWnCZRikQ/LybkmrBO9 a85z47nIw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lBDZi-00080i-BQ; Sun, 14 Feb 2021 09:20:18 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lBDZe-0007zm-DS; Sun, 14 Feb 2021 09:20:15 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2CB2B64D73; Sun, 14 Feb 2021 09:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613294412; bh=IojP/99cv2KZA0UAqkGIVvcnNQXpAQrGnDSYSmISYMk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ggTE3epmRlYiZpCIulQqzfZIZLk/o9Hy+eMY/vtIj4RBJvlbLU6YBe6xW+nn3Nh9o MyYMRX8NGusIKQSvjXjeNrYN2FzXGXOOYKN32wbF5K9UR5i2fL54NWoZ4kzch8O1fz 0j0N6t7YI6VhKfHIfT1MILdmaVlC+bJrUkGBAjCyOCyGfWtt4wmkaNl5ygGD55KRog FpJCiXGCmq9B5RiAfE9vA/ahNtHagvIeFYzLpSK837gPh4weRSFHUqNEb1+FAp4m0u 60OF5nZHG/kKqrkEsLohg2nOPziZfAIwq4U8bxWTmen5x/8iLmJMxF5gj8klmC/iDZ Da8cagTHmtKmw== Date: Sun, 14 Feb 2021 11:19:54 +0200 From: Mike Rapoport To: David Hildenbrand Subject: Re: [PATCH v17 07/10] mm: introduce memfd_secret system call to create "secret" memory areas Message-ID: <20210214091954.GM242749@kernel.org> References: <20210209090938.GP299309@linux.ibm.com> <20210211071319.GF242749@kernel.org> <0d66baec-1898-987b-7eaf-68a015c027ff@redhat.com> <20210211112702.GI242749@kernel.org> <05082284-bd85-579f-2b3e-9b1af663eb6f@redhat.com> <20210211230910.GL242749@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210214_042014_676424_860AD786 X-CRM114-Status: GOOD ( 19.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Michal Hocko , Peter Zijlstra , Catalin Marinas , Dave Hansen , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, "H. Peter Anvin" , Christopher Lameter , Shuah Khan , Thomas Gleixner , Elena Reshetova , linux-arch@vger.kernel.org, Tycho Andersen , linux-nvdimm@lists.01.org, Will Deacon , x86@kernel.org, Matthew Wilcox , Mike Rapoport , Ingo Molnar , Michael Kerrisk , Palmer Dabbelt , Arnd Bergmann , James Bottomley , Hagen Paul Pfeifer , Borislav Petkov , Alexander Viro , Andy Lutomirski , Paul Walmsley , "Kirill A. Shutemov" , Dan Williams , linux-arm-kernel@lists.infradead.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , linux-fsdevel@vger.kernel.org, Shakeel Butt , Andrew Morton , Rick Edgecombe , Roman Gushchin Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Feb 12, 2021 at 10:18:19AM +0100, David Hildenbrand wrote: > 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: > > > > > > So let's talk about the main user-visible differences to other memfd files > > > (especially, other purely virtual files like hugetlbfs). With secretmem: > > > > > > - File content can only be read/written via memory mappings. > > > - File content cannot be swapped out. > > > > > > I think there are still valid ways to modify file content using syscalls: > > > e.g., fallocate(PUNCH_HOLE). Things like truncate also seems to work just > > > 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? > > I think open() vs memfd_create() makes sense: for open, the path specifies > main properties (tmpfs, hugetlbfs, filesystem). On memfd, there is no such > path and the "type" has to be specified differently. > > Also, open() might open existing files - memfd always creates new files. Yes, but still open() returns a handle to a file and memfd_create() returns a handle to a file. The differences may be well hidden by e.g. O_MEMORY and than features unique to memfd files will have their set of O_SOMETHING flags. 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". 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. -- Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel