Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4393023yba; Wed, 17 Apr 2019 10:29:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqNclD3f4rX/jD8OkkKwclSsuppIV0i6i7SZU9Jy7RQfbgKWXEO0/oHouk+n4pzMNldbJo X-Received: by 2002:a63:cf0f:: with SMTP id j15mr83162363pgg.329.1555522143230; Wed, 17 Apr 2019 10:29:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555522143; cv=none; d=google.com; s=arc-20160816; b=eR4Flj6PqqG8+PJppuEfFGSTNw580zp8fXDKQvG9AU6Y6BHkyAArLyNXKNlmGKyXgc QMJW6Y69vEwmeqcX2Av/4H9FW+jAyk3dRKGU1yXwcjn2XRbm12S6uJeffSeK8RMV1CpG tebdI/uqxjvWhwUg6KtahC8FMBspD4qe7tvU1+6ev8536WeR2jjJJmDiXSfc1c7N/YNU kxe5uXaxyicvFlBKVAB6Nu3WPMED6lSybX1AThTgtuMhsczpJv1qAaFn5hHzZBYBTj0Q SOaK5fSzQothpwJAwyvap8PYScCvwHlSr5lem7enSRwth/JAr3SYkYCcFKRasnvcU5lQ FkcA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ns0QxnuhAfvDI+e0rO3qV1NnmRx4qtLcXwX4SEWj8w8=; b=N/cjBR2cQ0VI3/u/9AI8kmMSHw1vST7wWU2UmA4kaf4y+uno3dWSxjQ4sfXq5MIB6C lMoOvz5HG9gN0JC8MZ+8y4c71yf6w16Gw98IHEluVBwVEWRFMMTBUO9K82wRYnPh/wd/ 2n3L1anMXEfWDOU04uu6io7wvsUri2iggXrh8B+AJNi/6JTWWKVgXFjQnwUovabWB9y4 ZStAFNj8dFeXvGPVggHcJhwBQSgONFoPy9MJGN8Bh1mJhHyLIDqGG0KY4DYIUrFRP8Yl RpN55qReNGecrdjqxPyYHzSCFfzrzlTdJT4/e6FHD2r14MdQ8QotJ9Hhs83dtSzbxjdS todw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=NcvYWJCy; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c20si51330000pfi.259.2019.04.17.10.28.47; Wed, 17 Apr 2019 10:29:03 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=NcvYWJCy; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733038AbfDQR0j (ORCPT + 99 others); Wed, 17 Apr 2019 13:26:39 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36600 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729641AbfDQR0j (ORCPT ); Wed, 17 Apr 2019 13:26:39 -0400 Received: by mail-wm1-f66.google.com with SMTP id h18so4581669wml.1; Wed, 17 Apr 2019 10:26:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=ns0QxnuhAfvDI+e0rO3qV1NnmRx4qtLcXwX4SEWj8w8=; b=NcvYWJCyNfLatXmVyDRxLTR3Qx/x7JgxS8jcPHCtBtiN6MPmtGAh7sebTFiQVJAXNk Sbm/GqYfFaqfvaPEXTOrurvDwkKnd5zlx2TBIC3kz2Q4om3TP0Y1KaPxiIdippBjXGPT mt//zbGrEi8KAnTquF8hj0kCkKK4+MgiTjgN9U5T632osXgyVF0kyOkokSJYhpqPWU7q HvdQgIN00S7lvWehKYIDllQwTC97+wEK/qsM7xgShblV1PsGd2t5GKDax19T5iQvivwv QGi7KKBjclQM6KMFluz3llgRlzIQ2Zeot4lykjGh7vko0CNZ/xTAD3H/14XuvK6bERiB TxyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=ns0QxnuhAfvDI+e0rO3qV1NnmRx4qtLcXwX4SEWj8w8=; b=pYuZG149qnmzTop1skvx8kkGcL9haKa4bv6o7HF/DSiRsm9OVe4hcKyyA0Tq4bAZUv ME2TwQ30KiBW8fXKFkOUVa6aJVw39KNMAsRuW08oPE14TnT1IydQHUEyMRb0DFQpIeDM Eyjv6dVDSBRRzzOuSR1i1/HyoaMedrRyAnRX2JKX8Wf9Z+i6L0UjgvUKpuZ1o1qkq6n5 ZHLfFiDaKEg6Qd4pGaTXJnsBW/gsvVisYsNqHF0M8KbEZmKqFABhIl0ouuo8Q09FfCWq HlvcrqprLxF6/gHDgJtDXUXsKHwFflV0sLnPWpEiRXRl3bZf6dNrFLYjaD/9dmSMDIlj l+Hw== X-Gm-Message-State: APjAAAX39Pp7VpAwFeRHo05nkJV1FpI7CqQrv7ReX+Y4EOCoaI9N0LSt a/OIvuQPFGkKx/MuYH1/NLs= X-Received: by 2002:a1c:495:: with SMTP id 143mr575729wme.78.1555521996663; Wed, 17 Apr 2019 10:26:36 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id x5sm65470238wrt.72.2019.04.17.10.26.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Apr 2019 10:26:35 -0700 (PDT) Date: Wed, 17 Apr 2019 19:26:32 +0200 From: Ingo Molnar To: Nadav Amit Cc: Khalid Aziz , juergh@gmail.com, Tycho Andersen , jsteckli@amazon.de, keescook@google.com, Konrad Rzeszutek Wilk , Juerg Haefliger , deepa.srinivasan@oracle.com, chris.hyser@oracle.com, tyhicks@canonical.com, David Woodhouse , Andrew Cooper , jcm@redhat.com, Boris Ostrovsky , iommu , X86 ML , linux-arm-kernel@lists.infradead.org, "open list:DOCUMENTATION" , Linux List Kernel Mailing , Linux-MM , LSM List , Khalid Aziz , Linus Torvalds , Andrew Morton , Thomas Gleixner , Andy Lutomirski , Peter Zijlstra , Dave Hansen , Borislav Petkov , "H. Peter Anvin" , Arjan van de Ven , Greg Kroah-Hartman Subject: Re: [RFC PATCH v9 03/13] mm: Add support for eXclusive Page Frame Ownership (XPFO) Message-ID: <20190417172632.GA95485@gmail.com> References: <20190417161042.GA43453@gmail.com> <20190417170918.GA68678@gmail.com> <56A175F6-E5DA-4BBD-B244-53B786F27B7F@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <56A175F6-E5DA-4BBD-B244-53B786F27B7F@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Nadav Amit wrote: > > On Apr 17, 2019, at 10:09 AM, Ingo Molnar wrote: > > > > > > * Khalid Aziz wrote: > > > >>> I.e. the original motivation of the XPFO patches was to prevent execution > >>> of direct kernel mappings. Is this motivation still present if those > >>> mappings are non-executable? > >>> > >>> (Sorry if this has been asked and answered in previous discussions.) > >> > >> Hi Ingo, > >> > >> That is a good question. Because of the cost of XPFO, we have to be very > >> sure we need this protection. The paper from Vasileios, Michalis and > >> Angelos - , > >> does go into how ret2dir attacks can bypass SMAP/SMEP in sections 6.1 > >> and 6.2. > > > > So it would be nice if you could generally summarize external arguments > > when defending a patchset, instead of me having to dig through a PDF > > which not only causes me to spend time that you probably already spent > > reading that PDF, but I might also interpret it incorrectly. ;-) > > > > The PDF you cited says this: > > > > "Unfortunately, as shown in Table 1, the W^X prop-erty is not enforced > > in many platforms, including x86-64. In our example, the content of > > user address 0xBEEF000 is also accessible through kernel address > > 0xFFFF87FF9F080000 as plain, executable code." > > > > Is this actually true of modern x86-64 kernels? We've locked down W^X > > protections in general. > > As I was curious, I looked at the paper. Here is a quote from it: > > "In x86-64, however, the permissions of physmap are not in sane state. > Kernels up to v3.8.13 violate the W^X property by mapping the entire region > as “readable, writeable, and executable” (RWX)—only very recent kernels > (≥v3.9) use the more conservative RW mapping.” But v3.8.13 is a 5+ years old kernel, it doesn't count as a "modern" kernel in any sense of the word. For any proposed patchset with significant complexity and non-trivial costs the benchmark version threshold is the "current upstream kernel". So does that quote address my followup questions: > Is this actually true of modern x86-64 kernels? We've locked down W^X > protections in general. > > I.e. this conclusion: > > "Therefore, by simply overwriting kfptr with 0xFFFF87FF9F080000 and > triggering the kernel to dereference it, an attacker can directly > execute shell code with kernel privileges." > > ... appears to be predicated on imperfect W^X protections on the x86-64 > kernel. > > Do such holes exist on the latest x86-64 kernel? If yes, is there a > reason to believe that these W^X holes cannot be fixed, or that any fix > would be more expensive than XPFO? ? What you are proposing here is a XPFO patch-set against recent kernels with significant runtime overhead, so my questions about the W^X holes are warranted. Thanks, Ingo