From patchwork Tue Sep 29 11:00:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290769 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=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 8E31DC4741F for ; Tue, 29 Sep 2020 12:39:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D74020848 for ; Tue, 29 Sep 2020 12:39:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601383147; bh=nY6s31o4Uapbgqv3OMmpaHn2wWQKiW94YW1DjcUH4Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QyGg2FUHb1+0+VwIhFJLJeAWIWzOT/B14qDzj5ET+wltxp5T04xdnORRxnBPtsVFu EX2X6kYx8Kbv+plCY5l6IkMSgpEd1QoVPPLQdOJWXQuD2wl3z+i25JZ9N34lULpkdy IO3KrAty4lCZd582qybBZWlPXR3v470l5KiDAzuI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729411AbgI2LRE (ORCPT ); Tue, 29 Sep 2020 07:17:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:33612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728522AbgI2LQu (ORCPT ); Tue, 29 Sep 2020 07:16:50 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 86ED921D41; Tue, 29 Sep 2020 11:16:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378210; bh=nY6s31o4Uapbgqv3OMmpaHn2wWQKiW94YW1DjcUH4Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E9yXbdtdgNZth+qAgBbAPejLwFr3QemD8xvoPizpM+yM1udH52M5ljOq4Y6+38GJN YEYQwp2/arouFhFBQf6676kdNtcKr1hO8WeKX4dd4LHPj067ju5h4anZmZpqtIWdwZ w+iZOO9NZMsQLodH/4cWyQLhzn7XEgUyZOpBAWj0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaewon Kim , Andrew Morton , "Matthew Wilcox (Oracle)" , Michel Lespinasse , Borislav Petkov , Linus Torvalds , Sasha Levin Subject: [PATCH 4.14 101/166] mm/mmap.c: initialize align_offset explicitly for vm_unmapped_area Date: Tue, 29 Sep 2020 13:00:13 +0200 Message-Id: <20200929105940.251866393@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105935.184737111@linuxfoundation.org> References: <20200929105935.184737111@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jaewon Kim [ Upstream commit 09ef5283fd96ac424ef0e569626f359bf9ab86c9 ] On passing requirement to vm_unmapped_area, arch_get_unmapped_area and arch_get_unmapped_area_topdown did not set align_offset. Internally on both unmapped_area and unmapped_area_topdown, if info->align_mask is 0, then info->align_offset was meaningless. But commit df529cabb7a2 ("mm: mmap: add trace point of vm_unmapped_area") always prints info->align_offset even though it is uninitialized. Fix this uninitialized value issue by setting it to 0 explicitly. Before: vm_unmapped_area: addr=0x755b155000 err=0 total_vm=0x15aaf0 flags=0x1 len=0x109000 lo=0x8000 hi=0x75eed48000 mask=0x0 ofs=0x4022 After: vm_unmapped_area: addr=0x74a4ca1000 err=0 total_vm=0x168ab1 flags=0x1 len=0x9000 lo=0x8000 hi=0x753d94b000 mask=0x0 ofs=0x0 Signed-off-by: Jaewon Kim Signed-off-by: Andrew Morton Reviewed-by: Andrew Morton Cc: Matthew Wilcox (Oracle) Cc: Michel Lespinasse Cc: Borislav Petkov Link: http://lkml.kernel.org/r/20200409094035.19457-1-jaewon31.kim@samsung.com Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/mmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/mmap.c b/mm/mmap.c index 724b7c4f1a5b5..c389fd258384f 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2034,6 +2034,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, info.low_limit = mm->mmap_base; info.high_limit = TASK_SIZE; info.align_mask = 0; + info.align_offset = 0; return vm_unmapped_area(&info); } #endif @@ -2075,6 +2076,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, info.low_limit = max(PAGE_SIZE, mmap_min_addr); info.high_limit = mm->mmap_base; info.align_mask = 0; + info.align_offset = 0; addr = vm_unmapped_area(&info); /*