Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp854230pxk; Thu, 17 Sep 2020 19:10:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz044klIr5MSaBVElvynpp5Tz/8Wu+Tf+UvGBtU7sVkt9rvTAqjRIr9Rwec0/69UaA17pNg X-Received: by 2002:aa7:c98d:: with SMTP id c13mr36919748edt.199.1600395023446; Thu, 17 Sep 2020 19:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600395023; cv=none; d=google.com; s=arc-20160816; b=u++8ySKkJSLq9B8mHpHf/oW5a/wAV/NjZMk1O7lFDiksDA6ZqOPYXhhMPjWRs3Amb+ FGAElOWVEUhv1r+9EdeMzAAQqIl65+iUg7+JEvGkYlyLj0YYInDO6bxuyUZkALMr6c0C NdAFGbw7zL5vvJhvOXb4ry5oG85svZAZKGztputBFzMJUBH3J5Y0Cip/6LsPFDZQzE+q YrKOu1EZhF8dN2LTovrrARqJrmNioiTUaXyx4U6/NUcz9NtsggLSJHONYvLfC61S1bZ/ 35uZRGSXvIfpwh2FTOkaQBsorbc5QOLjlKVIxU/BA16De34rpRDNOoFMREdq9f1po7xW S5ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xkKJx0R+myP1AK2qsy3+NnwPpJWlK5qa9YTGHX5EYh0=; b=uMubU0z4XhbTxYoTsbtP0xr9bohBRBWhuyhwZ/jNdD/Rynu6xRRoP3VbSubvlbR13J BN/kEvWrikzN9g6HqJpglk/8nXIF+pYY/JGotUyEN8Z1llkh1BKwntmmSdchfNsSnlE+ +eKShuRRWHi5DBrVP1//nEEFziYdn5XW5pjxg50JdjpQLpVzES8ra1aRiWTw4D7+Celi PCSuhZ5RF4DB4EIwXycmhPYbzu+2ZWPAGJ2m1ZHhtcne8i4KHozOeiggTJx3pLxudaLV CUNw0Y+ee3RuzjOoWomGW9ZmABF+z7SQjEQjtSTN92Rdnh6D5vSjv6BH4J/R/+tCgYq4 GPcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rbn49Y7R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t22si1290899edi.341.2020.09.17.19.10.00; Thu, 17 Sep 2020 19:10:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rbn49Y7R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727676AbgIRCF6 (ORCPT + 99 others); Thu, 17 Sep 2020 22:05:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:54336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727001AbgIRCF4 (ORCPT ); Thu, 17 Sep 2020 22:05:56 -0400 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: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 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 = mm->mmap_base; info.high_limit = mmap_end; info.align_mask = 0; + info.align_offset = 0; return vm_unmapped_area(&info); } #endif @@ -2167,6 +2168,7 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, info.low_limit = max(PAGE_SIZE, mmap_min_addr); info.high_limit = arch_get_mmap_base(addr, mm->mmap_base); info.align_mask = 0; + info.align_offset = 0; addr = vm_unmapped_area(&info); /* -- 2.25.1