Received: by 10.223.176.5 with SMTP id f5csp225970wra; Thu, 8 Feb 2018 20:27:05 -0800 (PST) X-Google-Smtp-Source: AH8x225Y24+qcGvTtgTcT3uZStfWjZsZN95UEvW68/OoglmJowmwSp7abVs/jrlxePpnZs2ldge8 X-Received: by 2002:a17:902:7c18:: with SMTP id x24-v6mr1276425pll.432.1518150425224; Thu, 08 Feb 2018 20:27:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518150425; cv=none; d=google.com; s=arc-20160816; b=mD8O7rxtEWoKdB/u7s5v/x9R+fk7KNPbMmOPHLHOy7jplZq9hf8exFuUKiauA8Ejli sNxYzYDl47+4qBZ6G/XVAw8Awlzl6GcOqE4k4koPHbQmC8MgcPgyZR1xU7wYTUVe8/M7 gNxqHeYxKS7Nhu/qAVD/FBp/79TgCFALFiLtnzlaorsqYhncQx2z4EHwx/EonW6I/FZi VbiqSavnHtCIxhJ+AVE3MEFYvSvcOH3pNPiMCS+HGWDQ1q1NQYZT53S/+wQSggL1rtiH YPdTKHDPqAx6t3z80bGoEKzJV3IOOtroBURcsQOBeD1jDH1CJEvWu3ClpERM2NaEyuMm 8qnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=r3sgS2BZTUK9oJ1iMBlXg+riVkMsgo5zKcCAWn+/05E=; b=aSGtyDrF33W/FaA1/L3RUocvIFll9h31UFxFPOuat2iaim1gDsyKIOMMXEIi5cgp1u xnVW2tvG1LeYXEPNQgYB5EjLAKgsm5Z1RTBGSpOEuDl8FrzR70BJG1dch37qsepeNP3c VY1SWoYU1S/91fIW8SC6P9trbIp76Vudf8/gBPtr57W/WgwLOF6G2nIwykk8ctu+gm27 VrYNZpLQmP18ltdJ2K51AWU4EDCRaI7/87LWnC8W1KH8kNNRQWBnftI3ew9KTJN7xDeg 8edjC6PWe7UOrHG+tEfbIlYNMG4NRjT2dl65/BGtoTYlHQfjhwqpnLimPCy81sqYNQKT XGJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=wCDupEbO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21-v6si978016plr.109.2018.02.08.20.26.50; Thu, 08 Feb 2018 20:27:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=wCDupEbO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752540AbeBIE0P (ORCPT + 99 others); Thu, 8 Feb 2018 23:26:15 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:39972 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752267AbeBIE0N (ORCPT ); Thu, 8 Feb 2018 23:26:13 -0500 Received: by mail-wm0-f67.google.com with SMTP id v123so13834052wmd.5 for ; Thu, 08 Feb 2018 20:26:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=r3sgS2BZTUK9oJ1iMBlXg+riVkMsgo5zKcCAWn+/05E=; b=wCDupEbOqv9MlHXqJlHs/spW9PMI9WJ1phhOZ180Z8HdD9l0HFAFdgTNB5DJaVSp0b uYt4AMEnHC5rMiItO7DtxPkkwAk1DY9yHd1OQp7xMatlF8uanwe3sZy7lRTRsDeiyajr 9Ij7s28VfyST0b2+5PNzvXXK8s1K8PhdVCosPqwxGsSXxukGaxE0jLpAxuhw+ztEtRAV WAyUT9698S8ICkObL+6DlRSN1W9/PEGt4gjLdVl9VvrxZPZ0/mf1r7e/+jCctv9rNYh6 +ccgeykZ6S6vMgKD8xRCOtf9q5jKlRHYFCDw8N2NuTYUzyXIQo9Nt2koCZFke2zWKI5Q QFWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=r3sgS2BZTUK9oJ1iMBlXg+riVkMsgo5zKcCAWn+/05E=; b=lVI5TZ6CH0jWi2/dVbBDLZyLnp2nSEqGcBZhG57GMbzuSYMiM8Dj3UtMAAMmT40BWH /g9C7wU8ciBC+FvB7VX95hImonz1ETA3/8c/hwz/RIkLqjXllchztQXV8H75oB8Jhh2y yuC1K+N4tM/jlkXuTdDRimkctdn8vDnw766edjT86RQiJtg9FFXYY3rIs9YJgbBlBJ4y JKt+B0Aj5HG4YaZdKu5QQTi6SrYlOReKRtZcRBBc7+F4Bb5ouyiqZavpQ3PV2Te0IsfS oMTiHjgQD+AqLbiyHbmVDvKtx4qXIzpDDg525otsgxJQbzlRHMB1jKoD8KmHJxjEEYqv RUnA== X-Gm-Message-State: APf1xPAdiDcq83mlDQt/S1WN70Lnp8MdSsZ162bOBHD+toyuEhOmNyiw ownNAfB75YFdnoCE+VflLXDOqg== X-Received: by 10.80.230.148 with SMTP id z20mr1790647edm.61.1518150372332; Thu, 08 Feb 2018 20:26:12 -0800 (PST) Received: from node.shutemov.name ([178.121.192.223]) by smtp.gmail.com with ESMTPSA id f16sm692004edj.68.2018.02.08.20.26.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 20:26:10 -0800 (PST) Received: by node.shutemov.name (Postfix, from userid 1000) id AA44F648D520; Fri, 9 Feb 2018 07:26:09 +0300 (+03) Date: Fri, 9 Feb 2018 07:26:09 +0300 From: "Kirill A. Shutemov" To: Matthew Wilcox Cc: Daniel Micay , Jann Horn , linux-mm@kvack.org, Kernel Hardening , kernel list , "Kirill A. Shutemov" Subject: Re: [RFC] Limit mappings to ten per page per process Message-ID: <20180209042609.wi6zho24wmmdkg6i@node.shutemov.name> References: <20180208021112.GB14918@bombadil.infradead.org> <20180208185648.GB9524@bombadil.infradead.org> <20180208194235.GA3424@bombadil.infradead.org> <20180208202100.GB3424@bombadil.infradead.org> <20180208213743.GC3424@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180208213743.GC3424@bombadil.infradead.org> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 08, 2018 at 01:37:43PM -0800, Matthew Wilcox wrote: > On Thu, Feb 08, 2018 at 12:21:00PM -0800, Matthew Wilcox wrote: > > Now that I think about it, though, perhaps the simplest solution is not > > to worry about checking whether _mapcount has saturated, and instead when > > adding a new mmap, check whether this task already has it mapped 10 times. > > If so, refuse the mapping. > > That turns out to be quite easy. Comments on this approach? This *may* break some remap_file_pages() users. And it may be rather costly for popular binaries. Consider libc.so. -- Kirill A. Shutemov