Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753740AbdLNVoG (ORCPT ); Thu, 14 Dec 2017 16:44:06 -0500 Received: from mail-it0-f48.google.com ([209.85.214.48]:41979 "EHLO mail-it0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753041AbdLNVoE (ORCPT ); Thu, 14 Dec 2017 16:44:04 -0500 X-Google-Smtp-Source: ACJfBouoBCcsuWN2hWvGZMQ2LsStfxyzjB+pj8Dd4EKTL3IFamKaLaQf0qD5TQ08whk6d9ISuLYV1Ipjs1nIqjydHZ0= 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:44:03 -0800 X-Google-Sender-Auth: Z6hviZ8S1PmvZZM-n699_KwOte8 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: 974 Lines: 26 On Thu, Dec 14, 2017 at 1:22 PM, Andy Lutomirski wrote: > > Which kind of kills the whole thing. There's no way the idea of > putting the LDT in a VMA is okay if it's RW. Sure there is. I really don't understand why you guys think it has to be RO. All it has to be is not _user_ accessible. And that's a requirement regardless, because no way in hell should users be able to read the damn thing. 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. But the whole RO vs RW is not fundamentally critical. Now, I do agree that RO is much much better in general, and it avoids the requirement to play games with "access_ok()" and friends (assuming we're just ok with users reading it), but I disagree with the whole "this is fundamental". Linus