From patchwork Sat Feb 8 08:35:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Xinhai X-Patchwork-Id: 11371493 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C4ED91398 for ; Sat, 8 Feb 2020 08:37:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7D048217BA for ; Sat, 8 Feb 2020 08:37:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FZjXrFlV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D048217BA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8CEE76B0003; Sat, 8 Feb 2020 03:37:37 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 880066B0005; Sat, 8 Feb 2020 03:37:37 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7943C6B0007; Sat, 8 Feb 2020 03:37:37 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0240.hostedemail.com [216.40.44.240]) by kanga.kvack.org (Postfix) with ESMTP id 625FF6B0003 for ; Sat, 8 Feb 2020 03:37:37 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id EEA28249F for ; Sat, 8 Feb 2020 08:37:36 +0000 (UTC) X-FDA: 76466306112.01.bean28_836ecfab0e00 X-Spam-Summary: 2,0,0,dc4c2bc5d36540d6,d41d8cd98f00b204,lixinhai.lxh@gmail.com,::akpm@linux-foundation.org,RULES_HIT:41:69:355:379:541:973:988:989:1260:1345:1437:1534:1539:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:4250:5007:6261:6653:7903:8784:9413:10004:11026:11658:11914:12296:12297:12517:12519:12679:12895:13069:13149:13153:13161:13228:13229:13230:13311:13357:14096:14384:14394:14687:14721:21080:21444:21451:21627:21666:30012:30054,0,RBL:209.85.208.195:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: bean28_836ecfab0e00 X-Filterd-Recvd-Size: 3306 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Sat, 8 Feb 2020 08:37:36 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id x7so1813722ljc.1 for ; Sat, 08 Feb 2020 00:37:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=bhB4gxpilCy7+5algjutRE5BaGl32alCBOsgH770HHY=; b=FZjXrFlVZEeQcrYmqzdTCT+08OSrh2U8mNL1ignK4fPrYW+06dM/mupw6goX3C67qw OmypZ3mKZsp2BBrI497unFPmeK3DwU2jwEMAEJX+o+G4Tja+qlV7+00Z0BxFjG9opDDF ED/qvGAn3uDFDBYUowOxX8mn9Ggd292DUiGzd+FoDDaBi2uUVt/e+VCHl+OEZJd0QcNF heOXlMX8lPmrNRj+IdutxA5rnik+ceJXH1OPDj63+0r6IMMXIDQkbaE2mWlwM1/ldo/O gWHVh3AWxu461cT/TWRQHxDstpaRQ4wdvvEPkNqBYCtg9WGkjSgMUkBMfs7i8KmcTIfN l85g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bhB4gxpilCy7+5algjutRE5BaGl32alCBOsgH770HHY=; b=ugz3mI15hBbDtJwfRRi9CdYtyLmGuHkTIUtkbIzxheF5dUSj4AwERuTjTlk15/9/kR yiKDJJ1PssP/v5WUdZjPb2g/2u4ReQOqggsHKVRZ7bqhqpHgOmz9plH4P/iS32RzMmvi gsR2BylJwoj4HRcqqjHbZhzi2NjLJ/SN0bLfllMrwVzqx8ipbCgflZ8D31gzD6EpcFpn NnZ7CCGx7YAx7doyiSoNsRPy41MU2bepa0ohT4w9hxKrLDAHskwWSp8fSIt63Gvezpa2 pAHNAkxs8jATRlVj5MUHItrVqfgElBFi3yBW7022MHB3DnSBuXeTLN/7pAQDgM8EJQMB BzXQ== X-Gm-Message-State: APjAAAUTehsg4UNsawCBlspJcTSAA9G7bnU7DCf2O+WxW2vZGs/JC1EZ jtmN2eCVvpBCZQufOWoo7KSMS5HhdXY= X-Google-Smtp-Source: APXvYqxMO3FeIANgmVCzq+6LTP9Mz+MqUGjA+DXMf9daHG21wePDVVhQDQQOJXDx9lTs2JeOOPgG0w== X-Received: by 2002:a2e:8197:: with SMTP id e23mr2001367ljg.250.1581151053662; Sat, 08 Feb 2020 00:37:33 -0800 (PST) Received: from localhost.localdomain.localdomain ([131.228.2.21]) by smtp.gmail.com with ESMTPSA id n11sm2663404ljg.15.2020.02.08.00.37.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Feb 2020 00:37:33 -0800 (PST) From: Li Xinhai To: linux-mm@kvack.org Cc: akpm@linux-foundation.org Subject: [PATCH 0/3] mm: Fix misuse of parent anon_vma in dup_mmap path Date: Sat, 8 Feb 2020 08:35:25 +0000 Message-Id: <1581150928-3214-1-git-send-email-lixinhai.lxh@gmail.com> X-Mailer: git-send-email 1.8.3.1 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: This patchset fix the misuse of parenet anon_vma, which mainly caused by child vma's vm_next and vm_prev are left same as its parent after duplicate vma. Finally, code reached parent vma's neighbor by referring pointer of child vma and executed wrong logic. The first two patches fix relevant issues, and the third patch sets vm_next and vm_prev to NULL when duplicate vma to prevent potential misuse in future. Li Xinhai (3): mm: don't prepare anon_vma if vma has VM_WIPEONFORK Revert "mm/rmap.c: reuse mergeable anon_vma as parent when fork" mm: set vm_next and vm_prev to NULL in vm_area_dup() kernel/fork.c | 10 ++++++---- mm/rmap.c | 13 ------------- 2 files changed, 6 insertions(+), 17 deletions(-)