Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752555AbdGLOKQ (ORCPT ); Wed, 12 Jul 2017 10:10:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20995 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751120AbdGLOKP (ORCPT ); Wed, 12 Jul 2017 10:10:15 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3126C3D95D Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=joe.lawrence@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3126C3D95D From: Joe Lawrence To: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Josh Poimboeuf , Jessica Yu , Jiri Kosina , Miroslav Benes , Petr Mladek , Chris J Arges Subject: [PATCH] livepatch hooks, revisted Date: Wed, 12 Jul 2017 10:09:59 -0400 Message-Id: <1499868600-10176-1-git-send-email-joe.lawrence@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 12 Jul 2017 14:10:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1581 Lines: 42 Hi all, This patch revists the effort that Chris Argus made last year to port kpatch-style "load hooks" to livepatch: https://lkml.org/lkml/2016/8/26/434 Since that discussion, the consistency model has been merged. This patch locates the hooks in a slightly different place, providing callbacks to a livepatch module whenever a klp_object is being patched or unpatched. A pointer to the current klp_object undergoing (un)patching is also passed to the hook callback -- with that in hand, the hook implementation can make decisions based on the current module state (live, coming, going). A new Documentation/ file is provided as well as a contrived sample module and livepatch demo to demonstrate the callbacks. The example is about as simple as possible, but could be further embellished to resemble a real-world livepatch fix if desired. Thanks, Joe Lawrence (1): livepatch: add (un)patch hooks Documentation/livepatch/hooks.txt | 98 +++++++++++++++++++++++++ include/linux/livepatch.h | 32 ++++++++ kernel/livepatch/core.c | 5 -- kernel/livepatch/patch.c | 35 +++++++++ samples/livepatch/Makefile | 2 + samples/livepatch/livepatch-hooks-demo.c | 122 +++++++++++++++++++++++++++++++ samples/livepatch/livepatch-hooks-mod.c | 38 ++++++++++ 7 files changed, 327 insertions(+), 5 deletions(-) create mode 100644 Documentation/livepatch/hooks.txt create mode 100644 samples/livepatch/livepatch-hooks-demo.c create mode 100644 samples/livepatch/livepatch-hooks-mod.c -- 1.8.3.1