Received: by 10.223.185.116 with SMTP id b49csp293561wrg; Fri, 2 Mar 2018 19:29:05 -0800 (PST) X-Google-Smtp-Source: AG47ELsh6dsGlxaOmpKixdq/Y1l3wzfjyNmwbZAjQZkzj+3w11/o9LSIvekO5SnK/WCLsGOiPv7u X-Received: by 10.99.96.66 with SMTP id u63mr6369415pgb.49.1520047745725; Fri, 02 Mar 2018 19:29:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520047745; cv=none; d=google.com; s=arc-20160816; b=wLByzFZ2Q0L3ADdSopRGURbNL79sD6ICMcZaJBSWIAcSwv+TLV9o3IaWjiz/Glnhvk J1fWuaO5qhNU7Ko6YnuLwDWTKzvRwGboEOtCPncdFQNaHOe1pY0QUd93lkuoaVq7ZP+N IUHB6+Lv8d4g2yIXUc5iA7PbVx1ZdDhH8MO1YE3626+WrnF7A8RqrrxJnerONUmrIgRj Jz5ug+WiMmgvN4Gl6AU6UMPVVoctBwVeR5gru/3/Ief3n81FXGKDX1By9gzGqW95h8OC ykvfSDUv6IQP2vWsXFlqoJL1z9ddf/8JQLkbT0nlUoPyZM8seBT7UWYngwYHa/SxY7vj tYSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=x8m3SniJ6Pmg92vMCrd/0AJzc+gCfc3kFfRvbq3UyGo=; b=Ofak9ggGubd9/ZCFEHK8Jj5ocXMjPnE0bWlf2FPApjlBdZyL3V5zOfS3GDX+ypHIhp y9QN4uKEXgCTMz41moRfo2TT5QIZVy62iiA9rlr9gHRXckcmflm+HZW0drCBETLYz4VG hFNxxNaNK8jLAdWjItjULOmEVyWbJW2ianhGi0wmhA1M722GP22lKcB8uG2BJMNVnMNo igZIzcV/OPOvfpqp2Knb4iLP29S9dsy6t/dW8a6ikw2kI5DJoRcvGGDjmHg/NxJRKNox a737saUEmExwjyhXRDRsjGScje+UkhU7Xe196R2boL4UkrM/TCl/a2D1n9ORaQZPt9tz X1Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BBtYYwq0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t199si4916509pgb.105.2018.03.02.19.28.51; Fri, 02 Mar 2018 19:29: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=@gmail.com header.s=20161025 header.b=BBtYYwq0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932879AbeCBUae (ORCPT + 99 others); Fri, 2 Mar 2018 15:30:34 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:44149 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932830AbeCBUac (ORCPT ); Fri, 2 Mar 2018 15:30:32 -0500 Received: by mail-lf0-f65.google.com with SMTP id v9so14998752lfa.11 for ; Fri, 02 Mar 2018 12:30:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=x8m3SniJ6Pmg92vMCrd/0AJzc+gCfc3kFfRvbq3UyGo=; b=BBtYYwq0oJGrJroISu08NTz0r+dScdMAfxrnlOtWhhpn4WVmiVmEKTAAYOamBYCKZO YjPtVVvCL5z0sRAb33kKgnktfFjqD/UdUBbaK9zHqIRVYKYOc0ulxsggJuOoP9nCWlOT /cdoheSfDynv0wiJX5u4XBBdANVgj94EMcZtllmXQ0ok1yMx5X/rKHRHIZL4DNmRQewK oRa08lJzaiXrA7aLTfng1BpCe4FWkEh/dfBPCM7TnlbZ3cW/ZfN+I2iA3g8sznE5xwzI 4avc1qRdV08qROjfYqrCi4mAsYrzQLDZyNxngGQZuofVkcLQMPP4syXH0T4gfsCrrm2T gulQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=x8m3SniJ6Pmg92vMCrd/0AJzc+gCfc3kFfRvbq3UyGo=; b=STp+rQ6DpO1q2KTjzuoc9befwFYKp4ESnLxTA+mWPBXujQRgZ4EgiDJ6lxCNa5NiS4 RfYMo6hzJXuXk/VRLZu78Bv9vdH+9/zLL6Al/gNY3Sw0SpCa78N/OkjJll8vUrajZwMz 0ixcWd5FGfq9obuGbjMng60miuszVpt+OJq3QdLqGt+bkywsuLJyh6P0IjyCQpwhb6bf 5sh9dGiq9hAFC/cJYJ9caAlZhP8BFzBg/BAtGcwwDpwgOsz4Xv7UFSB71RiBHGmbapqt ifpGs8ssvEKi5krQCd8N3apboAXp+/obKfQll7hXj0vVXeq+Nc8BvR5NL+Qb1BXZ9nfs qqhQ== X-Gm-Message-State: APf1xPB1z+tAbClaJpyJAjTANqJTSfEofR/mpPomW3zXzHSqoUL0z77L BZNIsWTxkNPWMPSsNCfZYD8= X-Received: by 10.46.129.216 with SMTP id s24mr4908953ljg.2.1520022630852; Fri, 02 Mar 2018 12:30:30 -0800 (PST) Received: from [192.168.1.3] (broadband-188-255-70-164.moscow.rt.ru. [188.255.70.164]) by smtp.gmail.com with ESMTPSA id d22sm1475759ljc.90.2018.03.02.12.30.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Mar 2018 12:30:29 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: [RFC PATCH] Randomization of address chosen by mmap. From: Ilya Smith In-Reply-To: <20180228183349.GA16336@bombadil.infradead.org> Date: Fri, 2 Mar 2018 23:30:28 +0300 Cc: Kees Cook , Andrew Morton , Dan Williams , Michal Hocko , "Kirill A. Shutemov" , Jan Kara , Jerome Glisse , Hugh Dickins , Helge Deller , Andrea Arcangeli , Oleg Nesterov , Linux-MM , LKML , Kernel Hardening Content-Transfer-Encoding: quoted-printable Message-Id: References: <20180227131338.3699-1-blackzert@gmail.com> <55C92196-5398-4C19-B7A7-6C122CD78F32@gmail.com> <20180228183349.GA16336@bombadil.infradead.org> To: Matthew Wilcox X-Mailer: Apple Mail (2.3445.5.20) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 28 Feb 2018, at 21:33, Matthew Wilcox wrote: >=20 > On Wed, Feb 28, 2018 at 08:13:00PM +0300, Ilya Smith wrote: >>> It would be worth spelling out the "not recommended" bit some more >>> too: this fragments the mmap space, which has some serious issues on >>> smaller address spaces if you get into a situation where you cannot >>> allocate a hole large enough between the other allocations. >>>=20 >>=20 >> I=E2=80=99m agree, that's the point. >=20 > Would it be worth randomising the address returned just ever so = slightly? > ie instead of allocating exactly the next address, put in a guard hole > of (configurable, by default maybe) 1-15 pages? Is that enough extra > entropy to foil an interesting number of attacks, or do we need the = full > randomise-the-address-space approach in order to be useful? >=20 This is a really good question. Lets think we choose address with = random-length=20 guard hole. This length is limited by some configuration as you = described. For=20 instance let it be 1MB. Now according to current implementation, we = still may=20 fill this gap with small allocations with size less than 1MB. Attacker = will=20 going to build attack base on this predictable behaviour - he jus need = to spray=20 with 1 MB chunks (or less, with some expectation). This attack harder = but not=20 impossible. Now lets say we will increase this 1MB to 128MB. Attack is the same, = successful=20 rate less and more regions needed. Now we increase this value to 48 bit = entropy=20 and will get my patch (in some form ;)) I hope full randomise-the-address-space approach will work for a long = time. Thanks, Ilya