Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4466092ybi; Tue, 11 Jun 2019 07:08:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzEnGOk8JpWQ7lmBL3Ca7yOGu1wjKJncUpNFEMoEKyRViBK4UBOxj+D8UXLL/frAY7+HW10 X-Received: by 2002:a62:d149:: with SMTP id t9mr59605757pfl.173.1560262112355; Tue, 11 Jun 2019 07:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560262112; cv=none; d=google.com; s=arc-20160816; b=srHX/yGz+Tdfk0tu286SgqU1Q3DCxf69XSwSFHhoRTg6gl7yPzWkNaLZHBetwh3hOh nhXbqBrtuk2PXcJbd3wmawnlh9x6IambK+swMMui2hSgzO0jAt9+2eE7pWjQkuwUi1Bp PFCP2mtZFgSQOW33IN25fuBugavJEjELO2Mong80fx4cyArJDdfdmcAIEHn9vmLyjADM Y7+sjwITjjYA0u+BOxCXxjHsn8gEbkLzi7aowXv7nH+5j7lou3zxDkwq8KtpVmwiy3Mp 3xbHFpNURISvhF2lh8FaaNvk0Pqx8zd9Z9T2xOet3H5EW4v0mZZsILEpoJifhyDMf2AA 1thA== 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=gUQQ7G52zEL7BxRanUdIbg9PcXE7G8vW2usE1nCYetg=; b=iZVQGy6/4bAyfxu7C7Z1Vai1yoOZzSJAfA1SW0GxbTbvhEJLF6uF/akiDMDJgEmGnA SdEuXv5aBr6UpMNUbdBiTkOQloQawsQ+4SniYRaJCYMwqktkr+dNxi3pSgCN+kL1OIz3 TFLFtfGUcouq9seSpV/z4UyqjF6M7YqQGUiRXLCcDV0hPJmqf0CwZXMjqqmTxHtbClyZ +VzbYJiVmg/isZiPiasZsQP/KlOfDkGfszCMRnOdq5eTyATWIbcUZoXne8qI38q+YsPO 7y2KSrv7bTD1Tv72pQ8mKWpmT69ZhxjaQleMUQ0ZrgWDg/ak/DjpkOyLsl5aufwsfErY tPoQ== 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 bj12si6076295plb.378.2019.06.11.07.08.17; Tue, 11 Jun 2019 07:08:32 -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 S2391399AbfFKN4n (ORCPT + 99 others); Tue, 11 Jun 2019 09:56:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:39862 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728111AbfFKN4n (ORCPT ); Tue, 11 Jun 2019 09:56:43 -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 65C7BAE9A; Tue, 11 Jun 2019 13:56:42 +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: [RFC 0/5] livepatch: new API to track system state changes Date: Tue, 11 Jun 2019 15:56:22 +0200 Message-Id: <20190611135627.15556-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, hopefully, a simple and generic API that helps to keep and pass information between the livepatches. It is also usable to prevent loading incompatible livepatches. There was also a related idea to add a sticky flag. It should be easy to add it later. It would perfectly fit into the new struct klp_state. 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 | 80 ++++++++++ include/linux/livepatch.h | 17 +++ kernel/livepatch/Makefile | 2 +- kernel/livepatch/core.c | 44 ++++-- kernel/livepatch/core.h | 5 +- kernel/livepatch/state.c | 121 +++++++++++++++ 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, 814 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