iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Nadav Amit <nadav.amit@gmail.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Dave Hansen <dave@sr71.net>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>,
	Khalid Aziz <khalid.aziz@oracle.com>,
	deepa.srinivasan@oracle.com, "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Tycho Andersen <tycho@tycho.ws>, X86 ML <x86@kernel.org>,
	iommu <iommu@lists.linux-foundation.org>,
	jsteckli@amazon.de, Arjan van de Ven <arjan@infradead.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	jcm@redhat.com, Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Borislav Petkov <bp@alien8.de>, Andy Lutomirski <luto@kernel.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	chris.hyser@oracle.com, linux-arm-kernel@lists.infradead.org,
	Khalid Aziz <khalid@gonehiking.org>,
	juergh@gmail.com, Andrew Cooper <andrew.cooper3@citrix.com>,
	Linux List Kernel Mailing <linux-kernel@vger.kernel.org>,
	tyhicks@canonical.com,
	LSM List <linux-security-module@vger.kernel.org>,
	Juerg Haefliger <juerg.haefliger@canonical.com>,
	keescook@google.com, Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	David Woodhouse <dwmw@amazon.co.uk>
Subject: Re: [RFC PATCH v9 03/13] mm: Add support for eXclusive Page Frame Ownership (XPFO)
Date: Wed, 17 Apr 2019 10:44:56 -0700	[thread overview]
Message-ID: <063753CC-5D83-4789-B594-019048DE22D9@gmail.com> (raw)
Message-ID: <20190417174456.hX8ZGNXr6kunz3KDdX249FrhRy-kW8I2aORMbS82qI8@z> (raw)
In-Reply-To: <20190417172632.GA95485@gmail.com>

> On Apr 17, 2019, at 10:26 AM, Ingo Molnar <mingo@kernel.org> wrote:
> 
> 
> * Nadav Amit <nadav.amit@gmail.com> wrote:
> 
>>> On Apr 17, 2019, at 10:09 AM, Ingo Molnar <mingo@kernel.org> wrote:
>>> 
>>> 
>>> * Khalid Aziz <khalid.aziz@oracle.com> 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 - <http://www.cs.columbia.edu/~vpk/papers/ret2dir.sec14.pdf>,
>>>> 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.
> 

