Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2010560pxb; Thu, 11 Feb 2021 01:45:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJybCgdhsMWL0LMm+0+NDM8Pc1/2D2cyqvEue0WvL+38GplMgHIgSzQjBIlc/Hls1BgPJeNt X-Received: by 2002:a17:906:17c3:: with SMTP id u3mr7515373eje.304.1613036740210; Thu, 11 Feb 2021 01:45:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613036740; cv=none; d=google.com; s=arc-20160816; b=NX1fw100DaHSXluqtpQex2LbB8x+RD599PNGRSp0iVONVNXgZ1ZRxBKeoOifFTESLM AeXZWnRFExdVtnX7oympkzxftNLW96rEqFMD0zws9jZSWS75HdYP+dDHYwXT/jvdjvCf 4mY9F9z+53ZMh2Ngb+IKsFFQ7UsLxAwsHyoN8yFFY7SOOXMH1yus5c7vkm3CY3O7CZnV pOCv7OZUTyGD1X+0JNsv8+jm40jcO8UxJPcvmwDVBhS1n/xj/UQBgBk4G5JmhSb32PQd 9N9ajogKqSuVRxuLNXJQs50qEhf3OIx/zlouHJvz+0Px+bBIGSpsCytbSaA8lA8xkcL2 +u5g== 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=IgmP4ChnF5ylKST2wdnNkKGWWTfAZndBC/g6lnPZqtQ=; b=m+DmRRV4dFddd2ZhCvugwN9Jphti/9UOYtCHZeI+twOdP+zn57haQiO3/W9W5nmT7Q G4/ZiTzMhaHQ2v3ByKc18HAbMNNeKNcOSQpJ5cx09O2J5Y4mI7x3vf0Nb6DFQv20TZJS FoZEJN2uibJ7bWxQxD62TEcnL3MEp8ZpGCFg3MMfhbDwJUuTzNuUlfn7H52TGa82I2sU 8jc15uJ5JwvrAP3vlPk5NMd4A0vysPO6ZxfK2QBiQ6LYw8HSXBsWOYcLm/CspOfJll1E lim2UbZsKgqFt6nlSLE0AaVfZpZGJaK9jIVsCJDxvoUGcdVMRT/nrkV+aK/pF8kiRUMB +fCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=gFxEQ1Hx; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a67si3557256edf.42.2021.02.11.01.45.16; Thu, 11 Feb 2021 01:45:40 -0800 (PST) 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=@suse.com header.s=susede1 header.b=gFxEQ1Hx; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230228AbhBKJnG (ORCPT + 99 others); Thu, 11 Feb 2021 04:43:06 -0500 Received: from mx2.suse.de ([195.135.220.15]:52212 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbhBKJiv (ORCPT ); Thu, 11 Feb 2021 04:38:51 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1613036284; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IgmP4ChnF5ylKST2wdnNkKGWWTfAZndBC/g6lnPZqtQ=; b=gFxEQ1HxiWSFhHn1jwSJVEwHxVpSlJMv6PB7Y1NSZ1/b8fSyhPfVk7yywgPmO4H7XJin/6 OHl4FZuzyl9SmIpoocVwVNameXLeVOeaSYvQ7jYywhTiC1cf9hdrm6CSlrhOU+pV14KgLG e4bGEV2hXCQzrmyfIJHQUSLivHm63jQ= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8538FADE3; Thu, 11 Feb 2021 09:38:04 +0000 (UTC) Date: Thu, 11 Feb 2021 10:38:03 +0100 From: Michal Hocko To: David Hildenbrand Cc: Mike Rapoport , 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: References: <20210208084920.2884-1-rppt@kernel.org> <20210208084920.2884-8-rppt@kernel.org> <20210208212605.GX242749@kernel.org> <20210209090938.GP299309@linux.ibm.com> <20210211071319.GF242749@kernel.org> <0d66baec-1898-987b-7eaf-68a015c027ff@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0d66baec-1898-987b-7eaf-68a015c027ff@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 11-02-21 10:01:32, David Hildenbrand wrote: [...] > AFAIKS, we would need MFD_SECRET and disallow > MFD_ALLOW_SEALING and MFD_HUGETLB. Yes for an initial version. But I do expect a request to support both features is just a matter of time. > In addition, we could add MFD_SECRET_NEVER_MAP, which could disallow any kind of > temporary mappings (eor migration). TBC. I believe this is the mode Mike wants to have by default. A more relax one would be an opt-in. MFD_SECRET_RELAXED which would allow temporal mappings in the kernel for content copying (e.g. for migration). > --- > > Some random thoughts regarding files. > > What is the page size of secretmem memory? Sometimes we use huge pages, > sometimes we fallback to 4k pages. So I assume huge pages in general? Unless there is an explicit request for hugetlb I would say the page size is not really important like for any other fds. Huge pages can be used transparently. > What are semantics of MADV()/FALLOCATE() etc on such files? I would expect the same semantic as regular shmem (memfd_create) except the memory doesn't have _any_ backing storage which makes it unevictable. So the reclaim related madv won't work but there shouldn't be any real reason why e.g. MADV_DONTNEED, WILLNEED, DONT_FORK and others don't work. > I assume PUNCH_HOLE fails in a nice way? does it work? > Does mremap()/mremap(FIXED) work/is it blocked? > Does mprotect() fail in a nice way? I do not see a reason why those shouldn't work. > Is userfaultfd() properly fenced? Or does it even work (doubt)? > > How does it behave if I mmap(FIXED) something in between? > In which granularity can I do that (->page-size?)? Again, nothing really exceptional here. This is a mapping like any other from address space manipulation POV. > What are other granularity restrictions (->page size)? > > Don't want to open a big discussion here, just some random thoughts. > Maybe it has all been already figured out and most of the answers > above are "Fails with -EINVAL". I think that the behavior should be really in sync with shmem semantic as much as possible. Most operations should simply work with an aditional direct map manipulation. There is no real reason to be special. Some functionality might be missing, e.g. hugetlb support but that has been traditionally added on top of shmem interface so nothing really new here. -- Michal Hocko SUSE Labs