Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751317AbeAEGRA (ORCPT + 1 other); Fri, 5 Jan 2018 01:17:00 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:3725 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751234AbeAEGQ7 (ORCPT ); Fri, 5 Jan 2018 01:16:59 -0500 Subject: Re: [PATCH 05/23] x86, kaiser: unmap kernel from userspace page tables (core patch) To: Dave Hansen , References: <20171123003438.48A0EEDE@viggo.jf.intel.com> <20171123003447.1DB395E3@viggo.jf.intel.com> <93776eb2-b6d4-679a-280c-8ba558a69c34@linux.intel.com> CC: , , , , , , , , , From: Yisheng Xie Message-ID: Date: Fri, 5 Jan 2018 14:16:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <93776eb2-b6d4-679a-280c-8ba558a69c34@linux.intel.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.40] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi Dave, On 2018/1/5 13:18, Dave Hansen wrote: > On 01/04/2018 08:16 PM, Yisheng Xie wrote: >>> === Page Table Poisoning === >>> >>> KAISER has two copies of the page tables: one for the kernel and >>> one for when running in userspace. >> >> So, we have 2 page table, thinking about this case: >> If _ONE_ process includes _TWO_ threads, one run in user space, the other >> run in kernel, they can run in one core with Hyper-Threading, right? > > Yes. > >> So both userspace and kernel space is valid, right? And for one core >> with Hyper-Threading, they may share TLB, so the timing problem >> described in the paper may still exist? > > No. The TLB is managed per logical CPU (hyperthread), as is the CR3 > register that points to the page tables. Two threads running the same > process might use the same CR3 _value_, but that does not mean they > share TLB entries. Get it, and thanks for your explain. BTW, we have just reported a bug caused by kaiser[1], which looks like caused by SMEP. Could you please help to have a look? [1] https://lkml.org/lkml/2018/1/5/3 Thanks Yisheng > > One thread *can* be in the kernel with the kernel page tables while the > other is in userspace with the user page tables active. They will even > use a different PCID/ASID for the same page tables normally. > >> Can this case still be protected by KAISER? > > Yes. > > . >