Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3290295ybi; Fri, 19 Jul 2019 00:41:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbKbVIDNshnF8xvDk5HW9+I6kZF3IBtWiGdOD4pm4wToH2nfhHyeAqUGqIUgvMH03RNdvG X-Received: by 2002:a17:90a:258b:: with SMTP id k11mr53799264pje.110.1563522084901; Fri, 19 Jul 2019 00:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563522084; cv=none; d=google.com; s=arc-20160816; b=USQIirTeDzFlCpOnZtujmZJGzjuOdORUhCfCY5J7pShD9464GRtqlMvcg+zPwm3bpL uYFO3tEEHbzJSdI1q2kHxBzEL2ACTM3KKT5h0o66PTAzADFFGPU4OxJWkxbws4h4Sbel Z6O9fC60qeE29V0KPcHpuu6QtbSonnH5H5z87XumhqsMG3zly+ZI3G8fgbXyx5oanfzD e3XsLSz6Zyw9i3y2XO67YQoHi+kzF1KQNRrc8Do4cGhRSrAJP5PbDXtU7NHZ4zGUdlx3 S2yyRZCFpbp5QGTS3JE3T90Lo+jnMjye0ShT8lyT1op3BnC0A2S4UsisBdaO4q525WPa Oikw== 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=qBAokw5sCHPYzSMwb1R36neJWtAPHQwXfHTT5rCzIws=; b=E8a2fxUwAeOmkW+Opo0OTT1meJEUt/7v6fUpSooLZIc4LNYH2eNXG1F3CxXj/RzN/o DBuhVaishvOFlabXMbJVCtrSNUMbHJMKQkOaQRVn4sbuO9oQ/VCwnLliIt9T6zkEpBz0 zrMzYgviWeFZMVNyOPT1ugJu+NYG3Y51Xoem8aH7HNDo16qsz263dBxiR+wBNprKVSF8 tLOA5wogCTIkvWiO3HEqP0sfyjXd4G4eMGaqBm1hWl8ICNdPfa48U9aRGRiYdnln0nuU A5BXQHT1mT7f6DxdGL/RAI0P4wye+0sis3LP7fYVyVuU9VKQKAz8SWSjD+iCXR9Ww/dI UdEw== 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 h6si1816615pgc.202.2019.07.19.00.41.08; Fri, 19 Jul 2019 00:41:24 -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 S1726858AbfGSHks (ORCPT + 99 others); Fri, 19 Jul 2019 03:40:48 -0400 Received: from mx2.suse.de ([195.135.220.15]:49926 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726247AbfGSHks (ORCPT ); Fri, 19 Jul 2019 03:40:48 -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 E9717AC68; Fri, 19 Jul 2019 07:40:46 +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 v2 0/5] livepatch: new API to track system state changes Date: Fri, 19 Jul 2019 09:40:29 +0200 Message-Id: <20190719074034.29761-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 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