Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromtorvalds/linux

Commitff8c0c5

Browse files
mjkravetztorvalds
authored andcommitted
mm/hugetlb.c: don't call region_abort if region_chg fails
Changes to hugetlbfs reservation maps is a two step process. The firststep is a call to region_chg to determine what needs to be changed, andprepare that change. This should be followed by a call to call toregion_add to commit the change, or region_abort to abort the change.The error path in hugetlb_reserve_pages called region_abort after afailed call to region_chg. As a result, the adds_in_progress counter inthe reservation map is off by 1. This is caught by a VM_BUG_ON inresv_map_release when the reservation map is freed.syzkaller fuzzer (when using an injected kmalloc failure) found thisbug, that resulted in the following: kernel BUG at mm/hugetlb.c:742! Call Trace: hugetlbfs_evict_inode+0x7b/0xa0 fs/hugetlbfs/inode.c:493 evict+0x481/0x920 fs/inode.c:553 iput_final fs/inode.c:1515 [inline] iput+0x62b/0xa20 fs/inode.c:1542 hugetlb_file_setup+0x593/0x9f0 fs/hugetlbfs/inode.c:1306 newseg+0x422/0xd30 ipc/shm.c:575 ipcget_new ipc/util.c:285 [inline] ipcget+0x21e/0x580 ipc/util.c:639 SYSC_shmget ipc/shm.c:673 [inline] SyS_shmget+0x158/0x230 ipc/shm.c:657 entry_SYSCALL_64_fastpath+0x1f/0xc2 RIP: resv_map_release+0x265/0x330 mm/hugetlb.c:742Link:http://lkml.kernel.org/r/1490821682-23228-1-git-send-email-mike.kravetz@oracle.comSigned-off-by: Mike Kravetz <mike.kravetz@oracle.com>Reported-by: Dmitry Vyukov <dvyukov@google.com>Acked-by: Hillf Danton <hillf.zj@alibaba-inc.com>Signed-off-by: Andrew Morton <akpm@linux-foundation.org>Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parentb0845ce commitff8c0c5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎mm/hugetlb.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4403,7 +4403,9 @@ int hugetlb_reserve_pages(struct inode *inode,
44034403
return0;
44044404
out_err:
44054405
if (!vma||vma->vm_flags&VM_MAYSHARE)
4406-
region_abort(resv_map,from,to);
4406+
/* Don't call region_abort if region_chg failed */
4407+
if (chg >=0)
4408+
region_abort(resv_map,from,to);
44074409
if (vma&&is_vma_resv_set(vma,HPAGE_RESV_OWNER))
44084410
kref_put(&resv_map->refs,resv_map_release);
44094411
returnret;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp