Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp92728ybn; Thu, 3 Oct 2019 02:02:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDGAdDZMAQhPW3EhHJjjn6oqpyISswZvj2/INyIluTye9qInIgh7RnGqd0D1mwKtYAgoR/ X-Received: by 2002:a50:ed82:: with SMTP id h2mr8344247edr.206.1570093349676; Thu, 03 Oct 2019 02:02:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570093349; cv=none; d=google.com; s=arc-20160816; b=QjCBE0CIBa3NpDP0vIrbyf+Sf0u16qdxauLZitpKO54RzZg1EePyTHzfwws5AMjKhT GwTny9ks/YmeGXM3oTQTvUTGYxmocaEGJW9UAHOL1l02paJpATqsoCvQYRwOSesq6YPG gFdHpJNd2UxmOOMsvq7fqFncGtlZcWm8isJ5d4y+vUHmwvlqKpzEkj4OqHe6Q39epxcZ 2hEdjHfDubI61KTZOz9L382Y4SPB+wMNYcZcVbaDMW5JXDVRy3JqdPgJk+M2jhwNITY7 geWz5IdKT7Jtulgs0iXUaJ4mCrP4jKicfwD2wJE21xMpquBmR01yXQIwX3px/OmZLhv/ zX3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=0CKTU/wKzyPMoN+UJ0Ijj+nKxzZ3GFSoufwuMi59W5k=; b=WKCSFX7UsuyJt+yLIYofJA1YUjcbYzmdnc6U8/pNn+CSfEeCq3CyiDCO2jDBg3vDj5 gLdoiQKg/2dkh4hNohnnJVSBMkr8nMkLcqvHz6urJP4o+/IvyKrgPboGIbCAAwNeu283 oUz+/ht8l80W2awKIaz5Ti1biEd6YYfyZzrfCBA1nmWFd1n+rZJeAePfpIYKebS/31dH SawtBu9HpwcY8C/soZcH7xpt/8BoOWIDFmHtPCSMF5Imd7e0dPpmInvFJ3mkXIavu2bw 8L2CRrxycmk7YGlR4PbNV/Rl5pZsyzhuxhPElZEzsXzznhY7kZN4A7d3tEVCRgbgTqWK sqDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d29si1033006edb.203.2019.10.03.02.02.04; Thu, 03 Oct 2019 02:02:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728947AbfJCJBx (ORCPT + 99 others); Thu, 3 Oct 2019 05:01:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:50264 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727611AbfJCJBx (ORCPT ); Thu, 3 Oct 2019 05:01:53 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 43706B144; Thu, 3 Oct 2019 09:01:51 +0000 (UTC) From: Petr Mladek To: Jiri Kosina , Josh Poimboeuf , Miroslav Benes Cc: Joe Lawrence , Kamalesh Babulal , Nicolai Stange , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Petr Mladek Subject: [PATCH v3 0/5] livepatch: new API to track system state changes Date: Thu, 3 Oct 2019 11:01:32 +0200 Message-Id: <20191003090137.6874-1-pmladek@suse.com> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, this is another piece in the puzzle that helps to maintain more livepatches. Especially pre/post (un)patch callbacks might change a system state. Any newly installed livepatch has to somehow deal with system state modifications done be already installed livepatches. This patchset provides a simple and generic API that helps to keep and pass information between the livepatches. It is also usable to prevent loading incompatible livepatches. Changes since v2: + Typo fixes [Miroslav] + Move the documentation at the end of the list [Miroslav] + Add Miroslav's acks Changes since v1: + Use "unsigned long" instead of "int" for "state.id" [Nicolai] + Use "unsigned int" instead of "int" for "state.version [Petr] + Include "state.h" to avoid warning about non-static func [Miroslav] + Simplify logic in klp_is_state_compatible() [Miroslav] + Document how livepatches should handle the state [Nicolai] + Fix some typos, formulation, module metadata [Joe, Miroslav] Petr Mladek (5): livepatch: Keep replaced patches until post_patch callback is called livepatch: Basic API to track system state changes livepatch: Allow to distinguish different version of system state changes livepatch: Documentation of the new API for tracking system state changes livepatch: Selftests of the API for tracking system state changes Documentation/livepatch/index.rst | 1 + Documentation/livepatch/system-state.rst | 167 +++++++++++++++++++++ include/linux/livepatch.h | 17 +++ kernel/livepatch/Makefile | 2 +- kernel/livepatch/core.c | 44 ++++-- kernel/livepatch/core.h | 5 +- kernel/livepatch/state.c | 122 +++++++++++++++ kernel/livepatch/state.h | 9 ++ kernel/livepatch/transition.c | 12 +- lib/livepatch/Makefile | 5 +- lib/livepatch/test_klp_state.c | 161 ++++++++++++++++++++ lib/livepatch/test_klp_state2.c | 190 ++++++++++++++++++++++++ lib/livepatch/test_klp_state3.c | 5 + tools/testing/selftests/livepatch/Makefile | 3 +- tools/testing/selftests/livepatch/test-state.sh | 180 ++++++++++++++++++++++ 15 files changed, 902 insertions(+), 21 deletions(-) create mode 100644 Documentation/livepatch/system-state.rst create mode 100644 kernel/livepatch/state.c create mode 100644 kernel/livepatch/state.h create mode 100644 lib/livepatch/test_klp_state.c create mode 100644 lib/livepatch/test_klp_state2.c create mode 100644 lib/livepatch/test_klp_state3.c create mode 100755 tools/testing/selftests/livepatch/test-state.sh -- 2.16.4