From patchwork Sat Sep 3 18:11:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitrii Shcherbakov X-Patchwork-Id: 15270 Received: (qmail 112735 invoked by alias); 3 Sep 2016 18:12:15 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 109462 invoked by uid 89); 3 Sep 2016 18:12:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1426, 3713, 37, 13, overwriting X-HELO: mail-lf0-f68.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=snz6VxkuLGC6xA6cTthLkzUEok9TTbFFsEs/fcNjMKY=; b=PEKXXGCt8zLL+Rvt5odrVCFL2Es6VjpiUdORObIjUljH/GmyuH6WS6hVWjMrrEF+UH OeWpxpg3AxlX5zgtAd+L0UloDVBJexAIyXCIT4H00QHInXT5OWhtrtvVzSvQIoN9vD3N ITxlYOMlEDaG+dua5sf+oZMtthY+zDOlTz+JYmkDuMX1uK1dIavy6D+VJA1/TQzVuM/z ic0FnYJ7XGnYdhJvZJydkbljv1hSam0BsnzZERmO5NrIuWx3mNGQOjKxO0qtIi7ibGdF J5KF+u83QHiuD1Y1I9e6ClHY8THfut0zonpwhqBTJa6G7mpa9hTAdCLQXXvFOZQ+LfNn Zx8w== X-Gm-Message-State: AE9vXwPL49a7NnsqaYQa6P1NZamn/Gr/b87eDQLQN1DHAlGyrCTwLIlXQ5M0kQE6c2EKgQ== X-Received: by 10.25.39.85 with SMTP id n82mr2213229lfn.200.1472926330834; Sat, 03 Sep 2016 11:12:10 -0700 (PDT) From: Dmitrii Shcherbakov To: libc-alpha@sourceware.org Cc: Dmitrii Shcherbakov Subject: [PATCH] dl-load.h: Remove MAP_DENYWRITE from MAP_COPY definition Date: Sat, 3 Sep 2016 21:11:18 +0300 Message-Id: <1472926278-23144-2-git-send-email-fw.dmitrii@gmail.com> In-Reply-To: <1472926278-23144-1-git-send-email-fw.dmitrii@gmail.com> References: <1472926278-23144-1-git-send-email-fw.dmitrii@gmail.com> The Linux kernel no longer uses this flag in mmap other than for compatibility purposes. In fact, its support was removed many years ago according to the mmap man page. Let's remove it to avoid confusing output in strace and fix a comment about this flag doing what it does not anymore. Signed-off-by: Dmitrii Shcherbakov ChangeLog: * elf/dl-load.h: Remove MAP_DENYWRITE from MAP_COPY d --- elf/dl-load.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/elf/dl-load.h b/elf/dl-load.h index 9fe7118..622c0bc 100644 --- a/elf/dl-load.h +++ b/elf/dl-load.h @@ -37,14 +37,13 @@ from the new version after starting with pages from the old version. To make up for the lack and avoid the overwriting problem, - what Linux does have is MAP_DENYWRITE. This prevents anyone - from modifying the file while we have it mapped. */ + what Linux used to have was MAP_DENYWRITE. + This prevented anyone from modifying the file while it was mapped, + creating a denial-of-service attack possibility by using mmap given + read permissions to a file. + */ #ifndef MAP_COPY -# ifdef MAP_DENYWRITE -# define MAP_COPY (MAP_PRIVATE | MAP_DENYWRITE) -# else -# define MAP_COPY MAP_PRIVATE -# endif +# define MAP_COPY MAP_PRIVATE #endif /* Some systems link their relocatable objects for another base address