Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp498345ybi; Wed, 17 Jul 2019 00:15:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaP7QCIW5wce4aAPQbs3eedoqe1eU8RIQMH69G5vnlz6erZlK0yk2Q3I6lXN/1gHxvYHz/ X-Received: by 2002:a65:430a:: with SMTP id j10mr40439851pgq.374.1563347730107; Wed, 17 Jul 2019 00:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563347730; cv=none; d=google.com; s=arc-20160816; b=TACOp9tK0zPSSLomDMu+rf3A1v3mb8Ev0CiFQdk4DImMbSuiZ5qWzsyKaBj0WA8d3t FsGsshacmr7kNlnvhpYRQwKJq2OPO4CFm2kJ+yC9rnyGru6GQK42NB8dnWhCUtyWeLiO vRapeJUBA/i7Yl/rkgoZygWxCJqwDUfy7bgEDYkuSaBeGh0g855gw3J4lPUrZMy5c9js W7gIPQMHLGKCzIUKo16/2YukQeHrc7HXEUn/XiB1UuDqxtswBbqZGMAWodAya03lh+CH 59UQeYITaDbT3fvTcTyK51TLhSAc8U7EkXHEsMlDvGDGsf4DyIx5eJzDYE3oDFNui2pW zVow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=OPVNf1Z/jEqzPnDbfZdzm520W9qSF3lMG0lCY2gLoj0=; b=XUgfrv2G+DZLbQb+3/qq8EwiKJrzcEPSFpay6kaci8CtnFAKsa0OGRUE2ZFCVm45+f dHM7iK6k98QlxdAAC6QN1f121svNhFgWOeKvoLeA0UU+K+d8MWAjmEKkr204PPJCKe+7 18EejMcl0pCxKD4pzvSqzZzyWXLaDZsE3hUnhWqWZR0iu52AB9+FfZs9pb/OIp3mYSv0 g4T43l0jJHJsszcDLqwGPH0aSO8KeZCi020kObks/4l28mbb/fRX1vJh5JicOiBHSeka X3DsH7i5LtU8JfZtrXZa18hnxSI4TSBhmxlouMCVAhR27rtjHvQNd3ywm8cnI3uomsO3 qf+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11si23101336pjq.0.2019.07.17.00.15.13; Wed, 17 Jul 2019 00:15:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727078AbfGQHOz (ORCPT + 99 others); Wed, 17 Jul 2019 03:14:55 -0400 Received: from 8bytes.org ([81.169.241.247]:35638 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbfGQHOy (ORCPT ); Wed, 17 Jul 2019 03:14:54 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id F382241D; Wed, 17 Jul 2019 09:14:51 +0200 (CEST) From: Joerg Roedel To: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Joerg Roedel Subject: [PATCH 2/3] x86/mm: Sync also unmappings in vmalloc_sync_one() Date: Wed, 17 Jul 2019 09:14:38 +0200 Message-Id: <20190717071439.14261-3-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190717071439.14261-1-joro@8bytes.org> References: <20190717071439.14261-1-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel With huge-page ioremap areas the unmappings also need to be synced between all page-tables. Otherwise it can cause data corruption when a region is unmapped and later re-used. Make the vmalloc_sync_one() function ready to sync unmappings. Fixes: 5d72b4fba40ef ('x86, mm: support huge I/O mapping capability I/F') Signed-off-by: Joerg Roedel --- arch/x86/mm/fault.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 4a4049f6d458..d71e167662c3 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -194,11 +194,12 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) pmd = pmd_offset(pud, address); pmd_k = pmd_offset(pud_k, address); - if (!pmd_present(*pmd_k)) - return NULL; - if (!pmd_present(*pmd)) + if (pmd_present(*pmd) ^ pmd_present(*pmd_k)) set_pmd(pmd, *pmd_k); + + if (!pmd_present(*pmd_k)) + return NULL; else BUG_ON(pmd_pfn(*pmd) != pmd_pfn(*pmd_k)); -- 2.17.1