linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Daniel Micay <danielmicay@gmail.com>
Cc: Jann Horn <jannh@google.com>,
	linux-mm@kvack.org,
	Kernel Hardening <kernel-hardening@lists.openwall.com>,
	kernel list <linux-kernel@vger.kernel.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [RFC] Warn the user when they could overflow mapcount
Date: Thu, 8 Feb 2018 11:42:35 -0800	[thread overview]
Message-ID: <20180208194235.GA3424@bombadil.infradead.org> (raw)
In-Reply-To: <CA+DvKQLHcFc3+kW_SnD6hs53yyD5Zi+uAeSgDMm1tRzxqy-Opg@mail.gmail.com>

On Thu, Feb 08, 2018 at 02:33:58PM -0500, Daniel Micay wrote:
> I don't think the kernel can get away with the current approach.
> Object sizes and counts on 64-bit should be 64-bit unless there's a
> verifiable reason they can get away with 32-bit. Having it use leak
> memory isn't okay, just much less bad than vulnerabilities exploitable
> beyond just denial of service.
> 
> Every 32-bit reference count should probably have a short comment
> explaining why it can't overflow on 64-bit... if that can't be written
> or it's too complicated to demonstrate, it probably needs to be
> 64-bit. It's one of many pervasive forms of integer overflows in the
> kernel... :(

Expanding _mapcount to 64-bit, and for that matter expanding _refcount
to 64-bit too is going to have a severe effect on memory consumption.
It'll take an extra 8 bytes per page of memory in your system, so 2GB
for a machine with 1TB memory (earlier we established this attack isn't
feasible for a machine with less than 1TB).

It's not something a user is going to hit accidentally; it is only
relevant to an attack scenario.  That's a lot of memory to sacrifice to
defray this attack.  I think we should be able to do better.

  reply	other threads:[~2018-02-08 19:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08  2:11 [RFC] Warn the user when they could overflow mapcount Matthew Wilcox
2018-02-08  2:56 ` Jann Horn
2018-02-08  4:04   ` Matthew Wilcox
2018-02-08 17:58   ` valdis.kletnieks
2018-02-08 18:05   ` Daniel Micay
2018-02-08 18:56     ` Matthew Wilcox
2018-02-08 19:33       ` Daniel Micay
2018-02-08 19:42         ` Matthew Wilcox [this message]
2018-02-08 19:48           ` Daniel Micay
2018-02-08 20:21             ` Matthew Wilcox
2018-02-08 21:37               ` [RFC] Limit mappings to ten per page per process Matthew Wilcox
2018-02-09  4:26                 ` Kirill A. Shutemov
2018-02-14 13:51                   ` Matthew Wilcox
2018-02-14 14:05                     ` Kirill A. Shutemov
2018-02-09  1:47               ` [RFC] Warn the user when they could overflow mapcount Daniel Micay
2018-02-08  3:18 ` Tobin C. Harding
2018-02-08  4:06   ` Matthew Wilcox
2018-03-02 21:26 ` [RFC] Handle mapcount overflows Matthew Wilcox
2018-03-02 22:03   ` Matthew Wilcox
2019-05-01 14:41   ` Jann Horn

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=20180208194235.GA3424@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=danielmicay@gmail.com \
    --cc=jannh@google.com \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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).