[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53527e9d-d09b-7287-9f79-ebdbf4e9bc7a@oracle.com>
Date: Tue, 23 Feb 2021 14:55:08 -0800
From: Mike Kravetz <mike.kravetz@...cle.com>
To: Oscar Salvador <osalvador@...e.de>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Gerald Schaefer <gerald.schaefer@...ux.ibm.com>,
Michal Hocko <mhocko@...e.com>,
Muchun Song <songmuchun@...edance.com>,
Heiko Carstens <hca@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] hugetlb: fix uninitialized subpool pointer
On 2/23/21 2:45 PM, Oscar Salvador wrote:
> On Tue, Feb 23, 2021 at 01:55:44PM -0800, Mike Kravetz wrote:
>> Gerald Schaefer reported a panic on s390 in hugepage_subpool_put_pages()
>> with linux-next 5.12.0-20210222.
>> Call trace:
>> hugepage_subpool_put_pages.part.0+0x2c/0x138
>> __free_huge_page+0xce/0x310
>> alloc_pool_huge_page+0x102/0x120
>> set_max_huge_pages+0x13e/0x350
>> hugetlb_sysctl_handler_common+0xd8/0x110
>> hugetlb_sysctl_handler+0x48/0x58
>> proc_sys_call_handler+0x138/0x238
>> new_sync_write+0x10e/0x198
>> vfs_write.part.0+0x12c/0x238
>> ksys_write+0x68/0xf8
>> do_syscall+0x82/0xd0
>> __do_syscall+0xb4/0xc8
>> system_call+0x72/0x98
>>
>> This is a result of the change which moved the hugetlb page subpool
>> pointer from page->private to page[1]->private. When new pages are
>> allocated from the buddy allocator, the private field of the head
>> page will be cleared, but the private field of subpages is not modified.
>> Therefore, old values may remain.
>>
>> Fix by initializing hugetlb page subpool pointer in prep_new_huge_page().
>>
>> Fixes: f1280272ae4d ("hugetlb: use page.private for hugetlb specific page flags")
>> Reported-by: Gerald Schaefer <gerald.schaefer@...ux.ibm.com>
>> Signed-off-by: Mike Kravetz <mike.kravetz@...cle.com>
>
> Do we need the hugetlb_set_page_subpool() in __free_huge_page?
Yes, that is the more common case where the once active hugetlb page
will be simply added to the free list via enqueue_huge_page(). This
path does not go through prep_new_huge_page.
--
Mike Kravetz
Powered by blists - more mailing lists