Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4549195imm; Mon, 17 Sep 2018 16:19:18 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZhrl5EIO3pfYUl66oNhRsui0j2q4aG9FYP6KkKszS86e4ynsI34DzO7EaZnvHcJnjYD6Ch X-Received: by 2002:a65:4849:: with SMTP id i9-v6mr24548561pgs.350.1537226358785; Mon, 17 Sep 2018 16:19:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537226358; cv=none; d=google.com; s=arc-20160816; b=BadSOEFbBunZbtnTbQMbQ0LkDOtds6J2OFKSI3mZmP2SJ39jpXulJAKOmyL/4Wd0mx qfHAOPKNXizzmMbXH3LXmfo1rPeJZ3t7ni6AKcwZHH75d6eogqo5UlRRXYvfCWz3vyVA cy8Tp2zqK5h2r6ZEIK3WJZtX5yiu+Mzgou2GCzLnwdNO3TJV/K5PbcXeQpCIo8rpoYpO G+N8WiBAZ5CrGlhQBKc/6FHElKSGCuBuQf50jkwyU1YMqtASHW20Z9JIXol9hX532/lF Gw0GB3v2aWPp1nEaR//0JfrhrvuGlx4hgbWHwB50yRMtxNL7LNmxNPYvKSrp3IZPmlfl qoDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=Z7oreV1fdqZGefsRYcIvzbkkIZ6X9cYleRTDJdvwmMY=; b=WNbrizTMiBjBxZGhVtQ+9mFgoZje2x3g3otihy6zF4fsiGUsUJxX+TucZh6/N3wvQW XF61ldBPLqAOnxdOu8DW0LG95ZnBvPhjNfGzbaNNqgEvBiKs2B2yZThTG/ayO59cp5Ab fxKDdlpYR2Y6A35DZGNxXuLgcuvEmwpIGY/g+ZPMTCGZFMdiS7mCbp3IKYIHNrCCIxau xR6wgOePiYytJ2MAakpnvbdZgmMFbyfrmK0r4az7wejPF6Cmw1uko/E0WUdGV+QjJROB 3+sWYfPXgJoQJfXzu+h6IY75iHCUXv3v4HjHKVTNGzs4xagN/eEiYz8x/kaG+4AQsvCk fdAw== ARC-Authentication-Results: i=1; mx.google.com; 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 u9-v6si16136830pgj.430.2018.09.17.16.19.03; Mon, 17 Sep 2018 16:19:18 -0700 (PDT) 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; 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 S1732642AbeIREmS (ORCPT + 99 others); Tue, 18 Sep 2018 00:42:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50808 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728850AbeIREmS (ORCPT ); Tue, 18 Sep 2018 00:42:18 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B50F1707; Mon, 17 Sep 2018 23:12:46 +0000 (UTC) Date: Mon, 17 Sep 2018 16:12:45 -0700 From: Andrew Morton To: Dan Williams Cc: Michal Hocko , Dave Hansen , Kees Cook , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/3] mm: Randomize free memory Message-Id: <20180917161245.c4bb8546d2c6069b0506c5dd@linux-foundation.org> In-Reply-To: <153702858249.1603922.12913911825267831671.stgit@dwillia2-desk3.amr.corp.intel.com> References: <153702858249.1603922.12913911825267831671.stgit@dwillia2-desk3.amr.corp.intel.com> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 15 Sep 2018 09:23:02 -0700 Dan Williams wrote: > Data exfiltration attacks via speculative execution and > return-oriented-programming attacks rely on the ability to infer the > location of sensitive data objects. The kernel page allocator, has > predictable first-in-first-out behavior for physical pages. Pages are > freed in physical address order when first onlined. There are also > mechanisms like CMA that can free large contiguous areas at once > increasing the predictability of allocations in physical memory. > > In addition to the security implications this randomization also > stabilizes the average performance of direct-mapped memory-side caches. > This includes memory-side caches like the one on the Knights Landing > processor and those generally described by the ACPI HMAT (Heterogeneous > Memory Attributes Table [1]). Cache conflicts are spread over a random > distribution rather than localized. > > Given the performance sensitivity of the page allocator this > randomization is only performed for MAX_ORDER (4MB by default) pages. A > kernel parameter, page_alloc.shuffle_page_order, is included to change > the page size where randomization occurs. > > [1]: See ACPI 6.2 Section 5.2.27.5 Memory Side Cache Information Structure I'm struggling to understand the justification of all of this. Are such attacks known to exist? Or reasonably expected to exist in the future? What is the likelihood and what is their cost? Or is this all academic and speculative and possibly pointless? ie, something must have motivated you to do this work rather than . Please spell out that motivation. The new module parameter should be documented, please. Let's try to help people understand why they might ever want to alter the default and if so, what settings they should be trying. How come we aren't also shuffling at memory hot-add time?