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
History
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
File Mode Size
ABI
DocBook
PCI
RCU
accounting
acpi
aoe
arm
auxdisplay
blackfin
block
blockdev
cdrom
cgroups
connector
console
cpu-freq
cpuidle
cris
crypto
development-process
device-mapper
driver-model
dvb
early-userspace
fault-injection
fb
filesystems
firmware_class
frv
hwmon
i2c
i2o
ia64
ide
infiniband
input
ioctl
isdn
ja_JP
kbuild
kdump
ko_KR
kvm
laptops
leds
lguest
m68k
make
mips
misc-devices
mmc
mn10300
mtd
namespaces
netlabel
networking
parisc
pcmcia
power
powerpc
pps
prctl
s390
scheduler
scsi
serial
sh
sound
sparc
spi
sysctl
telephony
thermal
timers
trace
uml
usb
video4linux
vm
w1
watchdog
wimax
x86
zh_CN
.gitignore -rw-r--r-- 107 bytes
00-INDEX -rw-r--r-- 12.0 KB
BUG-HUNTING -rw-r--r-- 8.1 KB
Changes -rw-r--r-- 12.0 KB
CodingStyle -rw-r--r-- 29.1 KB
DMA-API-HOWTO.txt -rw-r--r-- 28.0 KB
DMA-API.txt -rw-r--r-- 26.5 KB
DMA-ISA-LPC.txt -rw-r--r-- 5.2 KB
DMA-attributes.txt -rw-r--r-- 1.3 KB
HOWTO -rw-r--r-- 27.2 KB
IPMI.txt -rw-r--r-- 27.6 KB
IRQ-affinity.txt -rw-r--r-- 2.1 KB
IRQ.txt -rw-r--r-- 962 bytes
Intel-IOMMU.txt -rw-r--r-- 3.8 KB
Makefile -rw-r--r-- 173 bytes
ManagementStyle -rw-r--r-- 12.9 KB
SAK.txt -rw-r--r-- 2.8 KB
SELinux.txt -rw-r--r-- 1.0 KB
SM501.txt -rw-r--r-- 2.8 KB
SecurityBugs -rw-r--r-- 1.8 KB
Smack.txt -rw-r--r-- 21.6 KB
SubmitChecklist -rw-r--r-- 4.3 KB
SubmittingDrivers -rw-r--r-- 6.3 KB
SubmittingPatches -rw-r--r-- 28.4 KB
VGA-softcursor.txt -rw-r--r-- 2.0 KB
apparmor.txt -rw-r--r-- 1.3 KB
applying-patches.txt -rw-r--r-- 19.5 KB
atomic_ops.txt -rw-r--r-- 19.0 KB
bad_memory.txt -rw-r--r-- 1.1 KB
basic_profiling.txt -rw-r--r-- 1.7 KB
binfmt_misc.txt -rw-r--r-- 5.9 KB
braille-console.txt -rw-r--r-- 1.4 KB
bt8xxgpio.txt -rw-r--r-- 4.3 KB
btmrvl.txt -rw-r--r-- 2.9 KB
bus-virt-phys-mapping.txt -rw-r--r-- 7.9 KB
cachetlb.txt -rw-r--r-- 17.1 KB
circular-buffers.txt -rw-r--r-- 7.6 KB
coccinelle.txt -rw-r--r-- 7.7 KB
cpu-hotplug.txt -rw-r--r-- 14.6 KB
cpu-load.txt -rw-r--r-- 3.0 KB
cputopology.txt -rw-r--r-- 3.8 KB
credentials.txt -rw-r--r-- 20.4 KB
dcdbas.txt -rw-r--r-- 3.6 KB
debugging-modules.txt -rw-r--r-- 954 bytes
debugging-via-ohci1394.txt -rw-r--r-- 7.4 KB
dell_rbu.txt -rw-r--r-- 4.9 KB
devices.txt -rw-r--r-- 115.8 KB
dmaengine.txt -rw-r--r-- 42 bytes
dontdiff -rw-r--r-- 1.9 KB
dynamic-debug-howto.txt -rw-r--r-- 9.2 KB
edac.txt -rw-r--r-- 26.9 KB
eisa.txt -rw-r--r-- 7.1 KB
email-clients.txt -rw-r--r-- 8.3 KB
feature-removal-schedule.txt -rw-r--r-- 20.8 KB
flexible-arrays.txt -rw-r--r-- 5.5 KB
futex-requeue-pi.txt -rw-r--r-- 5.0 KB
gcov.txt -rw-r--r-- 7.5 KB
gpio.txt -rw-r--r-- 30.4 KB
highuid.txt -rw-r--r-- 2.4 KB
hw_random.txt -rw-r--r-- 3.5 KB
init.txt -rw-r--r-- 2.5 KB
initrd.txt -rw-r--r-- 14.1 KB
intel_txt.txt -rw-r--r-- 10.2 KB
io-mapping.txt -rw-r--r-- 3.2 KB
io_ordering.txt -rw-r--r-- 1.9 KB
iostats.txt -rw-r--r-- 7.9 KB
irqflags-tracing.txt -rw-r--r-- 2.6 KB
isapnp.txt -rw-r--r-- 433 bytes
java.txt -rw-r--r-- 10.7 KB
kernel-doc-nano-HOWTO.txt -rw-r--r-- 11.4 KB
kernel-docs.txt -rw-r--r-- 34.4 KB
kernel-parameters.txt -rw-r--r-- 90.8 KB
keys-request-key.txt -rw-r--r-- 7.4 KB
keys.txt -rw-r--r-- 47.6 KB
kmemcheck.txt -rw-r--r-- 29.8 KB
kmemleak.txt -rw-r--r-- 7.6 KB
kobject.txt -rw-r--r-- 17.6 KB
kprobes.txt -rw-r--r-- 29.5 KB
kref.txt -rw-r--r-- 6.1 KB
ldm.txt -rw-r--r-- 3.8 KB
leds-class.txt -rw-r--r-- 4.0 KB
leds-lp3944.txt -rw-r--r-- 1.5 KB
local_ops.txt -rw-r--r-- 6.1 KB
lockdep-design.txt -rw-r--r-- 8.8 KB
lockstat.txt -rw-r--r-- 8.1 KB
logo.gif -rw-r--r-- 16.0 KB
logo.txt -rw-r--r-- 563 bytes
magic-number.txt -rw-r--r-- 9.7 KB
mca.txt -rw-r--r-- 11.3 KB
md.txt -rw-r--r-- 23.6 KB
memory-barriers.txt -rw-r--r-- 80.0 KB
memory-hotplug.txt -rw-r--r-- 14.0 KB
memory.txt -rw-r--r-- 1.2 KB
mono.txt -rw-r--r-- 2.5 KB
mutex-design.txt -rw-r--r-- 5.8 KB
nmi_watchdog.txt -rw-r--r-- 4.2 KB
nommu-mmap.txt -rw-r--r-- 12.7 KB
numastat.txt -rw-r--r-- 866 bytes
oops-tracing.txt -rw-r--r-- 12.5 KB
padata.txt -rw-r--r-- 7.3 KB
parport-lowlevel.txt -rw-r--r-- 32.2 KB
parport.txt -rw-r--r-- 8.8 KB
pi-futex.txt -rw-r--r-- 5.7 KB
pnp.txt -rw-r--r-- 6.8 KB
preempt-locking.txt -rw-r--r-- 5.2 KB
printk-formats.txt -rw-r--r-- 1.0 KB
prio_tree.txt -rw-r--r-- 5.2 KB
rbtree.txt -rw-r--r-- 8.8 KB
rfkill.txt -rw-r--r-- 4.8 KB
robust-futex-ABI.txt -rw-r--r-- 8.7 KB
robust-futexes.txt -rw-r--r-- 9.4 KB
rt-mutex-design.txt -rw-r--r-- 32.8 KB
rt-mutex.txt -rw-r--r-- 3.5 KB
rtc.txt -rw-r--r-- 16.1 KB
serial-console.txt -rw-r--r-- 4.0 KB
sgi-ioc4.txt -rw-r--r-- 2.0 KB
sgi-visws.txt -rw-r--r-- 678 bytes
sparse.txt -rw-r--r-- 3.0 KB
spinlocks.txt -rw-r--r-- 8.0 KB
stable_api_nonsense.txt -rw-r--r-- 9.2 KB
stable_kernel_rules.txt -rw-r--r-- 3.6 KB
svga.txt -rw-r--r-- 14.1 KB
sysfs-rules.txt -rw-r--r-- 8.1 KB
sysrq.txt -rw-r--r-- 11.6 KB
tomoyo.txt -rw-r--r-- 2.2 KB
unaligned-memory-access.txt -rw-r--r-- 10.0 KB
unicode.txt -rw-r--r-- 6.5 KB
unshare.txt -rw-r--r-- 13.1 KB
vgaarbiter.txt -rw-r--r-- 8.1 KB
video-output.txt -rw-r--r-- 1.1 KB
volatile-considered-harmful.txt -rw-r--r-- 5.6 KB
workqueue.txt -rw-r--r-- 14.3 KB
zorro.txt -rw-r--r-- 2.8 KB

back to top