From patchwork Mon Jul 15 11:02:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 11043597 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 84B0A6C5 for ; Mon, 15 Jul 2019 11:02:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 747BA26B41 for ; Mon, 15 Jul 2019 11:02:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68BDA283A6; Mon, 15 Jul 2019 11:02:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB28726B41 for ; Mon, 15 Jul 2019 11:02:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F0D9F6B0006; Mon, 15 Jul 2019 07:02:24 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EBEAF6B0008; Mon, 15 Jul 2019 07:02:24 -0400 (EDT) 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 DD55B6B026B; Mon, 15 Jul 2019 07:02:24 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id A5B516B0006 for ; Mon, 15 Jul 2019 07:02:24 -0400 (EDT) Received: by mail-ed1-f71.google.com with SMTP id f3so13338676edx.10 for ; Mon, 15 Jul 2019 04:02:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=6EvDuo1ssdDG8objEAwreorjmyHHeKgaqNxghdZyXWs=; b=Se5u1Fb1upcb0O5mLNptOKNa8pKhsi+LH4UqnOPNymp675dK99t/1+geJHKGnT3Nc8 j1mmaZ2z+ZQTMWVrJRvuvak2nRJod1ydeUJFefpECt2hhvBSljoqIfRDcVzkYL9s0ZZy EsLVl5uHtP0MWv2ISExB16ZK5P7T1R+4hA0ybgTMk1VVKDOK8ikIH4mb+V/X6Xp10Xrf cObUnvbgdMLZ/QQFjH+CgTrCfCthgx+NSPLlHt4WzPIMxK8MF4uT6AQiOJoe38VKkToC pNzhFTHcmApxw6oxsYDI0Di9YNqzTB6PEpm9qAYv/Ca2WiLo6Jpd5xinTey/qw387vev tKNw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org X-Gm-Message-State: APjAAAVz4XQhIPGFnSNtxqOsMCL/0YULosO0dTMVvfmZMgdG8ZCEgHKj vMXc8GdvwRuHx4DHTyAiB8cTaDTJMSPEZVTXtf7rFBcY5PXFrhp8lGzZvSjbPd0p5aYsu5evTas w+jveEKfkr7IDG7sYjKdIPBrjvBgRk14dxIHPxLB03jESUsULnFBBnZ/+sRaQNdphfA== X-Received: by 2002:a17:906:454d:: with SMTP id s13mr20112597ejq.255.1563188543894; Mon, 15 Jul 2019 04:02:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7WIPdeNkqcDY6K6T7jMZ6sgJaVAXlpTCnGgtwPoH8LUdDbC8uQfvrWpMBnVPDye/xYt5I X-Received: by 2002:a17:906:454d:: with SMTP id s13mr20112522ejq.255.1563188543139; Mon, 15 Jul 2019 04:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563188543; cv=none; d=google.com; s=arc-20160816; b=ol8rhV/4IvcyKvw3T9laU+X9EbrR6sAw89DMY7ldGOZ7QYMzIRtfZCGwLaC/6+hZWV HuN1Pbfh/F5n1KicJYYI70ucSJNcrM2sSdmgxxRghkRXn82TzysEs+KMKpXQNYDig7ug RGCisDp0Y/WzblRBJIb+I/wDVgR/kiwghIuo/cd1Ftfi9RLbnE4Fki7FLgtEe3CLvL9H J51cbohBFvofVO6oMOBPHRa0+SNWzPxtQwD53k7JNFhbYPPFm6luY9Ie0EHLhOzFnZhc Ppv8hal04buU3nuV5anO/jW8yQ6UpeCDbSrXTu6GzKFSD12Z6h6QuUAbml6zID4L+fwt 27fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=6EvDuo1ssdDG8objEAwreorjmyHHeKgaqNxghdZyXWs=; b=wQTkM8H0bGYdfngP7KyT0eRjfjTwxH8DO0QR503pWwD6rntcOuvmGQUiYp7cErOke0 OYugith94PbYW46YB/3nekwuFcP16oD5NufmV/nK29tB+uXwIc8We9BN3GnEJXWWQxcG Y5QAHdfIBdjKAIeGbIxuJdeBRqHuucLygy4AuwprcCYmHvHcAk92zixPcOmPyUY8Rt+/ evNJoy/0HeDkgCPKfSec8jnso+tkjWOV4eo6Bgv9h+SpCzx+9fZp1gT9yq5diD6nM49k 4PWao356feOhAxsRuS1SZeD5uHfiQAXlZ7DqTd0hxesOK2sCe5FOtx0r/Oi6tdTwdEVM FcnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: from theia.8bytes.org (8bytes.org. [2a01:238:4383:600:38bc:a715:4b6d:a889]) by mx.google.com with ESMTPS id y2si11033628edb.188.2019.07.15.04.02.22 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 15 Jul 2019 04:02:23 -0700 (PDT) Received-SPF: pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) client-ip=2a01:238:4383:600:38bc:a715:4b6d:a889; Authentication-Results: mx.google.com; spf=pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: by theia.8bytes.org (Postfix, from userid 1000) id 48BD0133; Mon, 15 Jul 2019 13:02:22 +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 1/3] x86/mm: Check for pfn instead of page in vmalloc_sync_one() Date: Mon, 15 Jul 2019 13:02:10 +0200 Message-Id: <20190715110212.18617-2-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190715110212.18617-1-joro@8bytes.org> References: <20190715110212.18617-1-joro@8bytes.org> 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: X-Virus-Scanned: ClamAV using ClamSMTP From: Joerg Roedel Do not require a struct page for the mapped memory location because it might not exist. This can happen when an ioremapped region is mapped with 2MB pages. Signed-off-by: Joerg Roedel --- arch/x86/mm/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 794f364cb882..4a4049f6d458 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -200,7 +200,7 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) if (!pmd_present(*pmd)) set_pmd(pmd, *pmd_k); else - BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k)); + BUG_ON(pmd_pfn(*pmd) != pmd_pfn(*pmd_k)); return pmd_k; } From patchwork Mon Jul 15 11:02:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 11043599 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5B296C5 for ; Mon, 15 Jul 2019 11:02:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B625326B41 for ; Mon, 15 Jul 2019 11:02:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA67A283A6; Mon, 15 Jul 2019 11:02:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40DC926B41 for ; Mon, 15 Jul 2019 11:02:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D49126B0008; Mon, 15 Jul 2019 07:02:25 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C02186B026D; Mon, 15 Jul 2019 07:02:25 -0400 (EDT) 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 AA0126B026E; Mon, 15 Jul 2019 07:02:25 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by kanga.kvack.org (Postfix) with ESMTP id 700086B0008 for ; Mon, 15 Jul 2019 07:02:25 -0400 (EDT) Received: by mail-wr1-f72.google.com with SMTP id i6so8703411wre.1 for ; Mon, 15 Jul 2019 04:02:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=hGDApp89EWhquOjtHhsxHXkKfOY16kq5K6euPrNcpVQ=; b=CTJUHAojp6G+rr3cId37wyVyPP575IbBz3e608I0c+uYhobOSNVyOoou90ZfjMd+hk n22m3txdlwgjXF+Z/HyyYM2ZFHgWtZvEW/4xUpz/ksDRou0Xt8x7Ql7WXaPw3Q0FIIU1 0vX+V5M/Wk7z8DcAH7NIYQgQcxcnaIHlll9zS3ZXH6st4rzkpeOEabIleZ4TBa1mCpdL lR0blfc7c+Q+gz/O//FH1AK3DJrxXymAQSafSMXS2jLyqxCLZJ8U2EBNy28LiP+LBMY3 Tgco331/HUXCPqBa14b3EWvButl12ueujrgoK2TKrQ06g0nWrnd9OHS8l3AaDadWL8Vd ascw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org X-Gm-Message-State: APjAAAWNzVo5bYlATHhCDXwkJ1szityONoP4CvKH1gXCL9/FrBL7dq0m VZfyxD4GfOXGrV0F1c7POFw2AYYeaGBzr0pDsxJ974hJAXPPEaTXy0PnSiji/xvhw4WLAoxhv1J t5ehjiOLkWTB1e3QyUGzu/B6pwHlsvTBBF0kyXMOU1UrMInaFw9BxY0Qz2lR2nOoIww== X-Received: by 2002:a1c:7c08:: with SMTP id x8mr24241841wmc.19.1563188544896; Mon, 15 Jul 2019 04:02:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1gTxpi5pPcg6D6yfWGeM8C+oHMIoD1XGI9JirPVd7SkkxuoD457+jxBJDt695IrpjrKWK X-Received: by 2002:a1c:7c08:: with SMTP id x8mr24241735wmc.19.1563188544005; Mon, 15 Jul 2019 04:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563188544; cv=none; d=google.com; s=arc-20160816; b=dfg1zSRm27UwlDkBEQrkvEAsgWhmhwYxx4hK2/tHFX8D1RdiwRV43D5xbQ3Dp/SODv q43S1AWy1lEeUNskEXM1k9gt68j+9DLhqB9ZiBSMVFEk1iAu76TO4B4YlBUZcImnjqgT oYwSt0uPlNJEIusdNNBuP0EvBx+HS3ysV5YrGgvIAWSSMj6BkOMzIMEH+c1+SqlDe3PN UNzNXMAJDVdH7hlpvo464L2bvkqGvdKYv77Y1+S4UAcWgPJ93A2LZLnq5k/BOETynLzg NFooh6ZI3jdoCOuRS8JWUvby4yMonta0Kdlad1taA4ZI/1PrLbJoEG6SzK/dEWm5eruM pObw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=hGDApp89EWhquOjtHhsxHXkKfOY16kq5K6euPrNcpVQ=; b=xRtL8f7OCPPBeYIXyo71cWtGhDMAEsNlzNFS6fdxeKKuKCGoKyVMzBUc17BaVaNTC1 4cJ6V7N/nXxgWQlrh67mTrjp7drt0jId2AGcL1nCfrfpfC0t7OeYWlhj2HV0d0WW1RO1 +ml6UAAZpTXLBwzfKvkcEiSF7a5i89Vv7u/dlSCfNAkedPy2MuNrta+xDbHykdITb5IY i4atqDO1P14x3ruDwTCxP3VGtRweXFxwuqKR3zug0SxYhNgd8EsNwHQOK8ihbbofQZ98 zpgjvPYzm08Nb/iHH8X72uRcOWYjYqlN6uizOp8Q+GuZrujLZzyS1CWPs2etdsm5Tyqt G6bQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: from theia.8bytes.org (8bytes.org. [81.169.241.247]) by mx.google.com with ESMTPS id 49si6964571wra.232.2019.07.15.04.02.23 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 15 Jul 2019 04:02:23 -0700 (PDT) Received-SPF: pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) client-ip=81.169.241.247; Authentication-Results: mx.google.com; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: by theia.8bytes.org (Postfix, from userid 1000) id 6E377366; Mon, 15 Jul 2019 13:02:22 +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: Mon, 15 Jul 2019 13:02:11 +0200 Message-Id: <20190715110212.18617-3-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190715110212.18617-1-joro@8bytes.org> References: <20190715110212.18617-1-joro@8bytes.org> 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: X-Virus-Scanned: ClamAV using ClamSMTP 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. 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)); From patchwork Mon Jul 15 11:02:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 11043603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 62970112C for ; Mon, 15 Jul 2019 11:02:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53791283A6 for ; Mon, 15 Jul 2019 11:02:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4738C283A8; Mon, 15 Jul 2019 11:02:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FD7A26B41 for ; Mon, 15 Jul 2019 11:02:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FD2F6B026B; Mon, 15 Jul 2019 07:02:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4B03B6B026E; Mon, 15 Jul 2019 07:02:26 -0400 (EDT) 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 1C8626B026B; Mon, 15 Jul 2019 07:02:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by kanga.kvack.org (Postfix) with ESMTP id 9DC646B026C for ; Mon, 15 Jul 2019 07:02:25 -0400 (EDT) Received: by mail-wr1-f72.google.com with SMTP id b14so8723902wrn.8 for ; Mon, 15 Jul 2019 04:02:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=VDmH1/btnNfyQokX30yDSfOXwgboL6oOf5YsWu008K0=; b=PLjzyf5rKMkPSIX+R0BnRNCS0EEE7NmeWHj1yH+/mz+LJw4qXZ8x65adIeslDYq1/r ySw9/z7XdMb62ibgyCPGmptyTh5vwZ2ySDHiizo14xwtudvN2lO1tWut0y16nOj/xCKX oixvKslA2Q9CG5ejdNXWWMdWHaCMWablMbp35k23Xb6ppwG2BtebM2oeZ2Gj4r6ZLg0v 1n56xJkY8oTO7csI6WbB/0UgxfA2mZWTSpvBDE0En5DC1Qn2lmWgMFzk77nhBKkZFUt6 UikfeGbTGwZpugV/FK0t9zy9jEFx0Oupn7vIO9wU9UKdIOHZOGZa97IJ7++KKy3VGMOu UhtQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org X-Gm-Message-State: APjAAAWDOEiZKOiOJKX/ksyLakB4ZUDREJg1ngCtHhAKGdGkvwNoMTiv B6zrTg5RBS37V/NWUMIfRLcJag2UE9RbB6dsAlig8mFtNPXQZH5m8Kxo+YQ+jIUTlLH+TR8u4H+ fROs1TpLMuLyIX3ifQVF5FLQm29evPozvbTJFWYO47OIOGqTqo8RF8d49BK0ygH07Mg== X-Received: by 2002:a1c:2d58:: with SMTP id t85mr22418742wmt.61.1563188545123; Mon, 15 Jul 2019 04:02:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWSV0bYKOltDV7xhLIEabrvsADfQyDS5PvknIw9HHOV55XY11AsXGirPFep0T+3y3IdQHl X-Received: by 2002:a1c:2d58:: with SMTP id t85mr22418623wmt.61.1563188544005; Mon, 15 Jul 2019 04:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563188544; cv=none; d=google.com; s=arc-20160816; b=e5xqvSBPX0zfCskVtBlK9rWJ1S0nAYIzcbaB1e8NmNz12xfzS691i88DrR/AYdB4B+ tHca/DI+yxjDBg+TZsxc0mIvXhYXNtso8HBU8tIn9Iq1B55mrJSeCIgg4qlT2B26+pc3 lz2m/FixEG2+WIRl234GLr25jSVUkWzr536bV4lLdQV7S7fCqbLVKppXOX3HnJ6omIqv k8p8XvUNuQK/bPeDY2Y1WDRI2mteZAXY7v7l/thZKcp7M0HXUSeuATPoQJH7TDc0ouj7 VZq5I+NXycquG+W8MgSm5/jFFDMRXNYVsNiUnzms/QNcT49MFgN4MtUxmT2SEvibqREe QtbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=VDmH1/btnNfyQokX30yDSfOXwgboL6oOf5YsWu008K0=; b=m8/shYsiZCeixCuemYtlz1bMsrxTPytBCNENaMkp+3IM8MB4kQbSLdqlzpUy3FGSBK lnbqiB8zVK96QCdiW183PCa2NLBjawbw41sEZi6dz6KRlLR4qDW3rDAXg5aAg47WS5RO R4Q46youRYLzRNT+DX3ZJEGFvUpev4V95yRj25dRdsz5m8YNf/Jv65jSwjIOjPN9MK/j +xKqhpdoDXMlflpnZPFEvcYBKtGqnEaHfNoWjciItJIn/F0I+9Q7WzLB0ncjCmON4az2 LbN6xvW89tZ4JkGKbbZ+FPC3e2thJTxbNpZk27CK9H1tDNdjhP0eOvbJ1sV5ll+UYCt+ aX9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: from theia.8bytes.org (8bytes.org. [81.169.241.247]) by mx.google.com with ESMTPS id g9si17255432wrp.347.2019.07.15.04.02.23 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 15 Jul 2019 04:02:23 -0700 (PDT) Received-SPF: pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) client-ip=81.169.241.247; Authentication-Results: mx.google.com; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: by theia.8bytes.org (Postfix, from userid 1000) id 948EB41D; Mon, 15 Jul 2019 13:02:22 +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 3/3] mm/vmalloc: Sync unmappings in vunmap_page_range() Date: Mon, 15 Jul 2019 13:02:12 +0200 Message-Id: <20190715110212.18617-4-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190715110212.18617-1-joro@8bytes.org> References: <20190715110212.18617-1-joro@8bytes.org> 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: X-Virus-Scanned: ClamAV using ClamSMTP From: Joerg Roedel 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 regions 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. References: https://bugzilla.suse.com/show_bug.cgi?id=1118689 Fixes: 7757d607c6b3 ('x86/pti: Allow CONFIG_PAGE_TABLE_ISOLATION for x86_32') Signed-off-by: Joerg Roedel --- mm/vmalloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 4fa8d84599b0..322b11a374fd 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -132,6 +132,8 @@ static void vunmap_page_range(unsigned long addr, unsigned long end) continue; vunmap_p4d_range(pgd, addr, next); } while (pgd++, addr = next, addr != end); + + vmalloc_sync_all(); } static int vmap_pte_range(pmd_t *pmd, unsigned long addr,