[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9b9a99da3f68cf11197f2035515f1d441c0d1565.camel@intel.com>
Date: Tue, 24 Aug 2021 16:45:04 +0000
From: "Williams, Dan J" <dan.j.williams@...el.com>
To: "Lutomirski, Andy" <luto@...nel.org>,
"Edgecombe, Rick P" <rick.p.edgecombe@...el.com>,
"x86@...nel.org" <x86@...nel.org>, "bp@...en8.de" <bp@...en8.de>,
"peterz@...radead.org" <peterz@...radead.org>,
"hpa@...or.com" <hpa@...or.com>,
"mingo@...hat.com" <mingo@...hat.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"wency@...fujitsu.com" <wency@...fujitsu.com>
Subject: Re: [PATCH] x86/mm: Flush before free in remove_pagetable()
On Wed, 2021-08-18 at 15:10 -0700, Rick Edgecombe wrote:
>
> In remove_pagetable(), page tables may be freed before the TLB is
> flushed. The upper page tables are zapped before freeing the lower
> levels. However, without the flush the lower tables can still remain in
> paging-structure caches and so data that is written to the re-allocated
> page can control these mappings. For some reason there is only a flush
> lower down in remove_pte_table(), however, this will not be hit in the
> case of large pages on the direct map which is common.
It's also common for device-dax reconfiguration which we are in the
process of adding udev automation to replug devices from ZONE_DEVICE to
ZONE_{NORMAL,MOVABLE} automatically depending on what setup was
estabished on the previous boot. So even if unpriveleged userspace
can't force this, there may be more opportunities to find this gap in
the future.
>
> Currently remove_pagetable() is called from a few places in the
> hot unplug codepath and memremap unmapping operations.
>
> To properly tear down these mappings, gather the page tables using a
> simple linked list based in the table's struct page. Then flush the TLB
> before actually freeing the pages.
>
> Cc: stable@...r.kernel.org
> Fixes: ae9aae9eda2d ("memory-hotplug: common APIs to support page tables hot-remove")
> Acked-by: Dave Hansen <dave.hansen@...ux.intel.com>
> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
Acked-by: Dan Williams <dan.j.williams@...el.com>
Powered by blists - more mailing lists