From patchwork Tue Nov 20 05:25:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10689865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD70314BD for ; Tue, 20 Nov 2018 05:26:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C58A129E91 for ; Tue, 20 Nov 2018 05:26:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE7722A341; Tue, 20 Nov 2018 05:26:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14ABF29E91 for ; Tue, 20 Nov 2018 05:26:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728693AbeKTPx0 (ORCPT ); Tue, 20 Nov 2018 10:53:26 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:40418 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726905AbeKTPx0 (ORCPT ); Tue, 20 Nov 2018 10:53:26 -0500 Received: by mail-pl1-f195.google.com with SMTP id b22-v6so405776pls.7 for ; Mon, 19 Nov 2018 21:26:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rhPoQZhqgkEYd2R0TR94fBIobE2oIUczJVXl8rOT65A=; b=d0VOLtUkBjUsWwJ2X8edrqI7xaMpeXVg2YL7CxPVLDyWuMqlVL4fj8yAHE+xG9IZWB 49okWuYT2X7C5NpJe5AjJQqAT6HGfIgHoCDJdB6L2zBwcDKBXsIqKRy9Z9kBBTqJQDNo Zjk7sg0hCinUvDgSYGHPVpQrBpcRqy1qz4ets= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rhPoQZhqgkEYd2R0TR94fBIobE2oIUczJVXl8rOT65A=; b=UWgsY0RuA/xY6BsLjtikyBM2ko3vL4VZqqkyS/mU+wBn5nFj6FJXpHIXzHjUFQm2Ma h1QTOHFqybCliZkQLAmhYgLs4dncrrAGw0q8iVh4MlTIXynk/L4q2mrC3TT3l1F6c4KN 4bmyvkwqonvO681lfvL4d4QpERgsVRh+jpXQ8Dr/PD81DW0A1/aGGQDOaycNTBEQ+1om 4LucWPHyLbdCaJjACFfpJfodxnfuQfvIYpr1Az5UtR+m6avwe8rGBbAEF6dpijKsbbCJ rLopqq6uGvFMLRmddxhSmWttIg3fit8Rs8gQq5sUJKZrGswyqFB+k7bbvcVf2JGYn2gD QYNQ== X-Gm-Message-State: AA+aEWZYnnBu+4Z0s2wDn344HJXh0cXr0CpaTtoyhDRM5DdyRmxDSA0T 7c2cQ2Ge/YDT09HdmJBQFdpBgw== X-Google-Smtp-Source: AFSGD/VVeYLa9QA/bxhkOMA/ndTVgu3RmCtiaib129NDCRTVz6dGKpjvtQgnM2eJskFnuafM5NXj2w== X-Received: by 2002:a17:902:66e5:: with SMTP id e92-v6mr772902plk.92.1542691572002; Mon, 19 Nov 2018 21:26:12 -0800 (PST) Received: from joelaf.mtv.corp.google.com ([2620:0:1000:1601:3aef:314f:b9ea:889f]) by smtp.gmail.com with ESMTPSA id p6sm20574271pfn.53.2018.11.19.21.26.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 21:26:11 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-man@vger.kernel.org Cc: "Joel Fernandes (Google)" , Andrew Morton , Andy Lutomirski , Hugh Dickins , Jann Horn , John Stultz , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Matthew Wilcox , Mike Kravetz , Shuah Khan , Stephen Rothwell Subject: [PATCH -manpage 1/2] fcntl.2: Update manpage with new memfd F_SEAL_FUTURE_WRITE seal Date: Mon, 19 Nov 2018 21:25:44 -0800 Message-Id: <20181120052545.76560-1-joel@joelfernandes.org> X-Mailer: git-send-email 2.19.1.1215.g8438c0b245-goog MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP More details of the seal can be found in the LKML patch: https://lore.kernel.org/lkml/20181120052137.74317-1-joel@joelfernandes.org/T/#t Signed-off-by: Joel Fernandes (Google) --- man2/fcntl.2 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/man2/fcntl.2 b/man2/fcntl.2 index 03533d65b49d..54772f94964c 100644 --- a/man2/fcntl.2 +++ b/man2/fcntl.2 @@ -1525,6 +1525,21 @@ Furthermore, if there are any asynchronous I/O operations .RB ( io_submit (2)) pending on the file, all outstanding writes will be discarded. +.TP +.BR F_SEAL_FUTURE_WRITE +If this seal is set, the contents of the file can be modified only from +existing writeable mappings that were created prior to the seal being set. +Any attempt to create a new writeable mapping on the memfd via +.BR mmap (2) +will fail with +.BR EPERM. +Also any attempts to write to the memfd via +.BR write (2) +will fail with +.BR EPERM. +This is useful in situations where existing writable mapped regions need to be +kept intact while preventing any future writes. For example, to share a +read-only memory buffer to other processes that only the sender can write to. .\" .SS File read/write hints Write lifetime hints can be used to inform the kernel about the relative