From patchwork Tue Jan 12 23:49:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 362770 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4036C4332B for ; Wed, 13 Jan 2021 00:49:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE79C23117 for ; Wed, 13 Jan 2021 00:49:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392221AbhAMAnF (ORCPT ); Tue, 12 Jan 2021 19:43:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:46076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391945AbhALXuB (ORCPT ); Tue, 12 Jan 2021 18:50:01 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7EE3D23136; Tue, 12 Jan 2021 23:49:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1610495358; bh=Fyfc3St6XcETCyfxluudtDudj6bhhgxSuzF95j2USdc=; h=Date:From:To:Subject:In-Reply-To:From; b=aokZhffsiHHbXlNGDfx4+YHl54EUfd5rsVedet7FuCJ5HSJ8fpcLzkDxa2ohR+iaE TWkG7gEcBaoFNOtJeSGNKgK2s4qlmXhT8kViDNC4RIyRPM9aEJ3wV3dyHF/lpeJIO4 Y68S7c+ZiI+shG+PeQWjwH4QZVSphrbGtlhS662E= Date: Tue, 12 Jan 2021 15:49:18 -0800 From: Andrew Morton To: akpm@linux-foundation.org, linmiaohe@huawei.com, linux-mm@kvack.org, luoshijie1@huawei.com, mm-commits@vger.kernel.org, stable@vger.kernel.org, torvalds@linux-foundation.org, urezki@gmail.com Subject: [patch 05/10] mm/vmalloc.c: fix potential memory leak Message-ID: <20210112234918.AY5LtPz7k%akpm@linux-foundation.org> In-Reply-To: <20210112154839.abeb6e57de79480059fd9b0e@linux-foundation.org> User-Agent: s-nail v14.8.16 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Miaohe Lin Subject: mm/vmalloc.c: fix potential memory leak In VM_MAP_PUT_PAGES case, we should put pages and free array in vfree. But we missed to set area->nr_pages in vmap(). So we would failed to put pages in __vunmap() because area->nr_pages = 0. Link: https://lkml.kernel.org/r/20210107123541.39206-1-linmiaohe@huawei.com Fixes: b944afc9d64d ("mm: add a VM_MAP_PUT_PAGES flag for vmap") Signed-off-by: Shijie Luo Signed-off-by: Miaohe Lin Reviewed-by: Uladzislau Rezki (Sony) Cc: Signed-off-by: Andrew Morton --- mm/vmalloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/mm/vmalloc.c~mm-vmallocc-fix-potential-memory-leak +++ a/mm/vmalloc.c @@ -2420,8 +2420,10 @@ void *vmap(struct page **pages, unsigned return NULL; } - if (flags & VM_MAP_PUT_PAGES) + if (flags & VM_MAP_PUT_PAGES) { area->pages = pages; + area->nr_pages = count; + } return area->addr; } EXPORT_SYMBOL(vmap); From patchwork Tue Jan 12 23:49:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 363521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAD7BC43332 for ; Wed, 13 Jan 2021 00:49:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B914322CBE for ; Wed, 13 Jan 2021 00:49:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392307AbhAMAnF (ORCPT ); Tue, 12 Jan 2021 19:43:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:46322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391968AbhALXu1 (ORCPT ); Tue, 12 Jan 2021 18:50:27 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id CD03123139; Tue, 12 Jan 2021 23:49:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1610495365; bh=b+3gkIN/yT6h9cR5rTkrcLipzEFh8B9c3SsIlge72q0=; h=Date:From:To:Subject:In-Reply-To:From; b=wRQnWKIh+9FT9rqI5HZ8+bqtylRzHs8Hpedgany/k0hfSFyjJ8fX2JITJ68syr6RS O7EJPP3CN1sz2FOpWbJGQjqLaRDFUl1CTVe7hixiOO+1IkEv/WoARNF4mwexXMArOA qxyqH+zIVSVhGtNQequli/oT46ZjQon2aBmGoK5U= Date: Tue, 12 Jan 2021 15:49:24 -0800 From: Andrew Morton To: akpm@linux-foundation.org, linmiaohe@huawei.com, linux-mm@kvack.org, mike.kravetz@oracle.com, mm-commits@vger.kernel.org, stable@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 07/10] mm/hugetlb: fix potential missing huge page size info Message-ID: <20210112234924.NrJbRP05o%akpm@linux-foundation.org> In-Reply-To: <20210112154839.abeb6e57de79480059fd9b0e@linux-foundation.org> User-Agent: s-nail v14.8.16 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Miaohe Lin Subject: mm/hugetlb: fix potential missing huge page size info The huge page size is encoded for VM_FAULT_HWPOISON errors only. So if we return VM_FAULT_HWPOISON, huge page size would just be ignored. Link: https://lkml.kernel.org/r/20210107123449.38481-1-linmiaohe@huawei.com Fixes: aa50d3a7aa81 ("Encode huge page size for VM_FAULT_HWPOISON errors") Signed-off-by: Miaohe Lin Reviewed-by: Mike Kravetz Cc: Signed-off-by: Andrew Morton --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/hugetlb.c~mm-hugetlb-fix-potential-missing-huge-page-size-info +++ a/mm/hugetlb.c @@ -4371,7 +4371,7 @@ retry: * So we need to block hugepage fault by PG_hwpoison bit check. */ if (unlikely(PageHWPoison(page))) { - ret = VM_FAULT_HWPOISON | + ret = VM_FAULT_HWPOISON_LARGE | VM_FAULT_SET_HINDEX(hstate_index(h)); goto backout_unlocked; } From patchwork Tue Jan 12 23:49:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 362771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA3CDC4332E for ; Wed, 13 Jan 2021 00:49:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A31E222CAD for ; Wed, 13 Jan 2021 00:49:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393644AbhAMAnF (ORCPT ); Tue, 12 Jan 2021 19:43:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:46328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391989AbhALXua (ORCPT ); Tue, 12 Jan 2021 18:50:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 61F5723131; Tue, 12 Jan 2021 23:49:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1610495375; bh=IQLpdJSqJTkSxzfWi+dXB1+DERUDSuH3taG7+PK6n3E=; h=Date:From:To:Subject:In-Reply-To:From; b=eWuiIHli0EO70cgQHU1ERd+t/UkAS++HuBaJm1rtrnypQivTdE9I0J5a1+MbcesRz 9oNblxlMmP5caGO7wl0DNYG9A7m/h/ENbo0L1v9XNww/9/FNb3JPrdjq7XOHMbtHsK c5ivg+SrbGPeT5LD+7bRIRMMqv8XRW1r/vr1Xuok= Date: Tue, 12 Jan 2021 15:49:33 -0800 From: Andrew Morton To: akpm@linux-foundation.org, axboe@kernel.dk, hch@lst.de, linux-mm@kvack.org, me@kylehuey.com, mm-commits@vger.kernel.org, stable@vger.kernel.org, torvalds@linux-foundation.org, viro@zeniv.linux.org.uk Subject: [patch 10/10] mm/process_vm_access.c: include compat.h Message-ID: <20210112234933.KYQegrK93%akpm@linux-foundation.org> In-Reply-To: <20210112154839.abeb6e57de79480059fd9b0e@linux-foundation.org> User-Agent: s-nail v14.8.16 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Andrew Morton Subject: mm/process_vm_access.c: include compat.h mm/process_vm_access.c:277:5: error: implicit declaration of function 'in_compat_syscall'; did you mean 'in_ia32_syscall'? [-Werror=implicit-function-declaration] Fixes: 38dc5079da7081e "Fix compat regression in process_vm_rw()" Reported-by: syzbot+5b0d0de84d6c65b8dd2b@syzkaller.appspotmail.com Cc: Kyle Huey Cc: Jens Axboe Cc: Al Viro Cc: Christoph Hellwig Cc: Signed-off-by: Andrew Morton --- mm/process_vm_access.c | 1 + 1 file changed, 1 insertion(+) --- a/mm/process_vm_access.c~mm-process_vm_accessc-include-compath +++ a/mm/process_vm_access.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include