From mboxrd@z Thu Jan 1 00:00:00 1970 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 CD49DC43468 for ; Fri, 18 Sep 2020 02:05:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5DB3B23718 for ; Fri, 18 Sep 2020 02:05:58 +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="Rbn49Y7R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DB3B23718 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 F2FE26B0074; Thu, 17 Sep 2020 22:05:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB8F56B0075; Thu, 17 Sep 2020 22:05:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA7176B0078; Thu, 17 Sep 2020 22:05:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0099.hostedemail.com [216.40.44.99]) by kanga.kvack.org (Postfix) with ESMTP id C14BE6B0074 for ; Thu, 17 Sep 2020 22:05:57 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7F0D412D1 for ; Fri, 18 Sep 2020 02:05:57 +0000 (UTC) X-FDA: 77274541554.30.ring30_14046d527127 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 5A97D180B3C83 for ; Fri, 18 Sep 2020 02:05:57 +0000 (UTC) X-HE-Tag: ring30_14046d527127 X-Filterd-Recvd-Size: 3812 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Sep 2020 02:05:56 +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 248FE2395B; Fri, 18 Sep 2020 02:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394756; bh=j47Y/OmtPQBlLz+805C+9tGJZUihfnFkicJQ1q/pSBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rbn49Y7Rstp81HcX5AJiesFhzMG8x7fscFwwrrFcWPFW68ebfKOh+iUgXGUU2c37D T4LtnomveXOyqCnNemL8qxBFIZvfNemVJaMujIvREA1bWr2PPpln0rNCT0xE2Rh7em vOPlAtdwujtQ80/yiag0SFqg5sh4Hgg577IU+XGo= 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 5.4 233/330] mm/mmap.c: initialize align_offset explicitly for vm_unmapped_area Date: Thu, 17 Sep 2020 21:59:33 -0400 Message-Id: <20200918020110.2063155-233-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-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 a3584a90c55c2..ba78f1f1b1bd1 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2126,6 +2126,7 @@ arch_get_unmapped_area(struct file *filp, unsigned = long addr, info.low_limit =3D mm->mmap_base; info.high_limit =3D mmap_end; info.align_mask =3D 0; + info.align_offset =3D 0; return vm_unmapped_area(&info); } #endif @@ -2167,6 +2168,7 @@ arch_get_unmapped_area_topdown(struct file *filp, u= nsigned long addr, info.low_limit =3D max(PAGE_SIZE, mmap_min_addr); info.high_limit =3D arch_get_mmap_base(addr, mm->mmap_base); info.align_mask =3D 0; + info.align_offset =3D 0; addr =3D vm_unmapped_area(&info); =20 /* --=20 2.25.1