]> git.baikalelectronics.ru Git - kernel.git/commitdiff
fs/binfmt_elf.c: make BAD_ADDR() unlikely
authorAlexey Dobriyan <adobriyan@gmail.com>
Fri, 31 Jan 2020 06:17:01 +0000 (22:17 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 31 Jan 2020 18:30:41 +0000 (10:30 -0800)
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.

Link: http://lkml.kernel.org/r/20191215124355.GA21124@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/binfmt_elf.c

index 9afb5ed5b2d0f1599fcef8fcd59c64b3f7f4b168..e79e5a7216bd66f4d0d0f5b1638598d655b5e201 100644 (file)
@@ -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)
 {