From patchwork Wed Jul 17 07:14:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 11047363 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 1EA80138D for ; Wed, 17 Jul 2019 07:14:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3BAE205A8 for ; Wed, 17 Jul 2019 07:14:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4F862859F; Wed, 17 Jul 2019 07:14:55 +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 4428A205A8 for ; Wed, 17 Jul 2019 07:14:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2413C8E0003; Wed, 17 Jul 2019 03:14:54 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1FF976B000A; Wed, 17 Jul 2019 03:14:54 -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 091EE8E0001; Wed, 17 Jul 2019 03:14:54 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id C4E806B0005 for ; Wed, 17 Jul 2019 03:14:53 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id i44so17447268eda.3 for ; Wed, 17 Jul 2019 00:14:53 -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=q5k3+gcYubZ7T/g6o53+F1W99oG/lraAHoxlon+CyWg=; b=AMsY3axQsl5zoc5BSUbl2XTj2UiA06t14QSi/G88/txHGRBbuvpvsRh9VkqekfYR5U 2NfCnQfRjJ+AcvqTAJ1494aLJDXd8JaLUT4bdsQvplG6tJkh9d62gsTqdTbX1Z1zp3L6 MkNxik/aKxHypJ22iEJAB1qkHAQZjhuCMAi3WtGQnHm7iEe+ZQbNvdxHJjw/71Zum+aF f0OPK85X1GXqrLrRElh7vp+1Vpgd2MaNMA0HWoc2ONvBs9khwCwYDy1TLIdzRiCznsr3 OWQY8cQFfSwZU5b1ijRo7DsZhoqCy4j70m40OygXbzx3xWPDyZz5ZMC9icGEhvsYy8o1 20eA== 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: APjAAAXzl9Ep5y8I9ZcwB3k3qFwGQQ4kc0NVMdgLS21LnSmkqGFMqFG2 K/txSEEJGFr1J0BvLPO8t/eKe2lno+6qdqiZPz5V0HUYuimft4sOdT0FsYY1ARBI+QZj84dLfqS dYd58AaeRPJhZ4r57jgTr+wRDUGAP8xj0QdLx/DiLhbjUzAOdwAdYlVwVvW+WUP9M2Q== X-Received: by 2002:a17:906:4e92:: with SMTP id v18mr30445108eju.57.1563347693392; Wed, 17 Jul 2019 00:14:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVSf3653kEOUktTLwEVo68YDGnMuFDwFNAnRQWXvN8R2/y0K7rCdsX2Te08bSsIeDsHAcK X-Received: by 2002:a17:906:4e92:: with SMTP id v18mr30445061eju.57.1563347692573; Wed, 17 Jul 2019 00:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563347692; cv=none; d=google.com; s=arc-20160816; b=ZniRpl8EC1SKtT2piC69+VIg7Wkm7puNjmOaFJvPcEg1tHwq+99em5fuSAcNs8WB+3 na+YUyG7KBTThJ/IG0uv1AiQPNkp6L1ERUV/1pTCr5KOQcZXFZZUdKYajXQOWhrAfDYu X9KlX9X21Dg3HsRDcN9VuAeErsV93xf+mV1qp6Ow1YitQnGOmafYjJjYg9VzJ4b3Rw4Q U389eySvzWNB0Osu4SR+fkSTw5XRCi0ZF8Ll3BQlUCUJQOnHVqDgzcteDnX8YY/6VSyc 811XPLAUhWqu80YO27CzDc5FtDQBsDh2g6k3vBQkI0q5TlnqsukRHYGQNUsK7KSdOK8f /kiw== 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=q5k3+gcYubZ7T/g6o53+F1W99oG/lraAHoxlon+CyWg=; b=BDSw3N0mZlk7EQCKLleqmH73+ZA9dJSUXHZrbfchC6TiDW1BLl7WnBRTas6GCebnZR nAcSo6CHd6eBYQuPXg8DfmJEyZwjxptPfZUFu387WuUED2KCETykG9bxU8ZPhmEwJacU 7Kw7NY8o41xhkvhk/mgxN350d68w+YUv8BdFJ4kSe/AJaqzS7+9StZ9iSe5sE4AZ8LyX yocADAibM2gzJwczVlWrpsW8KUuv3iXjO2/rYbUkSKZuZbQCOqVJOJzm9MIV8mfUxPPO 28LfWiaVzAAg/PT8u9mN0DJ5fLCObmfiJPA99lDGmItkkzO+5VT/mKJ1S/8zWpmVRbAD Hg4A== 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 s18si14384582edd.291.2019.07.17.00.14.52 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 17 Jul 2019 00:14:52 -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 D0A89260; 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 1/3] x86/mm: Check for pfn instead of page in vmalloc_sync_one() Date: Wed, 17 Jul 2019 09:14:37 +0200 Message-Id: <20190717071439.14261-2-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> 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. Fixes: 5d72b4fba40ef ('x86, mm: support huge I/O mapping capability I/F') 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 Wed Jul 17 07:14:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 11047365 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 7C7BC112C for ; Wed, 17 Jul 2019 07:14:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67090205A8 for ; Wed, 17 Jul 2019 07:14:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5ACFB2859F; Wed, 17 Jul 2019 07:14:58 +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 012CC205A8 for ; Wed, 17 Jul 2019 07:14:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 722B56B0008; Wed, 17 Jul 2019 03:14:54 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6DB978E0001; Wed, 17 Jul 2019 03:14:54 -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 573E68E0006; Wed, 17 Jul 2019 03:14:54 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id 20A068E0001 for ; Wed, 17 Jul 2019 03:14:54 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id y24so17452632edb.1 for ; Wed, 17 Jul 2019 00:14:54 -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=OPVNf1Z/jEqzPnDbfZdzm520W9qSF3lMG0lCY2gLoj0=; b=PCRnYYWzLyrFcf2BOmudDZRQXd27uXXp1tNCFEsDie6f6I7a2UOJlwYeAhZOhj6di1 QDjlhrPiA+o01C3K+AZK6GOwJYx++Oiqh33hhmKwCyM7kwmlq4Z4Gj4QZsIn/9Pbt+3H +wN7476BAQbh7uEJKNnKIIJobepnNe1bUZOS4ggsIO/DPhTt/bcg5HDtwMRPPk34z82M 43y5q4LWYxNPxY1fcrHsXbtSXI15ZNm/KFXvwq7brqklHXnt3qTG+XmwdnRQCqG6jy7q XrgpZbMRC7eIb7fQ7Pixqc4qARcrSuGdmPTLIE5FQ/sORTSm7mdY7ahFOmftQMg73+PM r1bw== 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: APjAAAXk1iWi+DJ49p9nXLJbuDbKRfMraCXyLeuFz+cvTiQvQvSXkn9b VUqMFo++zmvAMYKpz5qxVj1W1o0Oaly6H/8j+erVFB0kQG32SrD/ZQx4N6+fxsYtxKrLskRC2r8 vaeRF2xsX26ROfQ8wSnx0SltCuMGFS4bcn6vZlhUa6F//VZmuYAS79ZraS1vM1zST2Q== X-Received: by 2002:a05:6402:8d7:: with SMTP id d23mr32880996edz.17.1563347693725; Wed, 17 Jul 2019 00:14:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3vuFjlmT6d5MBK0MUNex3gfqRU4xOdQ/BHbUrsXB0Mpf2cscBc2yTA4LQfyDpiZjkw97V X-Received: by 2002:a05:6402:8d7:: with SMTP id d23mr32880947edz.17.1563347692864; Wed, 17 Jul 2019 00:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563347692; cv=none; d=google.com; s=arc-20160816; b=nAh4H3+2z+VrRP+KhDtMJ2ImuNHd5MtfMkpqEMLZHYbW79ZN8q91JwtJKh/fcxXrbI gX67hafC/nbbfbfXIxuqQ0SW7nA8q8bED4Hvzbdma0TmyetgkNehGTzsl7KMINQ2UOEA qJshift4EVhoxRZsPffI8Qm5DMyvFBL0OF38NsWjtkESz4TsUiBZ0jkCMUNkL2gx3FjW z7cwmTGnBocmkp0sZaOuLJ5sHj5OhxsXnb/kr+GHCotisbWMy7WvCAG76BXhdxuooFyd gGwj67jlf9UxU+zXLOfLpGittGq5g+m5wc4pdLNlelo1WtOiMej6X1my8wNksonVnQmZ oIjA== 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=OPVNf1Z/jEqzPnDbfZdzm520W9qSF3lMG0lCY2gLoj0=; b=VyOU+BdttuUNw9lyhzlEc/2z24Gd92ZryTnJ0PjL+lF+6N43PlC8eJ72PLfu324+I2 s/lkaOZC1JlxcZIbZ/RjjAtOwSaPA9fcDWyWPzL9L7A0MTZlShdeUEwGnrZXFVPBV273 rttS/AprAKdq++nvpF6KE9IDYXLQvcu5MwR7P3CVNi7wsVa53yu0TrCa7nRN6geCDMgm SPeBi8JlMhK7JVW2H1E2KrDoHoer8BtBhB6bpZKwVTMx/sJp/PUe4D7+RQPtz92dJvn6 +grH8T/erbCgsF8spI9EPyLudcmNXDxsDV7doVAD3p/R843lUzJF5XVE1Ix9hXfgBAVW +3UQ== 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 h18si11237867eja.313.2019.07.17.00.14.52 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 17 Jul 2019 00:14:52 -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 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> 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. Fixes: 5d72b4fba40ef ('x86, mm: support huge I/O mapping capability I/F') Signed-off-by: Joerg Roedel Reviewed-by: Dave Hansen --- 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 Wed Jul 17 07:14:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 11047369 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 0A239112C for ; Wed, 17 Jul 2019 07:15:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6664205A8 for ; Wed, 17 Jul 2019 07:15:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D682E2859F; Wed, 17 Jul 2019 07:15:02 +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 683AA205A8 for ; Wed, 17 Jul 2019 07:15:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF0058E0005; Wed, 17 Jul 2019 03:14:54 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CA1846B000A; Wed, 17 Jul 2019 03:14:54 -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 A55898E0006; Wed, 17 Jul 2019 03:14:54 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id 387598E0005 for ; Wed, 17 Jul 2019 03:14:54 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id y24so17452636edb.1 for ; Wed, 17 Jul 2019 00:14:54 -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=Lnw+NdhmEcJZRPrRGQsYyVpoRNapOiKu9LqdRSkFBI0=; b=fnDkG5mSWuHeWj2fDWNf40vScxED8e8sG9Tzq87z5tnhxNalnjqhhHxFTiNghEI20Z DnmiY7QyQ8fSZ5FBgl6kCZzAX7qbkCmnqzPyUWAaPGvdmUSoqdJor2mMt7/OhZMXzSC6 VlIhfO7QG/4hPAB9cNE8k0eetbEtqt97b92I2G/AzJ2WbPB8OUjPi+GHoLtBDJzgl1fH Enc+ZouT2M2ifNW41ZK5SnEB93bNZA+5KT4ilLLSYAynzxJ9GIwsjJOkXtqP9ryCyDqr a9JXTPnMGgVQWIpxHP/2+SpOM0UEl0VmwYr20cZVs1k9nvpSRnvdwtSJbTVyqHL9NO1v FthQ== 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: APjAAAVXJlRrDly70rVGjslKhovtUE0xAbtYe9cvxvefUq/pQz2FwmHA l0xsrB8KlUIDIOS5L9ubsDRfoGsMay9XWqJ/KURVTXt674vgF20Vv07i6ZHGpBY3OsDFnsmQHlE z+sQyK5iAL57TbpxVDvb8UEWf4Cmw0XfOPCf/gI4CQ1UOJH+ZrTT9IsENTe4WV36VbQ== X-Received: by 2002:a17:906:7d56:: with SMTP id l22mr29862311ejp.236.1563347693819; Wed, 17 Jul 2019 00:14:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0Ssci0zReR8LYV2RiwzIJGexaVj/LZXNYxk16RecqMf8dZKl9WzWO2daYs/fYB2USG+uz X-Received: by 2002:a17:906:7d56:: with SMTP id l22mr29862269ejp.236.1563347693072; Wed, 17 Jul 2019 00:14:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563347693; cv=none; d=google.com; s=arc-20160816; b=RHcpJVoZbGo9fx4kW2BQjPobY5rLXo80N8vkfMlFNW4B0ddK3Qh60BRauIi6rc9amp O/uYuJ4GjrMvWLfy2h3ylEBk6RmpWfUsbyDDUcecrtkirNWtFfU1/JMjZUlex+Sz4Byu sQFXPFsGbLQuykDFb0WrsleX8xtE/ITKPmpE7cmoj5DRmX80zeqAjBSJkZDH+TXNhsQa F2f6Yep6tCxbgJtikLt0t4IzgmUFcJdgwnyYcrcL+vq3sQQt85eKHBBZWL2nJQYwqKkP tB7ladafCmMgaARImGBJHth2btJ2JANzmu+/giVQLNn93xRmZmBX+XVd3muSy1OhtzDm D0OQ== 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=Lnw+NdhmEcJZRPrRGQsYyVpoRNapOiKu9LqdRSkFBI0=; b=aPBiYu04j87y7DktWKAo/EfQrtvKuz/YcKchFnUtbb6THvd/YdxgyRjPVOnvpFr0cD kvqs4yy6OgdpvKRWpj4ZbRc9BXoTrRPVNhpdG2ye1z5NQYhkJ/KMb691MGQPMnnfJVt7 CSEUM4IbuMO9IJiiQk/DOn6Sx4mqiJ4ZiE/KzqeDJ3ZLp6uEGTlCKavb9cUbTzvjgojS K4Zx8gcqqml2KnObgrWioLq5/U1coxXXJrQeqPYRkWXaa2/lkiTAr+0jmYGKU7o7vTKo Cz1E36ttfdUYAMeivUPucCY1sLYbhfzXAoVPYqw+wfipW5x0UHaPJ1BWSg/mcRASLjk3 NPNA== 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 ec4si5417667ejb.37.2019.07.17.00.14.52 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 17 Jul 2019 00:14:53 -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 2231D476; Wed, 17 Jul 2019 09:14:52 +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: Wed, 17 Jul 2019 09:14:39 +0200 Message-Id: <20190717071439.14261-4-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> 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: 5d72b4fba40ef ('x86, mm: support huge I/O mapping capability I/F') 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,