From: Konstantin Khlebnikov <koct9i@gmail.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andy Lutomirski <luto@amacapital.net>
Subject: Re: [PATCH RFC] mm: protect suid binaries against rowhammer with copy-on-read mappings
Date: Wed, 18 Mar 2015 18:08:06 +0300 [thread overview]
Message-ID: <CALYGNiPPgaKb6_Pyo1SZ8sjgSbgC0yXFfZ2OwUN5=mSdTypcAA@mail.gmail.com> (raw)
In-Reply-To: <550987AD.8020409@intel.com>
On Wed, Mar 18, 2015 at 5:11 PM, Dave Hansen <dave.hansen@intel.com> wrote:
> On 03/18/2015 01:30 AM, Konstantin Khlebnikov wrote:
>> + /*
>> + * Read-only SUID/SGID binares are mapped as copy-on-read
>> + * this protects them against exploiting with Rowhammer.
>> + */
>> + if (!(file->f_mode & FMODE_WRITE) &&
>> + ((inode->i_mode & S_ISUID) || ((inode->i_mode & S_ISGID) &&
>> + (inode->i_mode & S_IXGRP)))) {
>> + vm_flags &= ~(VM_SHARED | VM_MAYSHARE);
>> + vm_flags |= VM_COR;
>> + }
>
> I think we probably need to come to _some_ sort of understanding in the
> kernel of how much we are willing to do to thwart these kinds of
> attacks. I suspect it's a very deep rabbit hole.
>
> For this particular case, I don't see how this would be effective. The
> existing exploit which you reference attacks PTE pages which are
> unmapped in to the user address space. I'm confused how avoiding
> mapping a page in to an attacker's process can keep it from being exploited.
>
> Right now, there's a relatively small number of pages that will get
> COW'd for a SUID binary. This greatly increases the number which could
> allow spraying of these (valuable) copy-on-read pages.
Yeah, on second thought that copy-on-read gives the same security
level as hiding pfns from userspace. Sorry for the noise.
It seems the only option is memory zoning: kernel should allocate all
normal memory for userspace from isolated area which is kept far far
away from important data.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-03-18 15:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-18 8:30 Konstantin Khlebnikov
2015-03-18 9:57 ` Kirill A. Shutemov
2015-03-18 11:41 ` Konstantin Khlebnikov
2015-03-19 13:04 ` Vlastimil Babka
2015-03-19 13:24 ` Konstantin Khlebnikov
2015-03-18 14:11 ` Dave Hansen
2015-03-18 15:08 ` Konstantin Khlebnikov [this message]
2015-03-18 15:45 ` Dave Hansen
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='CALYGNiPPgaKb6_Pyo1SZ8sjgSbgC0yXFfZ2OwUN5=mSdTypcAA@mail.gmail.com' \
--to=koct9i@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@amacapital.net \
--cc=torvalds@linux-foundation.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