From patchwork Tue Nov 20 05:25:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10689871 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 264DB14BD for ; Tue, 20 Nov 2018 05:26:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12D6A29E91 for ; Tue, 20 Nov 2018 05:26:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 023DB2A270; Tue, 20 Nov 2018 05:26:22 +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=unavailable 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 A804529E91 for ; Tue, 20 Nov 2018 05:26:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731276AbeKTPxf (ORCPT ); Tue, 20 Nov 2018 10:53:35 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43351 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726977AbeKTPx2 (ORCPT ); Tue, 20 Nov 2018 10:53:28 -0500 Received: by mail-pf1-f194.google.com with SMTP id w73so408572pfk.10 for ; Mon, 19 Nov 2018 21:26:14 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=zlg2BFvpO7N1LBcQOttmC1j4ff35OqfPa7Fz4hl7aNc=; b=CNL1TxkS1xvKvPZcGrbZbweiOfD4Pjg27Q/Pu5prr2NEG9NsAVXQB/cPZTVq3tyMEf IJx11gETOKnP2M3HzrXEcnGT6ra/1aI8fhqp3VosMYIf+rxLmpdN5vjBcRUiTB+aMlKj NfcZr2BWyROpf4Kg4RvYTDmFHzp6YeV+HuPGI= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=zlg2BFvpO7N1LBcQOttmC1j4ff35OqfPa7Fz4hl7aNc=; b=YF9/ag2e9UPJcTLqbJNnSeyECdE40Vn+MqbiNAVrfx84/Xrc2sLtiHiUu9onP1RmA4 WEEkenoN1++joa72QKeJAJRBxwyPFWg5S6Sdq055+YPb7Vd+EH6gnAam6MKZD8NMN7dJ 7GqHBnXeXardMKqzCb3rwM8PoOzKyeKYd8eHaD6d6GHBHI3ATBBuE/oSWy8E13rkkJ2n Cqo1ZF475OEn551MQ5W48dp4mpfZ8uCpK4mrVZJAwIc2j32Tcg7O57F8wtPjJFrexfjo DyaBaHhfdSbFlmNA5WfGnknOHVYJWGV3t6T7B/Tpg3mAIqg8Jn1zUZ+FwQMk6DHep+Ay 7uDg== X-Gm-Message-State: AA+aEWaIF8gh4SkCBuGBRr3cyNSCmKEJYGTPRQyFSQrrRljZPaVc4C8z pS3TdZ3sHTGanhChooGXGN1MlA== X-Google-Smtp-Source: AFSGD/WpUCMerWrtK83rmC82n57049I4elRaWXN1N/YBSNcmqX1+4FNiqYY3UoDahic8VAH9KCpT+g== X-Received: by 2002:a63:8d44:: with SMTP id z65mr655725pgd.57.1542691573698; Mon, 19 Nov 2018 21:26:13 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 21:26:12 -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 2/2] memfd_create.2: Update manpage with new memfd F_SEAL_FUTURE_WRITE seal Date: Mon, 19 Nov 2018 21:25:45 -0800 Message-Id: <20181120052545.76560-2-joel@joelfernandes.org> X-Mailer: git-send-email 2.19.1.1215.g8438c0b245-goog In-Reply-To: <20181120052545.76560-1-joel@joelfernandes.org> References: <20181120052545.76560-1-joel@joelfernandes.org> 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/memfd_create.2 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/man2/memfd_create.2 b/man2/memfd_create.2 index 3cd392d1b4d9..fce2bf8d0fff 100644 --- a/man2/memfd_create.2 +++ b/man2/memfd_create.2 @@ -280,7 +280,15 @@ in order to restrict further modifications on the file. (If placing the seal .BR F_SEAL_WRITE , then it will be necessary to first unmap the shared writable mapping -created in the previous step.) +created in the previous step. Otherwise, behavior similar to +.BR F_SEAL_WRITE +can be achieved, by using +.BR F_SEAL_FUTURE_WRITE +which will prevent future writes via +.BR mmap (2) +and +.BR write (2) +from succeeding, while keeping existing shared writable mappings). .IP 4. A second process obtains a file descriptor for the .BR tmpfs (5) @@ -425,6 +433,7 @@ main(int argc, char *argv[]) fprintf(stderr, "\\t\\tg \- F_SEAL_GROW\\n"); fprintf(stderr, "\\t\\ts \- F_SEAL_SHRINK\\n"); fprintf(stderr, "\\t\\tw \- F_SEAL_WRITE\\n"); + fprintf(stderr, "\\t\\tW \- F_SEAL_FUTURE_WRITE\\n"); fprintf(stderr, "\\t\\tS \- F_SEAL_SEAL\\n"); exit(EXIT_FAILURE); } @@ -463,6 +472,8 @@ main(int argc, char *argv[]) seals |= F_SEAL_SHRINK; if (strchr(seals_arg, \(aqw\(aq) != NULL) seals |= F_SEAL_WRITE; + if (strchr(seals_arg, \(aqW\(aq) != NULL) + seals |= F_SEAL_FUTURE_WRITE; if (strchr(seals_arg, \(aqS\(aq) != NULL) seals |= F_SEAL_SEAL; @@ -518,6 +529,8 @@ main(int argc, char *argv[]) printf(" GROW"); if (seals & F_SEAL_WRITE) printf(" WRITE"); + if (seals & F_SEAL_FUTURE_WRITE) + printf(" FUTURE_WRITE"); if (seals & F_SEAL_SHRINK) printf(" SHRINK"); printf("\\n");