https://github.com/torvalds/linux
Revision 140456f994195b568ecd7fc2287a34eadffef3ca authored by Andrey Ryabinin on 17 February 2021, 14:30:04 UTC, committed by Joerg Roedel on 04 March 2021, 12:15:56 UTC
increase_address_space() calls get_zeroed_page(gfp) under spin_lock with
disabled interrupts. gfp flags passed to increase_address_space() may allow
sleeping, so it comes to this:

 BUG: sleeping function called from invalid context at mm/page_alloc.c:4342
 in_atomic(): 1, irqs_disabled(): 1, pid: 21555, name: epdcbbf1qnhbsd8

 Call Trace:
  dump_stack+0x66/0x8b
  ___might_sleep+0xec/0x110
  __alloc_pages_nodemask+0x104/0x300
  get_zeroed_page+0x15/0x40
  iommu_map_page+0xdd/0x3e0
  amd_iommu_map+0x50/0x70
  iommu_map+0x106/0x220
  vfio_iommu_type1_ioctl+0x76e/0x950 [vfio_iommu_type1]
  do_vfs_ioctl+0xa3/0x6f0
  ksys_ioctl+0x66/0x70
  __x64_sys_ioctl+0x16/0x20
  do_syscall_64+0x4e/0x100
  entry_SYSCALL_64_after_hwframe+0x44/0xa9

Fix this by moving get_zeroed_page() out of spin_lock/unlock section.

Fixes: 754265bcab ("iommu/amd: Fix race in increase_address_space()")
Signed-off-by: Andrey Ryabinin <arbn@yandex-team.com>
Acked-by: Will Deacon <will@kernel.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210217143004.19165-1-arbn@yandex-team.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 45e606f
History
Tip revision: 140456f994195b568ecd7fc2287a34eadffef3ca authored by Andrey Ryabinin on 17 February 2021, 14:30:04 UTC
iommu/amd: Fix sleeping in atomic in increase_address_space()
Tip revision: 140456f
File Mode Size
9p
adfs
affs
afs
autofs
befs
bfs
btrfs
cachefiles
ceph
cifs
coda
configfs
cramfs
crypto
debugfs
devpts
dlm
ecryptfs
efivarfs
efs
erofs
exfat
exportfs
ext2
ext4
f2fs
fat
freevxfs
fscache
fuse
gfs2
hfs
hfsplus
hostfs
hpfs
hugetlbfs
iomap
isofs
jbd2
jffs2
jfs
kernfs
lockd
minix
nfs
nfs_common
nfsd
nilfs2
nls
notify
ntfs
ocfs2
omfs
openpromfs
orangefs
overlayfs
proc
pstore
qnx4
qnx6
quota
ramfs
reiserfs
romfs
squashfs
sysfs
sysv
tracefs
ubifs
udf
ufs
unicode
vboxsf
verity
xfs
zonefs
Kconfig -rw-r--r-- 8.5 KB
Kconfig.binfmt -rw-r--r-- 7.6 KB
Makefile -rw-r--r-- 4.5 KB
aio.c -rw-r--r-- 56.4 KB
anon_inodes.c -rw-r--r-- 4.6 KB
attr.c -rw-r--r-- 9.7 KB
bad_inode.c -rw-r--r-- 5.3 KB
binfmt_aout.c -rw-r--r-- 8.3 KB
binfmt_elf.c -rw-r--r-- 60.5 KB
binfmt_elf_fdpic.c -rw-r--r-- 44.1 KB
binfmt_em86.c -rw-r--r-- 2.7 KB
binfmt_flat.c -rw-r--r-- 28.3 KB
binfmt_misc.c -rw-r--r-- 17.3 KB
binfmt_script.c -rw-r--r-- 4.2 KB
block_dev.c -rw-r--r-- 48.0 KB
buffer.c -rw-r--r-- 89.1 KB
char_dev.c -rw-r--r-- 16.5 KB
compat_binfmt_elf.c -rw-r--r-- 3.8 KB
coredump.c -rw-r--r-- 27.7 KB
d_path.c -rw-r--r-- 11.4 KB
dax.c -rw-r--r-- 46.4 KB
dcache.c -rw-r--r-- 84.7 KB
dcookies.c -rw-r--r-- 7.1 KB
direct-io.c -rw-r--r-- 39.5 KB
drop_caches.c -rw-r--r-- 1.8 KB
eventfd.c -rw-r--r-- 12.1 KB
eventpoll.c -rw-r--r-- 63.8 KB
exec.c -rw-r--r-- 49.3 KB
fcntl.c -rw-r--r-- 23.4 KB
fhandle.c -rw-r--r-- 6.8 KB
file.c -rw-r--r-- 28.7 KB
file_table.c -rw-r--r-- 10.2 KB
filesystems.c -rw-r--r-- 6.4 KB
fs-writeback.c -rw-r--r-- 74.7 KB
fs_context.c -rw-r--r-- 17.2 KB
fs_parser.c -rw-r--r-- 10.1 KB
fs_pin.c -rw-r--r-- 1.9 KB
fs_struct.c -rw-r--r-- 3.4 KB
fs_types.c -rw-r--r-- 2.5 KB
fsopen.c -rw-r--r-- 11.0 KB
init.c -rw-r--r-- 5.9 KB
inode.c -rw-r--r-- 63.1 KB
internal.h -rw-r--r-- 5.1 KB
io-wq.c -rw-r--r-- 29.6 KB
io-wq.h -rw-r--r-- 3.6 KB
io_uring.c -rw-r--r-- 245.3 KB
ioctl.c -rw-r--r-- 20.9 KB
kernel_read_file.c -rw-r--r-- 4.4 KB
libfs.c -rw-r--r-- 39.6 KB
locks.c -rw-r--r-- 80.0 KB
mbcache.c -rw-r--r-- 12.0 KB
mount.h -rw-r--r-- 4.2 KB
mpage.c -rw-r--r-- 20.5 KB
namei.c -rw-r--r-- 120.0 KB
namespace.c -rw-r--r-- 98.5 KB
no-block.c -rw-r--r-- 478 bytes
nsfs.c -rw-r--r-- 6.6 KB
open.c -rw-r--r-- 33.3 KB
pipe.c -rw-r--r-- 33.8 KB
pnode.c -rw-r--r-- 15.1 KB
pnode.h -rw-r--r-- 1.9 KB
posix_acl.c -rw-r--r-- 21.5 KB
proc_namespace.c -rw-r--r-- 8.1 KB
read_write.c -rw-r--r-- 39.2 KB
readdir.c -rw-r--r-- 13.7 KB
remap_range.c -rw-r--r-- 13.9 KB
select.c -rw-r--r-- 34.7 KB
seq_file.c -rw-r--r-- 24.7 KB
signalfd.c -rw-r--r-- 9.0 KB
splice.c -rw-r--r-- 38.7 KB
stack.c -rw-r--r-- 2.5 KB
stat.c -rw-r--r-- 19.8 KB
statfs.c -rw-r--r-- 9.6 KB
super.c -rw-r--r-- 45.2 KB
sync.c -rw-r--r-- 10.5 KB
timerfd.c -rw-r--r-- 13.6 KB
userfaultfd.c -rw-r--r-- 52.0 KB
utimes.c -rw-r--r-- 7.6 KB
xattr.c -rw-r--r-- 26.2 KB

back to top