archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <>
Subject: [PATCH -mm 1/2] ELF: make BAD_ADDR() unlikely
Date: Sun, 15 Dec 2019 15:43:55 +0300	[thread overview]
Message-ID: <20191215124355.GA21124@avx2> (raw)

If some mapping goes past TASK_SIZE it will be rejected by kernel
which means no such userspace binaries exist.

Mark every such check as unlikely.

Signed-off-by: Alexey Dobriyan <>

 fs/binfmt_elf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -97,7 +97,7 @@ static struct linux_binfmt elf_format = {
 	.min_coredump	= ELF_EXEC_PAGESIZE,
-#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE)
+#define BAD_ADDR(x) (unlikely((unsigned long)(x) >= TASK_SIZE))
 static int set_brk(unsigned long start, unsigned long end, int prot)

                 reply	other threads:[~2019-12-15 12:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

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

  git send-email \
    --in-reply-to=20191215124355.GA21124@avx2 \ \ \ \
    --subject='Re: [PATCH -mm 1/2] ELF: make BAD_ADDR() unlikely' \

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

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox