Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1061019ybl; Wed, 14 Aug 2019 10:05:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfWF/wid3Kpmi9K51CZVjGIwqB93MqLYo6pfwDk8Z6b793DvYymWNjzLyBALC5C6Slq/qw X-Received: by 2002:a17:902:8a81:: with SMTP id p1mr370074plo.71.1565802331098; Wed, 14 Aug 2019 10:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802331; cv=none; d=google.com; s=arc-20160816; b=GxfiKQ0HNZblv46lqcpGu46rkAriWnh2pciRdmAZgjqWVDcUg1BboBG61uoRMTTI07 yaDk+I4pg5dDrwwXES/1mnOazzJtEbxCEgvd796bp2mTMujSyi75qQpvh1cFdLj0Bn7b 6Lp+j2KzxoPEAZmfn5lBOR1hnTGAR3OTLwPZQDHg3ASEDJNASS335j8wtYj/Itteb2Kk Dp5nXsFji+gmuvywpD6/v7G685netpANRFG+J+8Uwgh1ySZ1N98ZG63FuEfiq7s+5mZ3 0Rj25tRSFOIu7o6FwZAUqVvY+wsZuG6Yz6Hq7bvemlQNux7VEwfWuHNh5tHtzfMVKeYU l10A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Tphogt8idwV2lyZMOGTa5uTvhReR7hTq1oHFrlq2u/s=; b=t3iBJUbgCpPRpv298rOMArmKT28CLYubZrouh93cfLBq/yuvV26Oyn9tTOA+hyVXWI iS+sUypp1bTS7ZLHVekxHDyNAxrj1E1zTbbVo+UfQd4J5OuC73zX5prVfQ0WkfGDd9rS XTNQu5Z0fkbpTMJ5e9qzxr54CHiJrFvvkGmMyGx0tgruJ4IulSeQe71LAdrB7Oz9jbBW z6IYxd4sOvDpCQ0J3BSrhi3XGFmrHg5zPPqXrx3ErxTSYph6d8181dV3kdnMU8Jrs7IA xZ6OlTQTSyzzPmDr7dq8s6EMOZ72g1Kc8EUDqNdiLEshFU131W1aYNdhmF+rMXzBaFX7 RyVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UmnbXZo7; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si202320pjk.63.2019.08.14.10.05.13; Wed, 14 Aug 2019 10:05:31 -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; dkim=pass header.i=@kernel.org header.s=default header.b=UmnbXZo7; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729083AbfHNRD5 (ORCPT + 99 others); Wed, 14 Aug 2019 13:03:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:52684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728527AbfHNRD4 (ORCPT ); Wed, 14 Aug 2019 13:03:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 14F4D208C2; Wed, 14 Aug 2019 17:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802235; bh=SJmBCSPDxyO5xYp/rxqIK+nCIOJDRvTnyp5P/YzQDqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UmnbXZo7sFws8OkfpNLcfqhqMswPRRh4KGauEYf0vPUmqc7VOh1l8b5Pi5bfmti5I Tqyn9HkSIdzmTH8Oi1ek00a5u3h8G1GWzZg2bo4v3VlRUSYFssHsXf52ZXM0WHoCdW Qg8xC1PTk6iZ7FuIf1TcYsGjJJU7VzpuWDNeT1MA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joerg Roedel , Thomas Gleixner , Dave Hansen Subject: [PATCH 5.2 029/144] mm/vmalloc: Sync unmappings in __purge_vmap_area_lazy() Date: Wed, 14 Aug 2019 18:59:45 +0200 Message-Id: <20190814165801.057660943@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel commit 3f8fd02b1bf1d7ba964485a56f2f4b53ae88c167 upstream. On x86-32 with PTI enabled, parts of the kernel page-tables are not shared between processes. This can cause mappings in the vmalloc/ioremap area to persist in some page-tables after the region is unmapped and released. When the region is re-used the processes with the old mappings do not fault in the new mappings but still access the old ones. This causes undefined behavior, in reality often data corruption, kernel oopses and panics and even spontaneous reboots. Fix this problem by activly syncing unmaps in the vmalloc/ioremap area to all page-tables in the system before the regions can be re-used. Fixes: 5d72b4fba40ef ('x86, mm: support huge I/O mapping capability I/F') Signed-off-by: Joerg Roedel Signed-off-by: Thomas Gleixner Reviewed-by: Dave Hansen Link: https://lkml.kernel.org/r/20190719184652.11391-4-joro@8bytes.org Signed-off-by: Greg Kroah-Hartman --- mm/vmalloc.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1214,6 +1214,12 @@ static bool __purge_vmap_area_lazy(unsig return false; /* + * First make sure the mappings are removed from all page-tables + * before they are freed. + */ + vmalloc_sync_all(); + + /* * TODO: to calculate a flush range without looping. * The list can be up to lazy_max_pages() elements. */ @@ -3001,6 +3007,9 @@ EXPORT_SYMBOL(remap_vmalloc_range); /* * Implement a stub for vmalloc_sync_all() if the architecture chose not to * have one. + * + * The purpose of this function is to make sure the vmalloc area + * mappings are identical in all page-tables in the system. */ void __weak vmalloc_sync_all(void) {