LKML Archive on
 help / color / Atom feed
From: Alexey Dobriyan <>
Subject: [PATCH] elf: fix NT_FILE integer overflow
Date: Fri, 12 Jan 2018 23:34:27 +0300
Message-ID: <20180112203427.GA9109@avx2> (raw)

If vm.max_map_count bumped above 2^26 (67+ mil) and system has enough
RAM to allocate all the VMAs (~12.8 GB on Fedora 27 with 200-byte VMAs),
then it should be possible to overflow 32-bit "size", pass paranoia check,
allocate very little vmalloc space and oops while writing into vmalloc
guard page...

But I didn't test this, only coredump of regular process.

Signed-off-by: Alexey Dobriyan <>

 fs/binfmt_elf.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1599,6 +1599,8 @@ static int fill_files_note(struct memelfnote *note)
 	/* *Estimated* file count and total data size needed */
 	count = current->mm->map_count;
+	if (count > UINT_MAX / 64)
+		return -EINVAL;
 	size = count * 64;
 	names_ofs = (2 + 3 * count) * sizeof(data[0]);

             reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 20:34 Alexey Dobriyan [this message]
2018-01-12 22:52 ` Andrew Morton
2018-01-13  9:14   ` Alexey Dobriyan

Reply instructions:

You may reply publically 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:

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

  git send-email \
    --in-reply-to=20180112203427.GA9109@avx2 \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone public-inbox