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 B56B0C4727F for ; Tue, 29 Sep 2020 13:06:26 +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 5083B20848 for ; Tue, 29 Sep 2020 13:06:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="kkoEdNeB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5083B20848 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 8A985153EB256; Tue, 29 Sep 2020 06:06:25 -0700 (PDT) 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 0D43B152CC040 for ; Tue, 29 Sep 2020 06:06:24 -0700 (PDT) Received: from kernel.org (unknown [87.71.73.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6DAC8207F7; Tue, 29 Sep 2020 13:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601384783; bh=dKs40EB0zUNqF3k8hOXDHChpW1qE+Tc5ZCaCj+fNcAI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kkoEdNeBwGUh5IVOWlI3TdmyaJCGl1uUtrsv4V7euPJfzeGsgVr9508rpCKlka84A TsDcDOdrDS9A4AaYCoyZ7lmCOsiredZMHpJsZ/ljNuc5atPQsZJCW42/ujWY54vc/A xHI6TcUVFoTK32LTlL0E1IvYKnm9SRUNQXn1aIps= Date: Tue, 29 Sep 2020 16:06:02 +0300 From: Mike Rapoport To: "Edgecombe, Rick P" Subject: Re: [PATCH v6 3/6] mm: introduce memfd_secret system call to create "secret" memory areas Message-ID: <20200929130602.GF2142832@kernel.org> References: <20200924132904.1391-1-rppt@kernel.org> <20200924132904.1391-4-rppt@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Message-ID-Hash: KSOGVDJE4KXF6PTMJEWRIMVE6YWW6J4U X-Message-ID-Hash: KSOGVDJE4KXF6PTMJEWRIMVE6YWW6J4U 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: "akpm@linux-foundation.org" , "tycho@tycho.ws" , "david@redhat.com" , "cl@linux.com" , "hpa@zytor.com" , "peterz@infradead.org" , "catalin.marinas@arm.com" , "linux-kselftest@vger.kernel.org" , "dave.hansen@linux.intel.com" , "will@kernel.org" , "linux-mm@kvack.org" , "idan.yaniv@ibm.com" , "kirill@shutemov.name" , "viro@zeniv.linux.org.uk" , "rppt@linux.ibm.com" , "linux-arch@vger.kernel.org" , "bp@alien8.de" , "willy@infradead.org" , "luto@kernel.org" , "arnd@arndb.de" , "shuah@kernel.org" , "tglx@linutronix.de" , "linux-nvdimm@li sts.01.org" , "linux-riscv@lists.infradead.org" , "x86@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-fsdevel@vger.kernel.org" , "Reshetova, Elena" , "palmer@dabbelt.com" , "mingo@redhat.com" , "mtk.manpages@gmail.com" , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , "jejb@linux.ibm.com" , "paul.walmsley@sifive.com" , "mark.rutland@arm.com" 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 Tue, Sep 29, 2020 at 04:58:44AM +0000, Edgecombe, Rick P wrote: > On Thu, 2020-09-24 at 16:29 +0300, Mike Rapoport wrote: > > Introduce "memfd_secret" system call with the ability to create > > memory > > areas visible only in the context of the owning process and not > > mapped not > > only to other processes but in the kernel page tables as well. > > > > The user will create a file descriptor using the memfd_secret() > > system call > > where flags supplied as a parameter to this system call will define > > the > > desired protection mode for the memory associated with that file > > descriptor. > > > > Currently there are two protection modes: > > > > * exclusive - the memory area is unmapped from the kernel direct map > > and it > > is present only in the page tables of the owning mm. > > Seems like there were some concerns raised around direct map > efficiency, but in case you are going to rework this...how does this > memory work for the existing kernel functionality that does things like > this? > > get_user_pages(, &page); > ptr = kmap(page); > foo = *ptr; > > Not sure if I'm missing something, but I think apps could cause the > kernel to access a not-present page and oops. The idea is that this memory should not be accessible by the kernel, so the sequence you describe should indeed fail. Probably oops would be to noisy and in this case the report needs to be less verbose. -- 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=-4.8 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 8B7F4C47423 for ; Tue, 29 Sep 2020 13:06:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2CF21208FE for ; Tue, 29 Sep 2020 13:06:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601384787; bh=dKs40EB0zUNqF3k8hOXDHChpW1qE+Tc5ZCaCj+fNcAI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=IC/45wfrSm3Qo0D3/mpOwYZfT+412LhX71rJcr9uovVpkakMrbWxb8E1wjZGaSZqZ 9FtwXM/es8Dc3zO6N7S1o2d9IBQBhadt2qIm2A7k2k5R44QGDOxaiaLnqmokepBnPg nYBp2AmTP+6TfI+wouVGAxE/rgoHkt0S/zBmFOPA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728931AbgI2NGZ (ORCPT ); Tue, 29 Sep 2020 09:06:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:48202 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728253AbgI2NGY (ORCPT ); Tue, 29 Sep 2020 09:06:24 -0400 Received: from kernel.org (unknown [87.71.73.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6DAC8207F7; Tue, 29 Sep 2020 13:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601384783; bh=dKs40EB0zUNqF3k8hOXDHChpW1qE+Tc5ZCaCj+fNcAI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kkoEdNeBwGUh5IVOWlI3TdmyaJCGl1uUtrsv4V7euPJfzeGsgVr9508rpCKlka84A TsDcDOdrDS9A4AaYCoyZ7lmCOsiredZMHpJsZ/ljNuc5atPQsZJCW42/ujWY54vc/A xHI6TcUVFoTK32LTlL0E1IvYKnm9SRUNQXn1aIps= Date: Tue, 29 Sep 2020 16:06:02 +0300 From: Mike Rapoport To: "Edgecombe, Rick P" Cc: "akpm@linux-foundation.org" , "tycho@tycho.ws" , "david@redhat.com" , "cl@linux.com" , "hpa@zytor.com" , "peterz@infradead.org" , "catalin.marinas@arm.com" , "linux-kselftest@vger.kernel.org" , "dave.hansen@linux.intel.com" , "will@kernel.org" , "linux-mm@kvack.org" , "idan.yaniv@ibm.com" , "kirill@shutemov.name" , "viro@zeniv.linux.org.uk" , "rppt@linux.ibm.com" , "linux-arch@vger.kernel.org" , "Williams, Dan J" , "bp@alien8.de" , "willy@infradead.org" , "luto@kernel.org" , "arnd@arndb.de" , "shuah@kernel.org" , "tglx@linutronix.de" , "linux-nvdimm@lists.01.org" , "linux-riscv@lists.infradead.org" , "x86@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-fsdevel@vger.kernel.org" , "Reshetova, Elena" , "palmer@dabbelt.com" , "mingo@redhat.com" , "mtk.manpages@gmail.com" , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , "jejb@linux.ibm.com" , "paul.walmsley@sifive.com" , "mark.rutland@arm.com" Subject: Re: [PATCH v6 3/6] mm: introduce memfd_secret system call to create "secret" memory areas Message-ID: <20200929130602.GF2142832@kernel.org> References: <20200924132904.1391-1-rppt@kernel.org> <20200924132904.1391-4-rppt@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 Tue, Sep 29, 2020 at 04:58:44AM +0000, Edgecombe, Rick P wrote: > On Thu, 2020-09-24 at 16:29 +0300, Mike Rapoport wrote: > > Introduce "memfd_secret" system call with the ability to create > > memory > > areas visible only in the context of the owning process and not > > mapped not > > only to other processes but in the kernel page tables as well. > > > > The user will create a file descriptor using the memfd_secret() > > system call > > where flags supplied as a parameter to this system call will define > > the > > desired protection mode for the memory associated with that file > > descriptor. > > > > Currently there are two protection modes: > > > > * exclusive - the memory area is unmapped from the kernel direct map > > and it > > is present only in the page tables of the owning mm. > > Seems like there were some concerns raised around direct map > efficiency, but in case you are going to rework this...how does this > memory work for the existing kernel functionality that does things like > this? > > get_user_pages(, &page); > ptr = kmap(page); > foo = *ptr; > > Not sure if I'm missing something, but I think apps could cause the > kernel to access a not-present page and oops. The idea is that this memory should not be accessible by the kernel, so the sequence you describe should indeed fail. Probably oops would be to noisy and in this case the report needs to be less verbose. -- 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.7 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 49FCEC4727C for ; Tue, 29 Sep 2020 13:06:50 +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 BEA7020848 for ; Tue, 29 Sep 2020 13:06:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aBB9re1m"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="kkoEdNeB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEA7020848 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=sxS12hD/oCv9OFaZnH1BjQlUJMxU5a68vts5Bn3wHss=; b=aBB9re1miwUnt2l2Dx6CY/nDe 7lQjmaN34K1mguKDk2MKqmu9twtnGHrSX48CEp8ofmywUoeC7l/xAqvfIv0pnbCm4Z/Liou0xTxMw xNrQkxIGt3p/EYEdiJYU12HRGWZ/2bazLcSJ2mKTmFalwijhJuKQPf68XeYJb3SCPmK6xRuDqZdGQ rP4/Z5RLPCcbOvKlUHKwdGFgKjUrYA7jBaJHjbn3ULzbKXYD8nx4UY+LvnzN8PF6Oj7wJiUP+mQi5 +0jB0SGJseVBqzCM7mPQ4ww3+VbJz2VfG7zWMI7mm1BQebB8Sz8bIh4VPjnUcIxsrW8Nu8vxSiJAD oK2rdrteQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNFL6-0003Nv-D5; Tue, 29 Sep 2020 13:06:40 +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 1kNFKq-0003HG-IC; Tue, 29 Sep 2020 13:06:28 +0000 Received: from kernel.org (unknown [87.71.73.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6DAC8207F7; Tue, 29 Sep 2020 13:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601384783; bh=dKs40EB0zUNqF3k8hOXDHChpW1qE+Tc5ZCaCj+fNcAI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kkoEdNeBwGUh5IVOWlI3TdmyaJCGl1uUtrsv4V7euPJfzeGsgVr9508rpCKlka84A TsDcDOdrDS9A4AaYCoyZ7lmCOsiredZMHpJsZ/ljNuc5atPQsZJCW42/ujWY54vc/A xHI6TcUVFoTK32LTlL0E1IvYKnm9SRUNQXn1aIps= Date: Tue, 29 Sep 2020 16:06:02 +0300 From: Mike Rapoport To: "Edgecombe, Rick P" Subject: Re: [PATCH v6 3/6] mm: introduce memfd_secret system call to create "secret" memory areas Message-ID: <20200929130602.GF2142832@kernel.org> References: <20200924132904.1391-1-rppt@kernel.org> <20200924132904.1391-4-rppt@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-20200929_090624_806229_55751195 X-CRM114-Status: GOOD ( 21.89 ) 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@arm.com" , "david@redhat.com" , "peterz@infradead.org" , "catalin.marinas@arm.com" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "linux-kselftest@vger.kernel.org" , "hpa@zytor.com" , "cl@linux.com" , "idan.yaniv@ibm.com" , "tglx@linutronix.de" , "Reshetova, Elena" , "linux-arch@vger.kernel.org" , "tycho@tycho.ws" , "arnd@arndb.de" , "linux-nvdimm@lists.01.org" , "shuah@kernel.org" , "x86@kernel.org" , "willy@infradead.org" , "rppt@linux.ibm.com" , "mingo@redhat.com" , "mtk.manpages@gmail.com" , "will@kernel.org" , "jejb@linux.ibm.com" , "bp@alien8.de" , "viro@zeniv.linux.org.uk" , "luto@kernel.org" , "paul.walmsley@sifive.com" , "kirill@shutemov.name" , "Williams, Dan J" , "linux-arm-kernel@lists.infradead.org" , "linux-api@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "palmer@dabbelt.com" , "linux-fsdevel@vger.kernel.org" , "akpm@linux-foundation.org" 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 Tue, Sep 29, 2020 at 04:58:44AM +0000, Edgecombe, Rick P wrote: > On Thu, 2020-09-24 at 16:29 +0300, Mike Rapoport wrote: > > Introduce "memfd_secret" system call with the ability to create > > memory > > areas visible only in the context of the owning process and not > > mapped not > > only to other processes but in the kernel page tables as well. > > > > The user will create a file descriptor using the memfd_secret() > > system call > > where flags supplied as a parameter to this system call will define > > the > > desired protection mode for the memory associated with that file > > descriptor. > > > > Currently there are two protection modes: > > > > * exclusive - the memory area is unmapped from the kernel direct map > > and it > > is present only in the page tables of the owning mm. > > Seems like there were some concerns raised around direct map > efficiency, but in case you are going to rework this...how does this > memory work for the existing kernel functionality that does things like > this? > > get_user_pages(, &page); > ptr = kmap(page); > foo = *ptr; > > Not sure if I'm missing something, but I think apps could cause the > kernel to access a not-present page and oops. The idea is that this memory should not be accessible by the kernel, so the sequence you describe should indeed fail. Probably oops would be to noisy and in this case the report needs to be less verbose. -- 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.8 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 D6B29C47423 for ; Tue, 29 Sep 2020 13:06:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 55AF1208FE for ; Tue, 29 Sep 2020 13:06:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="kkoEdNeB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 55AF1208FE 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 9DF3A6B006C; Tue, 29 Sep 2020 09:06:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 98CF76B006E; Tue, 29 Sep 2020 09:06:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87CD56B0070; Tue, 29 Sep 2020 09:06:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id 6D7A46B006C for ; Tue, 29 Sep 2020 09:06:29 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2E9D982499A8 for ; Tue, 29 Sep 2020 13:06:29 +0000 (UTC) X-FDA: 77316122898.30.army91_420098d2718a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 6D99D18002DB9 for ; Tue, 29 Sep 2020 13:06:25 +0000 (UTC) X-HE-Tag: army91_420098d2718a X-Filterd-Recvd-Size: 4784 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Tue, 29 Sep 2020 13:06:24 +0000 (UTC) Received: from kernel.org (unknown [87.71.73.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6DAC8207F7; Tue, 29 Sep 2020 13:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601384783; bh=dKs40EB0zUNqF3k8hOXDHChpW1qE+Tc5ZCaCj+fNcAI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kkoEdNeBwGUh5IVOWlI3TdmyaJCGl1uUtrsv4V7euPJfzeGsgVr9508rpCKlka84A TsDcDOdrDS9A4AaYCoyZ7lmCOsiredZMHpJsZ/ljNuc5atPQsZJCW42/ujWY54vc/A xHI6TcUVFoTK32LTlL0E1IvYKnm9SRUNQXn1aIps= Date: Tue, 29 Sep 2020 16:06:02 +0300 From: Mike Rapoport To: "Edgecombe, Rick P" Cc: "akpm@linux-foundation.org" , "tycho@tycho.ws" , "david@redhat.com" , "cl@linux.com" , "hpa@zytor.com" , "peterz@infradead.org" , "catalin.marinas@arm.com" , "linux-kselftest@vger.kernel.org" , "dave.hansen@linux.intel.com" , "will@kernel.org" , "linux-mm@kvack.org" , "idan.yaniv@ibm.com" , "kirill@shutemov.name" , "viro@zeniv.linux.org.uk" , "rppt@linux.ibm.com" , "linux-arch@vger.kernel.org" , "Williams, Dan J" , "bp@alien8.de" , "willy@infradead.org" , "luto@kernel.org" , "arnd@arndb.de" , "shuah@kernel.org" , "tglx@linutronix.de" , "linux-nvdimm@lists.01.org" , "linux-riscv@lists.infradead.org" , "x86@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-fsdevel@vger.kernel.org" , "Reshetova, Elena" , "palmer@dabbelt.com" , "mingo@redhat.com" , "mtk.manpages@gmail.com" , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , "jejb@linux.ibm.com" , "paul.walmsley@sifive.com" , "mark.rutland@arm.com" Subject: Re: [PATCH v6 3/6] mm: introduce memfd_secret system call to create "secret" memory areas Message-ID: <20200929130602.GF2142832@kernel.org> References: <20200924132904.1391-1-rppt@kernel.org> <20200924132904.1391-4-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue, Sep 29, 2020 at 04:58:44AM +0000, Edgecombe, Rick P wrote: > On Thu, 2020-09-24 at 16:29 +0300, Mike Rapoport wrote: > > Introduce "memfd_secret" system call with the ability to create > > memory > > areas visible only in the context of the owning process and not > > mapped not > > only to other processes but in the kernel page tables as well. > > > > The user will create a file descriptor using the memfd_secret() > > system call > > where flags supplied as a parameter to this system call will define > > the > > desired protection mode for the memory associated with that file > > descriptor. > > > > Currently there are two protection modes: > > > > * exclusive - the memory area is unmapped from the kernel direct map > > and it > > is present only in the page tables of the owning mm. > > Seems like there were some concerns raised around direct map > efficiency, but in case you are going to rework this...how does this > memory work for the existing kernel functionality that does things like > this? > > get_user_pages(, &page); > ptr = kmap(page); > foo = *ptr; > > Not sure if I'm missing something, but I think apps could cause the > kernel to access a not-present page and oops. The idea is that this memory should not be accessible by the kernel, so the sequence you describe should indeed fail. Probably oops would be to noisy and in this case the report needs to be less verbose. -- 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.7 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 E4C9EC4727F for ; Tue, 29 Sep 2020 13:07: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 627E0207F7 for ; Tue, 29 Sep 2020 13:07:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cnrl9iyf"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="kkoEdNeB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 627E0207F7 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=bZTAXpaUyHaBGMdiaZwECq/Qww72cmM3FbP1GpcFJjg=; b=cnrl9iyfS2yPCJKSqIjYicKja bwqrqkEQRSmr62XfCAWZt/JtapSx9AcLdbsb9WMTjNETftdZxLJmkxqSIzY12lMSby/vgu5bR0s+r N5GpiGUUv9KbwIfyWkNnuIiRJX5insoL499MxNMll/fKHYAGb1z9XcpHvLLulny/OKvLjJgfUymNk M/Wi20O5XwcLA1rjzNY9BulUKGFt+LwshbfRakkXdi1KoUdxnknZhkvQLEb8Vgh0aerwPrPv5CRV2 GpwWgyZZxA9WNkDpWHyQz1uYSYpB4vfUMJUM/rBYSFCl/DXFSXDK8ZvUbN1Tm6vTNQIKtZDc2Z3e6 HGL6MJ02A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNFKy-0003M5-Pf; Tue, 29 Sep 2020 13:06:32 +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 1kNFKq-0003HG-IC; Tue, 29 Sep 2020 13:06:28 +0000 Received: from kernel.org (unknown [87.71.73.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6DAC8207F7; Tue, 29 Sep 2020 13:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601384783; bh=dKs40EB0zUNqF3k8hOXDHChpW1qE+Tc5ZCaCj+fNcAI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kkoEdNeBwGUh5IVOWlI3TdmyaJCGl1uUtrsv4V7euPJfzeGsgVr9508rpCKlka84A TsDcDOdrDS9A4AaYCoyZ7lmCOsiredZMHpJsZ/ljNuc5atPQsZJCW42/ujWY54vc/A xHI6TcUVFoTK32LTlL0E1IvYKnm9SRUNQXn1aIps= Date: Tue, 29 Sep 2020 16:06:02 +0300 From: Mike Rapoport To: "Edgecombe, Rick P" Subject: Re: [PATCH v6 3/6] mm: introduce memfd_secret system call to create "secret" memory areas Message-ID: <20200929130602.GF2142832@kernel.org> References: <20200924132904.1391-1-rppt@kernel.org> <20200924132904.1391-4-rppt@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-20200929_090624_806229_55751195 X-CRM114-Status: GOOD ( 21.89 ) 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@arm.com" , "david@redhat.com" , "peterz@infradead.org" , "catalin.marinas@arm.com" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "linux-kselftest@vger.kernel.org" , "hpa@zytor.com" , "cl@linux.com" , "idan.yaniv@ibm.com" , "tglx@linutronix.de" , "Reshetova, Elena" , "linux-arch@vger.kernel.org" , "tycho@tycho.ws" , "arnd@arndb.de" , "linux-nvdimm@lists.01.org" , "shuah@kernel.org" , "x86@kernel.org" , "willy@infradead.org" , "rppt@linux.ibm.com" , "mingo@redhat.com" , "mtk.manpages@gmail.com" , "will@kernel.org" , "jejb@linux.ibm.com" , "bp@alien8.de" , "viro@zeniv.linux.org.uk" , "luto@kernel.org" , "paul.walmsley@sifive.com" , "kirill@shutemov.name" , "Williams, Dan J" , "linux-arm-kernel@lists.infradead.org" , "linux-api@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "palmer@dabbelt.com" , "linux-fsdevel@vger.kernel.org" , "akpm@linux-foundation.org" 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 Tue, Sep 29, 2020 at 04:58:44AM +0000, Edgecombe, Rick P wrote: > On Thu, 2020-09-24 at 16:29 +0300, Mike Rapoport wrote: > > Introduce "memfd_secret" system call with the ability to create > > memory > > areas visible only in the context of the owning process and not > > mapped not > > only to other processes but in the kernel page tables as well. > > > > The user will create a file descriptor using the memfd_secret() > > system call > > where flags supplied as a parameter to this system call will define > > the > > desired protection mode for the memory associated with that file > > descriptor. > > > > Currently there are two protection modes: > > > > * exclusive - the memory area is unmapped from the kernel direct map > > and it > > is present only in the page tables of the owning mm. > > Seems like there were some concerns raised around direct map > efficiency, but in case you are going to rework this...how does this > memory work for the existing kernel functionality that does things like > this? > > get_user_pages(, &page); > ptr = kmap(page); > foo = *ptr; > > Not sure if I'm missing something, but I think apps could cause the > kernel to access a not-present page and oops. The idea is that this memory should not be accessible by the kernel, so the sequence you describe should indeed fail. Probably oops would be to noisy and in this case the report needs to be less verbose. -- Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel