From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f198.google.com (mail-pf0-f198.google.com [209.85.192.198]) by kanga.kvack.org (Postfix) with ESMTP id F2EB46B0033 for ; Thu, 14 Dec 2017 17:11:07 -0500 (EST) Received: by mail-pf0-f198.google.com with SMTP id j3so5817240pfh.16 for ; Thu, 14 Dec 2017 14:11:07 -0800 (PST) Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id p11sor1466793pfl.12.2017.12.14.14.11.06 for (Google Transport Security); Thu, 14 Dec 2017 14:11:06 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v2 11/17] selftests/x86/ldt_gdt: Prepare for access bit forced From: Andy Lutomirski In-Reply-To: Date: Thu, 14 Dec 2017 14:11:03 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20171214112726.742649793@infradead.org> <20171214113851.647809433@infradead.org> Sender: owner-linux-mm@kvack.org List-ID: To: Linus Torvalds Cc: Andy Lutomirski , Peter Zijlstra , "linux-kernel@vger.kernel.org" , Thomas Gleixner , X86 ML , Dave Hansen , Borislav Petkov , Greg KH , Kees Cook , Hugh Dickins , Brian Gerst , Josh Poimboeuf , Denys Vlasenko , Boris Ostrovsky , Juergen Gross , David Laight , Eduardo Valentin , "Liguori, Anthony" , Will Deacon , "linux-mm@kvack.org" , "Kirill A. Shutemov" , Dan Williams > On Dec 14, 2017, at 1:48 PM, Linus Torvalds wrote: >=20 > On Thu, Dec 14, 2017 at 1:44 PM, Linus Torvalds > wrote: >>=20 >> So it clearly needs to have the PAGE_USER bit clear (to avoid users >> accessing it directly), and it needs to be marked somehow for >> get_user_pages() to refuse it too, and access_ok() needs to fail it so >> that we can't do get_user/put_user on it. >=20 > Actually, just clearing PAGE_USER should make gup avoid it automatically. >=20 > So really the only other thing it needs is to have access_ok() avoid > it so that the kernel can't be fooled into accessing it for the user. >=20 > That does probably mean having to put it at the top of the user > address space and playing games with user_addr_max(). Which is not > wonderful, but certainly not rocket surgery either. That seems to rather defeat the point of using a VMA, though. And it means w= e still have to do a full cmp instead of just checking a sign bit in access_= ok if we ever manage to kill set_fs(). Again, I have an apparently fully functional patch to alias the LDT at a hig= h (kernel) address where we can cleanly map it in the user pagetables withou= t any of this VMA stuff. It's much less code. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org