Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3777179pxk; Tue, 29 Sep 2020 06:08:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEgLPiIkNtYkajj4WuUSSacUpW0M0WoCm48KUpf6omylxUIP5M9itwdLIjX/nJjnzBEfb/ X-Received: by 2002:a17:906:2818:: with SMTP id r24mr3975116ejc.100.1601384900389; Tue, 29 Sep 2020 06:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601384900; cv=none; d=google.com; s=arc-20160816; b=WYhkepOFF+iBY8/RUnW3KsSeL9q5z+CYO8QVF0aQjChYR+v61KaK3bM9b2Lp+BqzGn VWGDHj7dhR2ykf1+jfzyj8BCg3njr30IX1qf2HRI0U6u3ROCsUuV1DB67oxpq8xfPFX7 TaB2lGAj2N/lXxzqPT7xFxU3VyTp8U62fOxxn38+CDaZBwDjdWJSSeE7v+Zs13ZL6yS3 VJUBb3NAMQDAqJOZDo11TqXOqHAX+BbEGv7is//yatwSWYgH+hfYXIIDRXvYKzkx3RWG nsz+kPlQDDrabOORU0nQzOmthv+l4YJf1JS+cy0tDAG7eOFGIk+rymriJiwBq4Mu0e25 6C3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZkQsmvasFJOn+dHUkJ6glfVIPw/Tg6IEvE8/ENdSBM4=; b=rp34n6aMjgasO8z8LOrG9Pl18daY73ktL/zeDcbvrBC/lEnsv89e8HVhElsi+j1r10 /qiUBLU2x1KNvIWGkgfcNimqW/2CPFJ3au5cytHCF4d4AMA/nQ7RRgEZxpj23CSzmykn F3NZwils5/VAg5EGg1kRPbD6yTCujk1vAnLQIE8al+68YLygSo5XM6vaUzB+JdV1c6v6 KAg8phRUV3Jb5EdUvG0sBHgJej65Y2s1FR+F4TXI0ZJJ3tGLA9qxm2FQBsYtUJXe6vni /ihygiDn5oNsoN1qfO0WoqLDxDFSUFIon2r1wQEBDdquw68wwQaLcrRC/W4HNbtgw+9c be9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kkoEdNeB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n26si2556035ejg.134.2020.09.29.06.07.56; Tue, 29 Sep 2020 06:08:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kkoEdNeB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728897AbgI2NGZ (ORCPT + 99 others); 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.