All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Konstantin Khlebnikov <koct9i@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: 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 07:11:57 -0700	[thread overview]
Message-ID: <550987AD.8020409@intel.com> (raw)
In-Reply-To: <20150318083040.7838.76933.stgit@zurg>

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.

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Dave Hansen <dave.hansen@intel.com>
To: Konstantin Khlebnikov <koct9i@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: 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 07:11:57 -0700	[thread overview]
Message-ID: <550987AD.8020409@intel.com> (raw)
In-Reply-To: <20150318083040.7838.76933.stgit@zurg>

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.

  parent reply	other threads:[~2015-03-18 14:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18  8:30 [PATCH RFC] mm: protect suid binaries against rowhammer with copy-on-read mappings Konstantin Khlebnikov
2015-03-18  8:30 ` Konstantin Khlebnikov
2015-03-18  9:57 ` Kirill A. Shutemov
2015-03-18  9:57   ` Kirill A. Shutemov
2015-03-18 11:41   ` Konstantin Khlebnikov
2015-03-18 11:41     ` Konstantin Khlebnikov
2015-03-19 13:04     ` Vlastimil Babka
2015-03-19 13:04       ` Vlastimil Babka
2015-03-19 13:24       ` Konstantin Khlebnikov
2015-03-19 13:24         ` Konstantin Khlebnikov
2015-03-18 14:11 ` Dave Hansen [this message]
2015-03-18 14:11   ` Dave Hansen
2015-03-18 15:08   ` Konstantin Khlebnikov
2015-03-18 15:08     ` Konstantin Khlebnikov
2015-03-18 15:45     ` Dave Hansen
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=550987AD.8020409@intel.com \
    --to=dave.hansen@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=koct9i@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.