Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1445657pxb; Wed, 4 Nov 2020 09:06:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJysVYPDDsfVCuZbSeL1TUzeoNbcrok4cq1+I/ga4sneOHnP9V6hHYLJkjpx8pmAJZRhkqP9 X-Received: by 2002:a17:906:6d83:: with SMTP id h3mr25540032ejt.481.1604509560575; Wed, 04 Nov 2020 09:06:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604509560; cv=none; d=google.com; s=arc-20160816; b=f4FFSopfcW7GT3SbgOv4POzBxRxTJ5vzn9EmAolb6SYj6QQo+g0P8NU+EwSFVTBLt0 Lsymvrfq6Vg04TlmEaIo6Tnhb8BiHRRxPwK5G0xmc9WR19xycOmjr2BA4DLq/POlxKlt gc2haL+ZwphUGutlFBWBIpW4yqCUvazCHpsqbmj+EMnMtA2moVe+CdqD0ziAe1JalAS+ xfQ7fIKt2mLxXABsnyqDodWNhlMUtjII/ezH0P194Ja3hGGDbRPKwZlOD0hIJpK63/qO Zu9fsaoklG5SEkeo/OD6sDWSlXZOGRMd4B5h+s5yh5goaNvgIf7Dyz2Y3XjISbiWtIAj E9Bw== 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=Mw/sU+WdeN7LxEwq5SHdB6Duook8/7r2Ae30jSmRDdQ=; b=LiVR39G+TeCdtFahZqp+lJuzN2pUQo9VN84ZSdoCn8FGc0cL71pyOb5D03PL19WEDE 2cYDK7S3b374x0LafL6AeHWbWd7uoUXUXIp8sLDZebLDr7tILr8ot0t4XZNCfNSrzcd2 1i3GFi+SNLQJSvzqvvaKBy9mR1VtOvOTX13oFVjsNgegfS07376olyp8fA2OsOgTSRic llQHUDkQyA8b8cK391p3hMxKlfoGtEMS959AgauDOFrw9em7KHvH8y860O33BwWnkSmd qfJxPFu5jvVtjmOkegpgfujlTgv1cbFOWSSQztdC+wsUGLugOU6dga7SbMB3Aarciibf N00Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cbMszixD; 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 d4si1612836edr.173.2020.11.04.09.05.35; Wed, 04 Nov 2020 09:06:00 -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=@kernel.org header.s=default header.b=cbMszixD; 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 S1731596AbgKDRDG (ORCPT + 99 others); Wed, 4 Nov 2020 12:03:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:54018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732031AbgKDRDF (ORCPT ); Wed, 4 Nov 2020 12:03:05 -0500 Received: from kernel.org (unknown [87.71.17.26]) (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 8FD9C2071A; Wed, 4 Nov 2020 17:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604509384; bh=rNITg8eagPnFNzCzxObVDyyyLvNDMpMqrDKWRtXNo1Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cbMszixDY/CCQ4Uoej0yke6wNx2huYgP8NhaGqEXUCQOQ+71BtRjL4UN747/oLhHT jlOUbEPtbSsAUpPtJ4TKfNUm3RxZ3UFt+v7azAmQtFc9r46TIiMsgPqIFvZ1tNT9dj lpdbGPMmI1FpQwRmAzKJsAvG+FlUBcvCqAD3nWrU= Date: Wed, 4 Nov 2020 19:02:47 +0200 From: Mike Rapoport To: Hagen Paul Pfeifer Cc: Andrew Morton , Alexander Viro , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christopher Lameter , Dan Williams , Dave Hansen , David Hildenbrand , Elena Reshetova , "H. Peter Anvin" , Idan Yaniv , Ingo Molnar , James Bottomley , "Kirill A. Shutemov" , Matthew Wilcox , Mark Rutland , Mike Rapoport , Michael Kerrisk , Palmer Dabbelt , Paul Walmsley , Peter Zijlstra , Thomas Gleixner , Shuah Khan , 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 Subject: Re: [PATCH v6 0/6] mm: introduce memfd_secret system call to create "secret" memory areas Message-ID: <20201104170247.GT4879@kernel.org> References: <20200924132904.1391-1-rppt@kernel.org> <20201101110935.GA4105325@laniakea> <20201102154028.GD4879@kernel.org> <1547601988.128687.1604411534845@office.mailbox.org> <20201103163002.GK4879@kernel.org> <1988407921.138656.1604489953944@office.mailbox.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1988407921.138656.1604489953944@office.mailbox.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 04, 2020 at 12:39:13PM +0100, Hagen Paul Pfeifer wrote: > > On 11/03/2020 5:30 PM Mike Rapoport wrote: > > > > > > As long as the task share the file descriptor, they can share the > > > > secretmem pages, pretty much like normal memfd. > > > > > > Including process_vm_readv() and process_vm_writev()? Let's take a hypothetical > > > "dbus-daemon-secure" service that receives data from process A and wants to > > > copy/distribute it to data areas of N other processes. Much like dbus but without > > > SOCK_DGRAM rather direct copy into secretmem/mmap pages (ring-buffer). Should be > > > possible, right? > > > > I'm not sure I follow you here. > > For process_vm_readv() and process_vm_writev() secremem will be only > > accessible on the local part, but not on the remote. > > So copying data to secretmem pages using process_vm_writev wouldn't > > work. > > A hypothetical "dbus-daemon-secure" service will not be *process related* with communication > peers. E.g. a password-input process (reading a password into secured-memory page) will > transfer the password to dbus-daemon-secure and this service will hand-over the password to > two additional applications: a IPsec process on CPU0 und CPU1 (which itself use a > secured-memory page). > > So four applications IPC chain: > password-input -> dbus-daemon-secure -> {IPsec0, IPsec1} > > - password-input: uses a secured page to read/save the password locally after reading from TTY > - dbus-daemon-secure: uses a secured page for IPC (legitimate user can write and read into the secured page) > - IPSecN has secured page to save the password locally (and probably other data as well), IPC memory is memset'ed after copy > > Goal: the whole password is never saved/touched on non secured pages during IPC transfer. > > Question: maybe a *file-descriptor passing* mechanism can do the trick? I.e. dbus-daemon-secure > allocates via memfd_secret/mmap secure pages and permitted processes will get the descriptor/mmaped-page > passed so they can use the pages directly? Yes, this will work. The processes that share the memfd_secret file descriptor will have access to the same memory pages, pretty much like with shared memory. > Hagen -- Sincerely yours, Mike.