Received: by 10.223.164.202 with SMTP id h10csp647092wrb; Wed, 15 Nov 2017 05:51:20 -0800 (PST) X-Google-Smtp-Source: AGs4zMZL16jFT32FkQChoQK8pI3ebFTHYhWMMFCPC21p3S2VeTZ8xe93PmmB4BumHG/HJzdY8IC6 X-Received: by 10.98.70.78 with SMTP id t75mr17897279pfa.6.1510753879919; Wed, 15 Nov 2017 05:51:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510753879; cv=none; d=google.com; s=arc-20160816; b=zF+BYaLDzkyjJGDZQcRUgY8mkLjmNImhcvD/iPK3R9D4peKaMObW5CH0om4a0q1Syp 2S/nfRjLwPUbItWKft+X5qdGWDMQ/sgSzFvgO8bapt6oczYLxh7NNdmsEQTEjqkZuPZQ iLNTEAlZPQv2bcmimnV2zs9mFMBbch2RfblxuXWGpJMGljsjnEglLoo5FN7ekeaTA5CL tceOdDLZfOGnTrl7htrU6M3VPvri9NQQfWZyqB3jUWgrmJQ72WWKY6NmKdJkLg5QeDSi z5kSLOJuAJB34VunGd3tda9SYLolRrHArieXQqrJV5qvL9BLjeGtlOAsm183ngLqFGlN jomQ== 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 :arc-authentication-results; bh=B9NmVKmzCPpVf92Pi67sgM7vkOdoEItY6O2qaFDs51k=; b=mkrBQVoQ6HNUdabiWv3x7UGTwljnEvO2e5bf/8PKtA1BS3hh1LIZ5GH2n/7uy1fxFQ std0dblxgsnvExbGkf0/B/r6ou7B5TIsLBH7FjG2hZtsL56DyuTTawOBUPZ4dWFZK0jC sHLhebEcOTMnMhvjQJkzGIUcwEB8ISqRi9WdVnGpdqTKSjuNDrhZYCZnn3W9XcHqD0mv PcsW3C8iBU7Vyk+37FzJqt1RZHbHB7cC3rvIP3QKTIt6guWf/J49B0I9r5FfvZvSSMnO zS9UZwhs8VJwCaHwpkpnrAuJGX486r3ncwbUtYpevpC6PlfountTKrrj520PSxlGEu/P U+bw== 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 e7si5717654pfl.148.2017.11.15.05.51.07; Wed, 15 Nov 2017 05:51:19 -0800 (PST) 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 S932743AbdKONuY (ORCPT + 90 others); Wed, 15 Nov 2017 08:50:24 -0500 Received: from mx2.suse.de ([195.135.220.15]:52451 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932305AbdKONuT (ORCPT ); Wed, 15 Nov 2017 08:50:19 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 98867ACCF; Wed, 15 Nov 2017 13:50:17 +0000 (UTC) From: Miroslav Benes To: jpoimboe@redhat.com, jeyu@kernel.org, jikos@kernel.org Cc: pmladek@suse.com, lpechacek@suse.cz, pavel@ucw.cz, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Miroslav Benes , Andy Lutomirski , "H. Peter Anvin" , Ingo Molnar , Michael Ellerman , Oleg Nesterov , Thomas Gleixner Subject: [PATCH v4 0/2] livepatch: Introduce signal and force sysfs attributes Date: Wed, 15 Nov 2017 14:50:12 +0100 Message-Id: <20171115135014.20594-1-mbenes@suse.cz> X-Mailer: git-send-email 2.15.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, livepatch gradually migrate the system from an unpatched to a patched state (or vice versa). Each task drops its TIF_PATCH_PENDING itself when crossing the kernel/user space boundary or it is cleared using the stack checking approach. If there is a task which sleeps on a patched function, the whole transition can get stuck indefinitely. Livepatch has means which can be used in these cases. The transition can be cancelled and/or immediate flag may be used for the live patch. On the other hand it might be useful to poke the system a little bit and help the transition to finish by doing so. That is what the fake signal can be used for. A task sleeping/waiting in the kernel gets TIF_SIGPENDING set, it handles it and during that its TIF_PATCH_PENDING is cleared. Kthreads are only woken up, they do not handle signals suitably. Still, there are cases which neither fake signal can solve. A task can sleep uninterruptedly without reacting to signals at all. Even then, it may be safe to clear the task's TIF_PATCH_PENDING. As a last resort, admin may force such clearing for all tasks in the system with this patch set. We use the fake signal in SLES for a long time. Moreover, we don't have a stack checking there, so we rely on the fake signal a lot. We send it automatically and periodically. Petr, I did not add you Reviewed-by tags intentionally because of the changes. Changes from v3: - only TASK_INTERRUPTIBLE kthreads are woken up - Petr - documentation - Pavel - function naming and sysfs fix - Josh Changes from v2: - two sysfs attributes instead of one - Petr, Josh - better documentation about force usage - Pavel - small changes here and there Changes from v1: - better wording, typos, comments, documentation - Libor, Josh - symbolic names in sysfs instead of numbers - Libor - exit_to_usermode_loop(), call klp_update_patch_state() before do_signal() - Oleg - better names - Josh - mutex and WARN_ON_ONCE not added to klp_force_transitions() - Petr, Josh - handle idle tasks in klp_force_transitions() too - Josh Miroslav Benes (2): livepatch: send a fake signal to all blocking tasks livepatch: force transition to finish Documentation/ABI/testing/sysfs-kernel-livepatch | 25 +++++++++ Documentation/livepatch/livepatch.txt | 22 +++++++- arch/powerpc/kernel/signal.c | 6 +-- arch/x86/entry/common.c | 6 +-- kernel/livepatch/core.c | 60 +++++++++++++++++++++ kernel/livepatch/transition.c | 66 ++++++++++++++++++++++++ kernel/livepatch/transition.h | 2 + kernel/signal.c | 4 +- 8 files changed, 182 insertions(+), 9 deletions(-) -- 2.15.0 From 1587474524484622195@xxx Fri Dec 22 09:08:01 +0000 2017 X-GM-THRID: 1586489290071276989 X-Gmail-Labels: Inbox,Category Forums