Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934348Ab3DISW3 (ORCPT ); Tue, 9 Apr 2013 14:22:29 -0400 Received: from mail-oa0-f54.google.com ([209.85.219.54]:65507 "EHLO mail-oa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754499Ab3DISW2 (ORCPT ); Tue, 9 Apr 2013 14:22:28 -0400 MIME-Version: 1.0 In-Reply-To: References: <20130408224328.GA17641@www.outflux.net> <51634935.9010905@zytor.com> Date: Tue, 9 Apr 2013 11:22:27 -0700 X-Google-Sender-Auth: n8apRxYu9ceGaQYttR3SBh8z7RY Message-ID: Subject: Re: [kernel-hardening] Re: [PATCH] x86: make IDT read-only From: Kees Cook To: "kernel-hardening@lists.openwall.com" Cc: "H. Peter Anvin" , Ingo Molnar , LKML , "x86@kernel.org" , Konrad Rzeszutek Wilk , Jeremy Fitzhardinge , Marcelo Tosatti , Alex Shi , Borislav Petkov , Alexander Duyck , Frederic Weisbecker , Steven Rostedt , "Paul E. McKenney" , "xen-devel@lists.xensource.com" , "virtualization@lists.linux-foundation.org" , Dan Rosenberg , Julien Tinnes , Will Drewry , Eric Northup Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1608 Lines: 49 On Tue, Apr 9, 2013 at 2:23 AM, Thomas Gleixner wrote: > On Mon, 8 Apr 2013, H. Peter Anvin wrote: > >> On 04/08/2013 03:43 PM, Kees Cook wrote: >> > This makes the IDT unconditionally read-only. This primarily removes >> > the IDT from being a target for arbitrary memory write attacks. It has >> > an added benefit of also not leaking (via the "sidt" instruction) the >> > kernel base offset, if it has been relocated. >> > >> > Signed-off-by: Kees Cook >> > Cc: Eric Northup >> >> Also, tglx: does this interfere with your per-cpu IDT efforts? > > I don't think so. And it's on the backburner at the moment. What would be a good way to do something similar for the GDT? sgdt leaks GDT location as well, and even though it's percpu, it should be trivial to figure out a kernel base address, IIUC. $ ./sgdt ffff88001fc04000 # cat /sys/kernel/debug/kernel_page_tables ... ---[ Low Kernel Mapping ]--- ... 0xffff880001e00000-0xffff88001fe00000 480M RW PSE GLB NX pmd With the IDT patch, things look good for sidt: $ ./sidt ffffffffff579000 # cat /sys/kernel/debug/kernel_page_tables ... ---[ End Modules ]--- 0xffffffffff579000-0xffffffffff57a000 4K ro GLB NX pte Can we create a RO fixed per-cpu area? -Kees -- Kees Cook Chrome OS Security -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/