Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751808AbdF1Phj (ORCPT ); Wed, 28 Jun 2017 11:37:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58942 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751535AbdF1Phc (ORCPT ); Wed, 28 Jun 2017 11:37:32 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7427DC04B954 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=joe.lawrence@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7427DC04B954 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 Subject: [PATCH v2 0/2] livepatch: add shadow variable API Date: Wed, 28 Jun 2017 11:37:25 -0400 Message-Id: <1498664247-12296-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.31]); Wed, 28 Jun 2017 15:37:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2291 Lines: 55 This is v2 of the shadow variable implementation patchset, incorporating much of the feedback from the first version: v2: - squashed the Documentation patch with the API implementation patch - converted API parameter/return documentation to docbook style comments in the .c implementation - converted the klp_shadow string descriptor to an unsigned long - combined shadow data and klp_shadow structure to one allocation - adopted kfree_rcu() suggestion - added klp_shadow_get_or_create() to the API to help avoid racing klp_shadow_get + klp_shadow_attach() instances - added klp_shadow_detach_all() to the API to cleanup a set of <*, num> shadow variables - created a new set of sample modules to demonstrate the API: - a buggy module - fix 1 to plug a memory leak in newly allocate data structures - fix 2 to add functionality to in-flight data structures The sample modules are contrived to demonstrate the shadow variable API. Instead of patching already in-tree code, I created a simple module to avoid any kallsyms workarounds. That said, the description and demonstration debug printing could stand further refinement. IMHO, the code is easier to follow than the periodic kernel messages logged. Suggestions welcome. Joe Lawrence (2): livepatch: introduce shadow variable API livepatch: add shadow variable sample programs Documentation/livepatch/shadow-vars.txt | 156 +++++++++++++ include/linux/livepatch.h | 8 + kernel/livepatch/Makefile | 2 +- kernel/livepatch/shadow.c | 257 ++++++++++++++++++++++ samples/Kconfig | 5 +- samples/livepatch/Makefile | 3 + samples/livepatch/livepatch-shadow-fix1.c | 160 ++++++++++++++ samples/livepatch/livepatch-shadow-fix2.c | 157 +++++++++++++ samples/livepatch/livepatch-shadow-mod.c | 353 ++++++++++++++++++++++++++++++ 9 files changed, 1097 insertions(+), 4 deletions(-) create mode 100644 Documentation/livepatch/shadow-vars.txt create mode 100644 kernel/livepatch/shadow.c create mode 100644 samples/livepatch/livepatch-shadow-fix1.c create mode 100644 samples/livepatch/livepatch-shadow-fix2.c create mode 100644 samples/livepatch/livepatch-shadow-mod.c -- 1.8.3.1