https://github.com/torvalds/linux
Revision 462e635e5b73ba9a4c03913b77138cd57ce4b050 authored by Tavis Ormandy on 09 December 2010, 14:29:42 UTC, committed by Linus Torvalds on 15 December 2010, 20:30:36 UTC
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>
1 parent 0fcdcfb
Raw File
Tip revision: 462e635e5b73ba9a4c03913b77138cd57ce4b050 authored by Tavis Ormandy on 09 December 2010, 14:29:42 UTC
install_special_mapping skips security_file_mmap check.
Tip revision: 462e635
ChangeLog.ide-floppy.1996-2002
/*
 * Many thanks to Lode Leroy <Lode.Leroy@www.ibase.be>, who tested so many
 * ALPHA patches to this driver on an EASYSTOR LS-120 ATAPI floppy drive.
 *
 * Ver 0.1   Oct 17 96   Initial test version, mostly based on ide-tape.c.
 * Ver 0.2   Oct 31 96   Minor changes.
 * Ver 0.3   Dec  2 96   Fixed error recovery bug.
 * Ver 0.4   Jan 26 97   Add support for the HDIO_GETGEO ioctl.
 * Ver 0.5   Feb 21 97   Add partitions support.
 *                       Use the minimum of the LBA and CHS capacities.
 *                       Avoid hwgroup->rq == NULL on the last irq.
 *                       Fix potential null dereferencing with DEBUG_LOG.
 * Ver 0.8   Dec  7 97   Increase irq timeout from 10 to 50 seconds.
 *                       Add media write-protect detection.
 *                       Issue START command only if TEST UNIT READY fails.
 *                       Add work-around for IOMEGA ZIP revision 21.D.
 *                       Remove idefloppy_get_capabilities().
 * Ver 0.9   Jul  4 99   Fix a bug which might have caused the number of
 *                        bytes requested on each interrupt to be zero.
 *                        Thanks to <shanos@es.co.nz> for pointing this out.
 * Ver 0.9.sv Jan 6 01   Sam Varshavchik <mrsam@courier-mta.com>
 *                       Implement low level formatting.  Reimplemented
 *                       IDEFLOPPY_CAPABILITIES_PAGE, since we need the srfp
 *                       bit.  My LS-120 drive barfs on
 *                       IDEFLOPPY_CAPABILITIES_PAGE, but maybe it's just me.
 *                       Compromise by not reporting a failure to get this
 *                       mode page.  Implemented four IOCTLs in order to
 *                       implement formatting.  IOCTls begin with 0x4600,
 *                       0x46 is 'F' as in Format.
 *            Jan 9 01   Userland option to select format verify.
 *                       Added PC_SUPPRESS_ERROR flag - some idefloppy drives
 *                       do not implement IDEFLOPPY_CAPABILITIES_PAGE, and
 *                       return a sense error.  Suppress error reporting in
 *                       this particular case in order to avoid spurious
 *                       errors in syslog.  The culprit is
 *                       idefloppy_get_capability_page(), so move it to
 *                       idefloppy_begin_format() so that it's not used
 *                       unless absolutely necessary.
 *                       If drive does not support format progress indication
 *                       monitor the dsc bit in the status register.
 *                       Also, O_NDELAY on open will allow the device to be
 *                       opened without a disk available.  This can be used to
 *                       open an unformatted disk, or get the device capacity.
 * Ver 0.91  Dec 11 99   Added IOMEGA Clik! drive support by
 *     		   <paul@paulbristow.net>
 * Ver 0.92  Oct 22 00   Paul Bristow became official maintainer for this
 *           		   driver.  Included Powerbook internal zip kludge.
 * Ver 0.93  Oct 24 00   Fixed bugs for Clik! drive
 *                        no disk on insert and disk change now works
 * Ver 0.94  Oct 27 00   Tidied up to remove strstr(Clik) everywhere
 * Ver 0.95  Nov  7 00   Brought across to kernel 2.4
 * Ver 0.96  Jan  7 01   Actually in line with release version of 2.4.0
 *                       including set_bit patch from Rusty Russell
 * Ver 0.97  Jul 22 01   Merge 0.91-0.96 onto 0.9.sv for ac series
 * Ver 0.97.sv Aug 3 01  Backported from 2.4.7-ac3
 * Ver 0.98  Oct 26 01   Split idefloppy_transfer_pc into two pieces to
 *                        fix a lost interrupt problem. It appears the busy
 *                        bit was being deasserted by my IOMEGA ATAPI ZIP 100
 *                        drive before the drive was actually ready.
 * Ver 0.98a Oct 29 01   Expose delay value so we can play.
 * Ver 0.99  Feb 24 02   Remove duplicate code, modify clik! detection code
 *                        to support new PocketZip drives
 */
back to top