From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [PATCH v2 3/3] x86: Make the GDT remapping read-only on 64 bit Date: Thu, 2 Feb 2017 08:12:25 +0100 Message-ID: <20170202071225.GB2368@gmail.com> References: <20170126165940.30799-1-thgarnie@google.com> <20170126165940.30799-3-thgarnie@google.com> <20170201091534.GA25025@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: List-Post: List-Help: List-Unsubscribe: List-Subscribe: Sender: Ingo Molnar Content-Disposition: inline In-Reply-To: To: Andy Lutomirski Cc: Thomas Garnier , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Kees Cook , Arjan van de Ven , Paul Gortmaker , Borislav Petkov , "Rafael J . Wysocki" , Len Brown , Pavel Machek , Jiri Kosina , Matt Fleming , Ard Biesheuvel , Boris Ostrovsky , Juergen Gross , Rusty Russell , Christian Borntraeger , Fenghua Yu , He Chen Br List-Id: linux-pm@vger.kernel.org * Andy Lutomirski wrote: > On Wed, Feb 1, 2017 at 1:15 AM, Ingo Molnar wrote: > > > > * Thomas Garnier wrote: > > > >> This patch makes the GDT remapped pages read-only to prevent corruption. > >> This change is done only on 64 bit. > > > > > >> > >> - table_base = gdt->address; > >> + table_base = (unsigned long)get_current_direct_gdt(); > > > > Instead of spreading these type casts far and wide please introduce another > > accessor the returns 'unsigned long': > > > > get_cpu_gdt_rw_vaddr() > > > > That whole function is an abomination. How about replacing 'unsigned > long table_base' with 'struct desc_struct *table'? If you're feeling > really adventurous, *delete* that function and replace all of its > users with something sane. Yeah, even better! Thanks, Ingo