qemu-irix/hw
Greg Kurz c8c9aab173 9pfs: local: mkdir: don't follow symlinks
The local_mkdir() callback is vulnerable to symlink attacks because it
calls:

(1) mkdir() which follows symbolic links for all path elements but the
    rightmost one
(2) local_set_xattr()->setxattr() which follows symbolic links for all
    path elements
(3) local_set_mapped_file_attr() which calls in turn local_fopen() and
    mkdir(), both functions following symbolic links for all path
    elements but the rightmost one
(4) local_post_create_passthrough() which calls in turn lchown() and
    chmod(), both functions also following symbolic links

This patch converts local_mkdir() to rely on opendir_nofollow() and
mkdirat() to fix (1), as well as local_set_xattrat(),
local_set_mapped_file_attrat() and local_set_cred_passthrough() to
fix (2), (3) and (4) respectively.

The mapped and mapped-file security modes are supposed to be identical,
except for the place where credentials and file modes are stored. While
here, we also make that explicit by sharing the call to mkdirat().

This partly fixes CVE-2016-9602.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 3f3a16990b)
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2017-03-16 12:08:21 -05:00
..
9pfs 9pfs: local: mkdir: don't follow symlinks 2017-03-16 12:08:21 -05:00
acpi
adc
alpha target-alpha: Fix interrupt mask for cpu1 2016-11-22 16:53:53 +01:00
arm loader: fix handling of custom address spaces when adding ROM blobs 2016-11-30 04:20:57 +02:00
audio migration/pcspk: Add a property to state if pcspk is migrated 2016-11-28 16:45:12 +01:00
block xen_disk: split discard input to match internal representation 2016-11-23 10:47:48 -08:00
bt
char hw/char/spapr_vty: Return amount of free buffer entries in vty_can_receive() 2016-11-23 12:00:48 +11:00
core loader: fix undefined behavior in rom_order_compare() 2016-11-30 04:22:18 +02:00
cpu
cris
display display: cirrus: check vga bits per pixel(bpp) value 2016-12-05 11:01:55 +01:00
dma
gpio
i2c
i386 loader: fix handling of custom address spaces when adding ROM blobs 2016-11-30 04:20:57 +02:00
ide
input
intc
ipack
ipmi ipmi: fix qemu crash while migrating with ipmi 2016-11-18 17:50:09 +02:00
isa
lm32 loader: fix handling of custom address spaces when adding ROM blobs 2016-11-30 04:20:57 +02:00
m68k
mem
microblaze
mips
misc ivshmem: Fix 64 bit memory bar configuration 2016-11-18 17:29:34 +02:00
moxie
net fsl_etsec: Fix various small problems in hexdump code 2016-12-06 10:23:50 +08:00
nvram fw_cfg: move FW_CFG_NB_CPUS out of fw_cfg_init1() 2016-11-16 12:09:58 -02:00
openrisc
pci
pci-bridge
pci-host ppc: Make uninorth interrupt swizzling identical to Grackle 2016-11-23 12:00:48 +11:00
pcmcia
ppc spapr: fix default DRC state for coldplugged LMBs 2016-12-01 13:41:00 +11:00
s390x
scsi Small fixes for rc2. 2016-11-29 10:05:07 +00:00
sd
sh4
smbios
sparc fw_cfg: move FW_CFG_NB_CPUS out of fw_cfg_init1() 2016-11-16 12:09:58 -02:00
sparc64 fw_cfg: move FW_CFG_NB_CPUS out of fw_cfg_init1() 2016-11-16 12:09:58 -02:00
ssi
timer
tpm
tricore
unicore32
usb xen: attach pvusb usb bus to backend qdev 2016-11-22 10:29:41 -08:00
vfio
virtio virtio-pci: Fix cross-version migration with older machines 2016-12-15 07:35:19 +00:00
watchdog
xen xen: create qdev for each backend device 2016-11-22 10:29:39 -08:00
xenpv
xtensa
Makefile.objs