Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757148AbcC2MF1 (ORCPT ); Tue, 29 Mar 2016 08:05:27 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:33056 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756877AbcC2MFZ (ORCPT ); Tue, 29 Mar 2016 08:05:25 -0400 Date: Tue, 29 Mar 2016 07:05:18 -0500 From: Chris J Arges To: jeyu@redhat.com, jpoimboe@redhat.com, eugene.shatokhin@rosalab.ru Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Bug with paravirt ops and livepatches Message-ID: <20160329120518.GA21252@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1154 Lines: 25 Paravirtualized ops and livepatching currently don't mix very well and can cause undefined behavor such as oops, invalid opcodes or corrupted stacks. The original discussion of this issue can be found here [1]. I've written an example livepatch module that reproduces the issue [2]. In order to trigger the issue you must first insert the module then trigger the paravirt ops by starting a VM. In the thread here [1] a couple of solutions have been proposed: 1) Jessica proposed using the Arch-independent patchset ensure that livepatch finishes writing its relas before apply_paravirt() is called. However, this introduces a bit more arch-dependent code. It would be useful to see if other arches are affected by this as well. 2) Eugene proposed skipping application of the rela if the instruction to be relocated has already been changed. This passes the initial example [2]; however its unclear if/how this will break things. It may be good to weigh in here and get more eyes on this. Thanks, --chris [1]: https://github.com/dynup/kpatch/issues/580 [2]: http://people.canonical.com/~arges/livepatch_issue/livepatch_kvm_arch_vm_ioctl/livepatch.c