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=-12.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 8980FC43463 for ; Fri, 18 Sep 2020 02:16:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 364D9235F7 for ; Fri, 18 Sep 2020 02:16:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="cW6vxxHn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 364D9235F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 72AAB6B00AE; Thu, 17 Sep 2020 22:16:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 660396B00B0; Thu, 17 Sep 2020 22:16:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59EA46B00B1; Thu, 17 Sep 2020 22:16:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id 4597A6B00AE for ; Thu, 17 Sep 2020 22:16:12 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 06EC9180AD81F for ; Fri, 18 Sep 2020 02:16:12 +0000 (UTC) X-FDA: 77274567384.17.books28_4b1582227127 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id DB35E180D0181 for ; Fri, 18 Sep 2020 02:16:11 +0000 (UTC) X-HE-Tag: books28_4b1582227127 X-Filterd-Recvd-Size: 3791 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Sep 2020 02:16:11 +0000 (UTC) Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B384A23787; Fri, 18 Sep 2020 02:16:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600395370; bh=JuUO/LAQki3vuHxqPqUSPGw+B0wpIrEOZt7xATwMrwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cW6vxxHnbnQwyAl1s2UhstJ07HldSbN3VlrSU4TOGdpMB8IBhtbbk9NyGZfEL/Z7v nsMJrdfJWK13gSzUftvn9pn8sXlhy8LcyoBzdhazjGCZ0f7c4tuI7htV7/iVCPKdcn e0oBZoXC7u3rT5UvV92BLXT2xb5ePuNUnlQOkndk= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jaewon Kim , Andrew Morton , Matthew Wilcox , Michel Lespinasse , Borislav Petkov , Linus Torvalds , Sasha Levin , linux-mm@kvack.org Subject: [PATCH AUTOSEL 4.9 63/90] mm/mmap.c: initialize align_offset explicitly for vm_unmapped_area Date: Thu, 17 Sep 2020 22:14:28 -0400 Message-Id: <20200918021455.2067301-63-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918021455.2067301-1-sashal@kernel.org> References: <20200918021455.2067301-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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=3D0x755b155000 err=3D0 total_vm=3D0x15aaf0 flags= =3D0x1 len=3D0x109000 lo=3D0x8000 hi=3D0x75eed48000 mask=3D0x0 ofs=3D0x40= 22 After: vm_unmapped_area: addr=3D0x74a4ca1000 err=3D0 total_vm=3D0x168ab1 flags= =3D0x1 len=3D0x9000 lo=3D0x8000 hi=3D0x753d94b000 mask=3D0x0 ofs=3D0x0 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@samsun= g.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 7109f886e739e..7c8815636c482 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2028,6 +2028,7 @@ arch_get_unmapped_area(struct file *filp, unsigned = long addr, info.low_limit =3D mm->mmap_base; info.high_limit =3D TASK_SIZE; info.align_mask =3D 0; + info.align_offset =3D 0; return vm_unmapped_area(&info); } #endif @@ -2069,6 +2070,7 @@ arch_get_unmapped_area_topdown(struct file *filp, c= onst unsigned long addr0, info.low_limit =3D max(PAGE_SIZE, mmap_min_addr); info.high_limit =3D mm->mmap_base; info.align_mask =3D 0; + info.align_offset =3D 0; addr =3D vm_unmapped_area(&info); =20 /* --=20 2.25.1