From patchwork Wed Sep 9 21:08:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 7149071 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BC145BEEC1 for ; Wed, 9 Sep 2015 21:14:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA8A62096E for ; Wed, 9 Sep 2015 21:14:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D66B020957 for ; Wed, 9 Sep 2015 21:14:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754022AbbIIVOi (ORCPT ); Wed, 9 Sep 2015 17:14:38 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:33047 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753937AbbIIVIt (ORCPT ); Wed, 9 Sep 2015 17:08:49 -0400 Received: by pacex6 with SMTP id ex6so20875535pac.0 for ; Wed, 09 Sep 2015 14:08:49 -0700 (PDT) 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:cc:cc:cc:cc:cc:cc:cc:cc:cc:cc:cc:cc :cc:cc:subject:date:message-id:in-reply-to:references; bh=LmHOkZqWHQT1xhspHIjLb1BcltuZmgrxmvsguXFBqUE=; b=M4sM1Sly1F2ags0z6cEqhv9sjPSdY2BltKRrmkP0fcziMiGV9oi4EZJtksXfIac3iG DV5tU8dxWnB+4AJUDGNbcjrpBbistYHv8kYm39bhepKJFTTq+QxQxCrAo0oa3VNMYnEG 6vqsI6Mo1NIXN7VK6VD7GkPPdh5JgRI9ANsy7qFd9bKxCM7pmTcNLevSf12VOVx6tweS Ty1OBce5gU9A/m4c7ntkUBw7Cxx6ZSqqGNuP0AhPBrsszflAzGWMm6/BpsNh/kxX6DrW sklz8RbjnEyq855Mqmd4XxOx4KwAvykoS4lMHPkqMNQ4XqxIjzjAIPErNrIJ7HhYGrV3 iOrQ== X-Gm-Message-State: ALoCoQnJAOchmoGHcRo3tDgRlafAhU+Ie2zTZ5soA1ZFgjzLTJrnOSymSRvqPo05Pnhkp469BxqI X-Received: by 10.67.2.98 with SMTP id bn2mr18430734pad.20.1441832929416; Wed, 09 Sep 2015 14:08:49 -0700 (PDT) Received: from localhost (wap-cal.CS.Berkeley.EDU. [128.32.35.228]) by smtp.gmail.com with ESMTPSA id gs2sm8029026pbc.15.2015.09.09.14.08.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Sep 2015 14:08:49 -0700 (PDT) From: Palmer Dabbelt To: arnd@arndb.de Cc: 3chas3@gmail.com Cc: hpa@zytor.com Cc: mingo@redhat.com Cc: plagnioj@jcrosoft.com Cc: jikos@kernel.org Cc: linux-api@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-atm-general@lists.sourceforge.net Cc: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: netdev@vger.kernel.org Cc: tglx@linutronix.de Cc: tomi.valkeinen@ti.com Cc: x86@kernel.org Cc: Palmer Dabbelt Subject: [PATCH 04/13] Always expose MAP_UNINITIALIZED to userspace Date: Wed, 9 Sep 2015 14:08:13 -0700 Message-Id: <1441832902-28993-5-git-send-email-palmer@dabbelt.com> X-Mailer: git-send-email 2.4.6 In-Reply-To: <1441832902-28993-1-git-send-email-palmer@dabbelt.com> References: <2644177.lVCYzIBfPW@wuerfel> <1441832902-28993-1-git-send-email-palmer@dabbelt.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This used to be hidden behind CONFIG_MMAP_ALLOW_UNINITIALIZED, so userspace wouldn't actually ever see it. While I could have kept hiding it, the man pages seem to indicate that MAP_UNINITIALIZED should be visible: mmap(2) MAP_UNINITIALIZED (since Linux 2.6.33) Don't clear anonymous pages. This flag is intended to improve performance on embedded devices. This flag is honored only if the kernel was configured with the CONFIG_MMAP_ALLOW_UNINITIALIZED option. Because of the security implications, that option is normally enabled only on embedded devices (i.e., devices where one has complete control of the contents of user memory). and since the only time it shows up in my /usr/include is in this header I believe this should have been visible to userspace (as non-zero, which wouldn't do anything when or'd into the flags) all along. Signed-off-by: Palmer Dabbelt Reviewed-by: Andrew Waterman Reviewed-by: Albert Ou --- include/uapi/asm-generic/mman-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h index ddc3b36f1046..e58d1911ecc6 100644 --- a/include/uapi/asm-generic/mman-common.h +++ b/include/uapi/asm-generic/mman-common.h @@ -19,7 +19,7 @@ #define MAP_TYPE 0x0f /* Mask for type of mapping */ #define MAP_FIXED 0x10 /* Interpret addr exactly */ #define MAP_ANONYMOUS 0x20 /* don't use a file */ -#ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED +#if !defined(__KERNEL__) || defined(CONFIG_MMAP_ALLOW_UNINITIALIZED) # define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */ #else # define MAP_UNINITIALIZED 0x0 /* Don't support this flag */