Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933776AbdGTEUH (ORCPT ); Thu, 20 Jul 2017 00:20:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56554 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932811AbdGTEUF (ORCPT ); Thu, 20 Jul 2017 00:20:05 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 904B24A70F Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jpoimboe@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 904B24A70F Date: Wed, 19 Jul 2017 23:20:00 -0500 From: Josh Poimboeuf To: Petr Mladek Cc: Joe Lawrence , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Jessica Yu , Jiri Kosina , Miroslav Benes , Chris J Arges Subject: Re: [PATCH] livepatch: add (un)patch hooks Message-ID: <20170720042000.34trkuzwevrkscds@treble> References: <1499868600-10176-1-git-send-email-joe.lawrence@redhat.com> <1499868600-10176-2-git-send-email-joe.lawrence@redhat.com> <20170717155144.GF32632@pathway.suse.cz> <20170719204952.4fyhtig3rbw7z4w4@treble> <20170720041723.35r6qk2fia7xix3t@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170720041723.35r6qk2fia7xix3t@treble> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 20 Jul 2017 04:20:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 487 Lines: 21 On Wed, Jul 19, 2017 at 11:17:23PM -0500, Josh Poimboeuf wrote: > +static void swapgs_unload_hook(void) > +{ > + if (paravirt_enabled() && strcmp(pv_info.name, "KVM")) > + return; > + > + write_cr0(read_cr0() & ~X86_CR0_WP); > + barrier(); > + > + set_intr_gate_ist(X86_TRAP_SS, stack_segment_v2, STACKFAULT_STACK); s/stack_segment_v2/stack_segment/ for the unload hook > + > + barrier(); > + write_cr0(read_cr0() | X86_CR0_WP); > +} > +KLP_UNLOAD_HOOK(swapgs_unload_hook); -- Josh