Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp184pxb; Wed, 18 Nov 2020 14:46:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJz0yvnRhh0MeDKJSR04HnIcvbmkztkRMCrwCm1mJVAPo1DouGTuIGWIIy46Ypj6/hzjDp/2 X-Received: by 2002:aa7:c986:: with SMTP id c6mr4922936edt.321.1605739573663; Wed, 18 Nov 2020 14:46:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605739573; cv=none; d=google.com; s=arc-20160816; b=ifigq6YF/5smVwIEuFjIB44YDsCvJLLEB8A9boisR8pISXQqgnGaSINRJTmvbPTxY5 mYD8/c91XXN85b8VydXdIIft2hAQ9g5HEzEme/yV1EK1ZC8yei6UXcxZw9PcmB+PqCvY VR7RD8skRWkqcxNAPtq0v/wWDgCiXamJ9jtnmGMkU+og69X43stGz+vdfu+qIcXYhziD UpwF22NKFdN77jyL+YkdbEfqEya9c+WyVSQSz6XqlLI14ify3QLvlYq0OR+2iQXmGWty pdykACOu3hvc2fKVr2Q8dA/147/2ZZmKH+VQT4MNs+UtHBKc55MMfA1M1sQ5WIz893k6 8kcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ixC0u6OyfxUYrt6QPqUZ5rujN8BJlqxwPvY/3+nhmXw=; b=fQdrqrSPck9Y0ghdwvcDr+29Ot0H/PbHI3VXhmUwW6B+tjSc3tkFBhQn/eDiAYNV/7 YuFunvECLj1QGRa43m/QzQLdBj5VhOEZfI8E4BN8oixvaGuEnzWNx0f9nSHwF8Uj+jyH j5X0IB0fPDHzczFyCcoJhEFgjOX8XM8wAoF5iNbQD7E+MPrnnc4yFLI+gGZhanjNdLzj 9KZyD8c/4eARATxhklyAzzz6XiXYECX0zJwaWdIYB1KxI8w+2YlwAnzNQDrRi6TXWMAO vFStE8gCU5Rdt8vzptgbNw4BVccGu0DpsyEXPbPN8eMo5Ee1LMAU0x7NONF+Ge5woWxs lOHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=wM9aPQLk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dx21si4154462ejb.657.2020.11.18.14.45.49; Wed, 18 Nov 2020 14:46:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=wM9aPQLk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726822AbgKRWm5 (ORCPT + 99 others); Wed, 18 Nov 2020 17:42:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726081AbgKRWm5 (ORCPT ); Wed, 18 Nov 2020 17:42:57 -0500 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D606AC0613D4 for ; Wed, 18 Nov 2020 14:42:56 -0800 (PST) Received: by mail-lf1-x141.google.com with SMTP id v144so5328515lfa.13 for ; Wed, 18 Nov 2020 14:42:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ixC0u6OyfxUYrt6QPqUZ5rujN8BJlqxwPvY/3+nhmXw=; b=wM9aPQLkCBhozlv2tfs90X5CI/Gs7zj3W6yTsPL8ES9kkqjKh9iwLJkDQbSmZNpPLv RkDOiDVBzFOBN7f2DWutl/757ig3/smDTusOtJ0ogOVayqIKQf03FO221+RCzKz0RL1M lIePHojAzGK+lkneSQi3IaBQCGycKs9Is3+G/9FX2LGDtYxarsXwe+NvcRF1w0eD8vc5 57UiQ/6QoCU1He2HVP18Mkb6b7FyJI8E4/ztzOoiGFc69FJKJsZkoCUHCpldX1hGS5Bd +qciHnJn+5niJMe/hEyj2WRvIbyvqkFLZwU5jjNk7p7pJ3hoTwMcIaW/78Dt5d4afqBH z88w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ixC0u6OyfxUYrt6QPqUZ5rujN8BJlqxwPvY/3+nhmXw=; b=nUzueaPpxbEROuyPh9mNUs0avYlmlYXmkmotc0qDsLipakpdYiHcbhv1UDmPXi8pJq z33I7hmH5vswlBAL38c0hz2IZHPWnn5uH9gpwMHt4d/lRXzNQoJakwFjXxu8WgFdKAqq JcmA7BXU40iYippV/KsMBZY1lQMohXeZC0FMy1H5d24OZp5CrBt5yAWUfdn/MNaTovq5 0/ZfEypKwZukH9xO25kywgQzedjJs+iSFIcTwyptrOBKy5hpyfzK3I7d22TYZdYNqMt7 xl3s3ophK75uwS7j/ZrVsyXcJgZD5Gv4iSl3sTkkp/Ih1cAq72ohktdbULJe37n3M46g TYsQ== X-Gm-Message-State: AOAM532VGflRLS+snzc1U1puhbocqclcebSZr0PGxVQ0XsVLeTmS2YxV Ij7R9EFLIDq4IDztza80lLmqGI2iTWFWtMFL8UcQUA== X-Received: by 2002:a05:6512:348e:: with SMTP id v14mr4178858lfr.97.1605739375008; Wed, 18 Nov 2020 14:42:55 -0800 (PST) MIME-Version: 1.0 References: <20201026160518.9212-1-toiwoton@gmail.com> <20201117165455.GN29991@casper.infradead.org> In-Reply-To: <20201117165455.GN29991@casper.infradead.org> From: Jann Horn Date: Wed, 18 Nov 2020 23:42:28 +0100 Message-ID: Subject: Re: [PATCH v4] mm: Optional full ASLR for mmap() and mremap() To: Matthew Wilcox Cc: Topi Miettinen , linux-hardening@vger.kernel.org, Andrew Morton , Linux-MM , kernel list , Kees Cook , Mike Rapoport , Mateusz Jurczyk , Kernel Hardening Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 17, 2020 at 5:55 PM Matthew Wilcox wrote: > On Mon, Oct 26, 2020 at 06:05:18PM +0200, Topi Miettinen wrote: > > Writing a new value of 3 to /proc/sys/kernel/randomize_va_space > > enables full randomization of memory mappings created with mmap(NULL, > > ...). With 2, the base of the VMA used for such mappings is random, > > but the mappings are created in predictable places within the VMA and > > in sequential order. With 3, new VMAs are created to fully randomize > > the mappings. Also mremap(..., MREMAP_MAYMOVE) will move the mappings > > even if not necessary. > > Is this worth it? > > https://www.ndss-symposium.org/ndss2017/ndss-2017-programme/aslrcache-practical-cache-attacks-mmu/ Yeah, against local attacks (including from JavaScript), ASLR isn't very robust; but it should still help against true remote attacks (modulo crazyness like NetSpectre). E.g. Mateusz Jurczyk's remote Samsung phone exploit via MMS messages (https://googleprojectzero.blogspot.com/2020/08/mms-exploit-part-5-defeating-aslr-getting-rce.html) would've probably been quite a bit harder to pull off if he hadn't been able to rely on having all those memory mappings sandwiched together.