Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753771AbdLNVsx (ORCPT ); Thu, 14 Dec 2017 16:48:53 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:38467 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752622AbdLNVsv (ORCPT ); Thu, 14 Dec 2017 16:48:51 -0500 X-Google-Smtp-Source: ACJfBosNm2oq0RHabwGyOuDLEcAVFeMO+az193zxftjS4WrvbPBUbDPrMOqOk5tjoL6QOF4Yb7QLhy+o+rahCV24zoM= MIME-Version: 1.0 In-Reply-To: References: <20171214112726.742649793@infradead.org> <20171214113851.647809433@infradead.org> From: Linus Torvalds Date: Thu, 14 Dec 2017 13:48:50 -0800 X-Google-Sender-Auth: PlWpn0URbeJ9kfwUF_GYyDf3E_o Message-ID: Subject: Re: [PATCH v2 11/17] selftests/x86/ldt_gdt: Prepare for access bit forced To: Andy Lutomirski Cc: 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 760 Lines: 18 On Thu, Dec 14, 2017 at 1:44 PM, Linus Torvalds wrote: > > 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. Actually, just clearing PAGE_USER should make gup avoid it automatically. 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. 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. Linus