# git rev-parse -q --verify d99d49613b7cd196ea161fc708040ea88adb6e18^{commit} d99d49613b7cd196ea161fc708040ea88adb6e18 already have revision, skipping fetch # git checkout -q -f -B kisskb d99d49613b7cd196ea161fc708040ea88adb6e18 # git clean -qxdf # < git log -1 # commit d99d49613b7cd196ea161fc708040ea88adb6e18 # Author: Alexey Kardashevskiy # Date: Wed Jul 4 15:00:52 2018 +1000 # # KVM: PPC: Check if IOMMU page is contained in the pinned physical page # # A VM which has: # - a DMA capable device passed through to it (eg. network card); # - running a malicious kernel that ignores H_PUT_TCE failure; # - capability of using IOMMU pages bigger that physical pages # can create an IOMMU mapping that exposes (for example) 16MB of # the host physical memory to the device when only 64K was allocated to the VM. # # The remaining 16MB - 64K will be some other content of host memory, possibly # including pages of the VM, but also pages of host kernel memory, host # programs or other VMs. # # The attacking VM does not control the location of the page it can map, # and is only allowed to map as many pages as it has pages of RAM. # # We already have a check in drivers/vfio/vfio_iommu_spapr_tce.c that # an IOMMU page is contained in the physical page so the PCI hardware won't # get access to unassigned host memory; however this check is missing in # the KVM fastpath (H_PUT_TCE accelerated code). We were lucky so far and # did not hit this yet as the very first time when the mapping happens # we do not have tbl::it_userspace allocated yet and fall back to # the userspace which in turn calls VFIO IOMMU driver, this fails and # the guest does not retry, # # This stores the smallest preregistered page size in the preregistered # region descriptor and changes the mm_iommu_xxx API to check this against # the IOMMU page size. This only allows huge pages use if the entire # preregistered block is backed with huge pages which are completely # contained the preregistered chunk; otherwise this defaults to PAGE_SIZE. # # Signed-off-by: Alexey Kardashevskiy # Signed-off-by: Michael Ellerman # < /opt/cross/kisskb/gcc-5.3.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc --version # < git log --format=%s --max-count=1 d99d49613b7cd196ea161fc708040ea88adb6e18 # < make -s -j 120 ARCH=powerpc O=/kisskb/build/powerpc-fixes_ppc6xx_defconfig_powerpc-5.3 CROSS_COMPILE=/opt/cross/kisskb/gcc-5.3.0-nolibc/powerpc64-linux/bin/powerpc64-linux- ppc6xx_defconfig # make -s -j 120 ARCH=powerpc O=/kisskb/build/powerpc-fixes_ppc6xx_defconfig_powerpc-5.3 CROSS_COMPILE=/opt/cross/kisskb/gcc-5.3.0-nolibc/powerpc64-linux/bin/powerpc64-linux- /kisskb/src/net/Makefile:24: CC cannot link executables. Skipping bpfilter. /kisskb/src/net/Makefile:24: CC cannot link executables. Skipping bpfilter. In file included from /kisskb/src/sound/ppc/pmac.h:25:0, from /kisskb/src/sound/ppc/awacs.c:29: /kisskb/src/sound/ppc/awacs.c: In function 'snd_pmac_awacs_init': /kisskb/src/include/sound/control.h:223:9: warning: 'speaker_vol' may be used uninitialized in this function [-Wmaybe-uninitialized] return _snd_ctl_add_slave(master, slave, 0); ^ /kisskb/src/sound/ppc/awacs.c:886:36: note: 'speaker_vol' was declared here struct snd_kcontrol *master_vol, *speaker_vol; ^ arch/powerpc/boot/mpc832x_rdb.dtb: Warning (interrupts_property): /qe@e0100000/mdio@3120/ethernet-phy@0:#interrupt-cells: size is (4), expected multiple of 8 arch/powerpc/boot/mpc832x_rdb.dtb: Warning (interrupts_property): /qe@e0100000/mdio@3120/ethernet-phy@4:#interrupt-cells: size is (4), expected multiple of 8 INFO: Uncompressed kernel (size 0xa75430) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa75430) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa75430) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa75430) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa75430) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa75430) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa75430) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa75430) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa64cd8) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa75430) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa64cd8) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa75430) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) Image Name: Linux-4.18.0-rc3+ Created: Thu Jul 5 00:08:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 4951955 Bytes = 4835.89 kB = 4.72 MB Load Address: 00b00000 Entry Point: 00b007a0 Image Name: Linux-4.18.0-rc3+ Created: Thu Jul 5 00:08:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 4927293 Bytes = 4811.81 kB = 4.70 MB Load Address: 00000000 Entry Point: 00000000 Image Name: Linux-4.18.0-rc3+ Created: Thu Jul 5 00:08:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 4951609 Bytes = 4835.56 kB = 4.72 MB Load Address: 00b00000 Entry Point: 00b001f4 Image Name: Linux-4.18.0-rc3+ Created: Thu Jul 5 00:08:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 4951729 Bytes = 4835.67 kB = 4.72 MB Load Address: 00b00000 Entry Point: 00b001f4 Image Name: Linux-4.18.0-rc3+ Created: Thu Jul 5 00:08:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 4951957 Bytes = 4835.90 kB = 4.72 MB Load Address: 00b00000 Entry Point: 00b007a0 Image Name: Linux-4.18.0-rc3+ Created: Thu Jul 5 00:08:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 4950810 Bytes = 4834.78 kB = 4.72 MB Load Address: 00b00000 Entry Point: 00b001f4 Image Name: Linux-4.18.0-rc3+ Created: Thu Jul 5 00:08:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 4951125 Bytes = 4835.08 kB = 4.72 MB Load Address: 00b00000 Entry Point: 00b001f4 Image Name: Linux-4.18.0-rc3+ Created: Thu Jul 5 00:08:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 4951665 Bytes = 4835.61 kB = 4.72 MB Load Address: 00b00000 Entry Point: 00b001f4 Image Name: Linux-4.18.0-rc3+ Created: Thu Jul 5 00:08:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 4952056 Bytes = 4835.99 kB = 4.72 MB Load Address: 00b00000 Entry Point: 00b001f4 Completed OK # rm -rf /kisskb/build/powerpc-fixes_ppc6xx_defconfig_powerpc-5.3 # Build took: 0:01:15.686318