Re: [PATCH] livepatch: add (un)patch hooks

From: Josh Poimboeuf
Date: Thu Jul 20 2017 - 00:20:10 EST


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