Just to clarify - I am an innocent bystander and have no part in this work.
I was just looking (again) at the paper, as I was curious due to the recent
patches that I sent that improve W^X protection.

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  parent reply	other threads:[~2019-04-17 17:45 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-03 17:34 [RFC PATCH v9 00/13] Add support for eXclusive Page Frame Ownership Khalid Aziz
2019-04-03 17:34 ` [RFC PATCH v9 11/13] xpfo, mm: optimize spinlock usage in xpfo_kunmap Khalid Aziz
     [not found]   ` <5bab13e12d4215112ad2180106cc6bb9b513754a.1554248002.git.khalid.aziz-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2019-04-04  7:56     ` Peter Zijlstra
2019-04-04 16:06       ` Khalid Aziz
     [not found] ` <cover.1554248001.git.khalid.aziz-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2019-04-03 17:34   ` [RFC PATCH v9 01/13] mm: add MAP_HUGETLB support to vm_mmap Khalid Aziz
2019-04-03 17:34   ` [RFC PATCH v9 02/13] x86: always set IF before oopsing from page fault Khalid Aziz
     [not found]     ` <e6c57f675e5b53d4de266412aa526b7660c47918.1554248002.git.khalid.aziz-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2019-04-04  0:12       ` Andy Lutomirski
     [not found]         ` <CALCETrXvwuwkVSJ+S5s7wTBkNNj3fRVxpx9BvsXWrT=3ZdRnCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-04-04  1:42           ` Tycho Andersen
2019-04-04  4:12             ` Andy Lutomirski
     [not found]               ` <CALCETrVp37Xo3EMHkeedP1zxUMf9og=mceBa8c55e1F4G1DRSQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-04-04 15:47                 ` Tycho Andersen
2019-04-04 16:23                   ` Sebastian Andrzej Siewior
2019-04-04 16:28                   ` Thomas Gleixner
     [not found]                     ` <alpine.DEB.2.21.1904041822320.1802-ecDvlHI5BZPZikZi3RtOZ1XZhhPuCNm+@public.gmane.org>
2019-04-04 17:11                       ` Andy Lutomirski
2019-04-03 17:34   ` [RFC PATCH v9 03/13] mm: Add support for eXclusive Page Frame Ownership (XPFO) Khalid Aziz
     [not found]     ` <f1ac3700970365fb979533294774af0b0dd84b3b.1554248002.git.khalid.aziz-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2019-04-04  7:21       ` Peter Zijlstra
     [not found]         ` <20190404072152.GN4038-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2019-04-04  9:25           ` Peter Zijlstra
2019-04-04 14:48           ` Tycho Andersen
2019-04-04  7:43       ` Peter Zijlstra
     [not found]         ` <20190404074323.GO4038-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2019-04-04 15:15           ` Khalid Aziz
     [not found]             ` <b414bacc-2883-1914-38ec-3d8f4a032e10-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2019-04-04 17:01               ` Peter Zijlstra
2019-04-17 16:15     ` Ingo Molnar
2019-04-17 16:15       ` Ingo Molnar
     [not found]       ` <20190417161042.GA43453-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-04-17 16:49         ` Khalid Aziz
2019-04-17 16:49           ` Khalid Aziz
2019-04-17 17:09           ` Ingo Molnar
2019-04-17 17:09             ` Ingo Molnar
2019-04-17 17:19             ` Nadav Amit
2019-04-17 17:19               ` Nadav Amit
2019-04-17 17:26               ` Ingo Molnar
2019-04-17 17:26                 ` Ingo Molnar
2019-04-17 17:44                 ` Nadav Amit [this message]
2019-04-17 17:44                   ` Nadav Amit
2019-04-17 21:19                   ` Thomas Gleixner
2019-04-17 21:19                     ` Thomas Gleixner
     [not found]                     ` <alpine.DEB.2.21.1904172317460.3174-ecDvlHI5BZPZikZi3RtOZ1XZhhPuCNm+@public.gmane.org>
2019-04-17 23:18                       ` Linus Torvalds
2019-04-17 23:18                         ` Linus Torvalds
2019-04-17 23:42                         ` Thomas Gleixner
2019-04-17 23:42                           ` Thomas Gleixner
2019-04-17 23:52                           ` Linus Torvalds
2019-04-17 23:52                             ` Linus Torvalds
2019-04-18  4:41                             ` Andy Lutomirski
2019-04-18  4:41                               ` Andy Lutomirski
2019-04-18  5:41                               ` Kees Cook
2019-04-18  5:41                                 ` Kees Cook via iommu
2019-04-18 14:34                                 ` Khalid Aziz
2019-04-18 14:34                                   ` Khalid Aziz
2019-04-22 19:30                                   ` Khalid Aziz
2019-04-22 19:30                                     ` Khalid Aziz
     [not found]                                   ` <8f9d059d-e720-cd24-faa6-45493fc012e0-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2019-04-22 22:23                                     ` Kees Cook via iommu
2019-04-22 22:23                                       ` Kees Cook via iommu
     [not found]                             ` <CAHk-=whUwOjFW6RjHVM8kNOv1QVLJuHj2Dda0=mpLPdJ1UyatQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-04-18  6:14                               ` Thomas Gleixner
2019-04-18  6:14                                 ` Thomas Gleixner
2019-04-17 17:33             ` Khalid Aziz
2019-04-17 17:33               ` Khalid Aziz
2019-04-17 19:49               ` Andy Lutomirski
2019-04-17 19:49                 ` Andy Lutomirski
     [not found]                 ` <CALCETrXFzWFMrV-zDa4QFjB=4WnC9RZmorBko65dLGhymDpeQw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-04-17 19:52                   ` Tycho Andersen
2019-04-17 19:52                     ` Tycho Andersen
2019-04-17 20:12                   ` Khalid Aziz
2019-04-17 20:12                     ` Khalid Aziz
2019-05-01 14:49           ` Waiman Long
2019-05-01 14:49             ` Waiman Long
2019-05-01 15:18             ` Khalid Aziz
2019-05-01 15:18               ` Khalid Aziz
2019-04-03 17:34   ` [RFC PATCH v9 04/13] xpfo, x86: Add support for XPFO for x86-64 Khalid Aziz
     [not found]     ` <c15e7d09dfe3dfdb9947d39ed0ddd6573ff86dbf.1554248002.git.khalid.aziz-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2019-04-04  7:52       ` Peter Zijlstra
     [not found]         ` <20190404075206.GP4038-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2019-04-04 15:40           ` Khalid Aziz
2019-04-03 17:34   ` [RFC PATCH v9 05/13] mm: add a user_virt_to_phys symbol Khalid Aziz
2019-04-03 17:34   ` [RFC PATCH v9 06/13] lkdtm: Add test for XPFO Khalid Aziz
2019-04-03 17:34   ` [RFC PATCH v9 07/13] arm64/mm: Add support " Khalid Aziz
2019-04-03 17:34   ` [RFC PATCH v9 08/13] swiotlb: Map the buffer if it was unmapped by XPFO Khalid Aziz
2019-04-03 17:34   ` [RFC PATCH v9 09/13] xpfo: add primitives for mapping underlying memory Khalid Aziz
2019-04-03 17:34   ` [RFC PATCH v9 10/13] arm64/mm, xpfo: temporarily map dcache regions Khalid Aziz
2019-04-03 17:34   ` [RFC PATCH v9 12/13] xpfo, mm: Defer TLB flushes for non-current CPUs (x86 only) Khalid Aziz
     [not found]     ` <4495dda4bfc4a06b3312cc4063915b306ecfaecb.1554248002.git.khalid.aziz-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2019-04-04  4:10       ` Andy Lutomirski
     [not found]         ` <CALCETrXMXxnWqN94d83UvGWhkD1BNWiwvH2vsUth1w0T3=0ywQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-04-04 22:55           ` Khalid Aziz
     [not found]             ` <91f1dbce-332e-25d1-15f6-0e9cfc8b797b-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2019-04-05  7:17               ` Thomas Gleixner
     [not found]                 ` <alpine.DEB.2.21.1904050909520.1802-ecDvlHI5BZPZikZi3RtOZ1XZhhPuCNm+@public.gmane.org>
2019-04-05 14:44                   ` Dave Hansen
     [not found]                     ` <26b00051-b03c-9fce-1446-52f0d6ed52f8-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-04-05 15:24                       ` Andy Lutomirski
2019-04-05 15:24                         ` Andy Lutomirski
     [not found]                         ` <DFA69954-3F0F-4B79-A9B5-893D33D87E51-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>
2019-04-05 15:56                           ` Tycho Andersen
2019-04-05 15:56                             ` Tycho Andersen
2019-04-05 16:32                             ` Andy Lutomirski
2019-04-05 16:32                               ` Andy Lutomirski
2019-04-05 15:56                           ` Khalid Aziz
2019-04-05 15:56                             ` Khalid Aziz
2019-04-05 16:01                           ` Dave Hansen
2019-04-05 16:01                             ` Dave Hansen
     [not found]                             ` <36b999d4-adf6-08a3-2897-d77b9cba20f8-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-04-05 16:27                               ` Andy Lutomirski
2019-04-05 16:27                                 ` Andy Lutomirski
     [not found]                                 ` <E0BBD625-6FE0-4A8A-884B-E10FAFC3319E-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>
2019-04-05 16:41                                   ` Peter Zijlstra
2019-04-05 16:41                                     ` Peter Zijlstra
2019-04-05 17:35                                   ` Khalid Aziz
2019-04-05 17:35                                     ` Khalid Aziz
2019-04-05 15:44                       ` Khalid Aziz
2019-04-05 15:44                         ` Khalid Aziz
2019-04-05 15:24               ` Andy Lutomirski
2019-04-05 15:24                 ` Andy Lutomirski
2019-04-04  8:18       ` Peter Zijlstra
2019-04-03 17:34   ` [RFC PATCH v9 13/13] xpfo, mm: Optimize XPFO TLB flushes by batching them together Khalid Aziz
2019-04-06  6:40   ` [RFC PATCH v9 00/13] Add support for eXclusive Page Frame Ownership Jon Masters
2019-04-06  6:40     ` Jon Masters

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=063753CC-5D83-4789-B594-019048DE22D9@gmail.com \
    --to=nadav.amit@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=arjan@infradead.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=chris.hyser@oracle.com \
    --cc=dave@sr71.net \
    --cc=deepa.srinivasan@oracle.com \
    --cc=dwmw@amazon.co.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jcm@redhat.com \
    --cc=jsteckli@amazon.de \
    --cc=juerg.haefliger@canonical.com \
    --cc=juergh@gmail.com \
    --cc=keescook@google.com \
    --cc=khalid.aziz@oracle.com \
    --cc=khalid@gonehiking.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tycho@tycho.ws \
    --cc=tyhicks@canonical.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).