Files
linux/fs
Tavis Ormandy 6c2cde9c28 install_special_mapping skips security_file_mmap check.
commit 462e635e5b upstream.

The install_special_mapping routine (used, for example, to setup the
vdso) skips the security check before insert_vm_struct, allowing a local
attacker to bypass the mmap_min_addr security restriction by limiting
the available pages for special mappings.

bprm_mm_init() also skips the check, and although I don't think this can
be used to bypass any restrictions, I don't see any reason not to have
the security check.

  $ uname -m
  x86_64
  $ cat /proc/sys/vm/mmap_min_addr
  65536
  $ cat install_special_mapping.s
  section .bss
      resb BSS_SIZE
  section .text
      global _start
      _start:
          mov     eax, __NR_pause
          int     0x80
  $ nasm -D__NR_pause=29 -DBSS_SIZE=0xfffed000 -f elf -o install_special_mapping.o install_special_mapping.s
  $ ld -m elf_i386 -Ttext=0x10000 -Tbss=0x11000 -o install_special_mapping install_special_mapping.o
  $ ./install_special_mapping &
  [1] 14303
  $ cat /proc/14303/maps
  0000f000-00010000 r-xp 00000000 00:00 0                                  [vdso]
  00010000-00011000 r-xp 00001000 00:19 2453665                            /home/taviso/install_special_mapping
  00011000-ffffe000 rwxp 00000000 00:00 0                                  [stack]

It's worth noting that Red Hat are shipping with mmap_min_addr set to
4096.

Signed-off-by: Tavis Ormandy <taviso@google.com>
Acked-by: Kees Cook <kees@ubuntu.com>
Acked-by: Robert Swiecki <swiecki@google.com>
[ Changed to not drop the error code - akpm ]
Reviewed-by: James Morris <jmorris@namei.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-01-07 14:43:14 -08:00
..
2010-02-09 04:50:48 -08:00
2010-02-23 07:37:55 -08:00
2010-02-09 04:50:46 -08:00
2009-10-04 15:05:10 -07:00
2010-08-13 13:20:21 -07:00
2009-06-17 00:36:36 -04:00
2009-07-12 12:22:34 -07:00
2011-01-07 14:43:02 -08:00
2010-08-10 10:20:45 -07:00
2009-12-18 14:04:08 -08:00
2009-07-12 12:22:34 -07:00
2009-09-23 18:13:10 -07:00
2010-05-26 14:29:21 -07:00
2009-09-23 07:39:30 -07:00
2009-09-24 08:41:47 -04:00
2010-02-09 04:50:47 -08:00
2009-06-17 00:36:37 -04:00
2009-06-18 13:03:46 -07:00
2009-09-24 08:41:47 -04:00
2008-12-31 18:07:43 -05:00
2009-06-18 13:03:41 -07:00
2010-02-23 07:37:44 -08:00
2009-03-31 23:00:26 -04:00
2009-09-24 07:47:27 -04:00
2009-04-07 08:31:16 -07:00
2009-10-04 15:05:10 -07:00
2009-09-23 07:39:29 -07:00
2009-02-18 15:37:53 -08:00