Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp93013imm; Mon, 1 Oct 2018 07:11:27 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Ur/MmyHlYeuLSvQL2It4SQ6XQ99WYHrnZ2BdYxhKZtC0/RUEfe1QnI7X4/iP7EwZ4qTso X-Received: by 2002:a17:902:784a:: with SMTP id e10-v6mr11950948pln.197.1538403087949; Mon, 01 Oct 2018 07:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538403087; cv=none; d=google.com; s=arc-20160816; b=Kd8Qf9ZKPzPFVugiO9LgDBS2rW/7LNiAiXn8irxevOcP9+UvAWx1TTn9H+mB8yN4hM onzH1LiB134Yk684v+/JGf82/M5BptPTbjfra8h4Wjc9l2xT4U7H0COBWTBAYgRadG0F YRsgNJpOBBx8RZ5eGj2u37qvpG/s3aS0SUohDN1C7LSf2rUpTWRzwiCOFhVrR3GNWVrd WlG5rYai7XhoJ/BTm42HdgpHyCr5OvzMXG44vTf3ShTf+orXjofB67QG+1IuCs8o6Av6 WSIyPkyB9wJQluFp0mvJTEBhiZe4813j4Fyp/kmD1HqYqd5Ew8w6fS0c/s58qQsE/MOw R7jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:from:date:message-id:subject:cc:to; bh=ZByBalUQBVyeK9lBOMKfhjjZfRml9uVuQ2TqEo4/PYI=; b=ix+Zy6XUrpYkyudZgA3Q2Llki35T3rrkie4fWkT1AJTqgJiTM5iwTh8OWfDg2nfRaJ aWHOIiUkKEwBakjnlNXSgoBMaX4/hYsl4AODwnk/5145YO5+v5GusnKSUnf7Rk2zwaSH vBkxd2iNVA1oU5qtUIy26l6temzpd5/mb9wYUvjwx6tWagTuST3uXTnaPdcqZhpa90mB 3hqYnA+V7/iS9ByNHeJgPOJprc5O0bE6c1qELf7ihKnydaP8+P7/k0bHjUmjSQM4Z6rS h0JWaD6KvDnWuzVvT0u7tGQb1g2m7lNAfGABovfYRUhm3cGwpTk5eTKXxzjXmRwAzORL 5shQ== 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 g12-v6si12219788pgi.467.2018.10.01.07.11.13; Mon, 01 Oct 2018 07:11:27 -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 S1729526AbeJAUrK (ORCPT + 99 others); Mon, 1 Oct 2018 16:47:10 -0400 Received: from verein.lst.de ([213.95.11.211]:37859 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728979AbeJAUrK (ORCPT ); Mon, 1 Oct 2018 16:47:10 -0400 Received: by newverein.lst.de (Postfix, from userid 2005) id 086E768BC7; Mon, 1 Oct 2018 16:09:10 +0200 (CEST) To: Will Deacon , Catalin Marinas , Julien Thierry , Steven Rostedt , Josh Poimboeuf , Ingo Molnar , Ard Biesheuvel , Arnd Bergmann , AKASHI Takahiro Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org Subject: [PATCH v3 0/4] arm64 live patching Message-Id: <20181001140910.086E768BC7@newverein.lst.de> Date: Mon, 1 Oct 2018 16:09:10 +0200 (CEST) From: duwe@lst.de (Torsten Duwe) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all! Some substantial changes were requested, so I had to shuffle a few things around. All the bigger changes are in now. [Changes from v2]: * ifeq($(CONFIG_DYNAMIC_FTRACE_WITH_REGS),y) instead of ifdef * "fix" commit 06aeaaeabf69da4. (new patch 1) Made DYNAMIC_FTRACE_WITH_REGS a real choice. The current situation would be that a linux-4.20 kernel on arm64 should be built with gcc >= 8; as in this case, as well as all other archs, the "default y" works. Only kernels >= 4.20, arm64, gcc < 8, must change this to "n" in order to not be stopped by the Makefile $(error) from patch 2/4. You'll then fall back to the DYNAMIC_FTRACE, if selected, like before. * use some S_X* constants to refer to offsets into pt_regs in assembly. * have the compiler/assembler generate the mov x9,x30 instruction that saves LR at compile time, rather than generate it repeatedly at runtime. * flip the ftrace_regs_caller stack frame so that it is no longer upside down, as Ard remarked. This change broke the graph caller somehow. * extend handling of the module arch-dependent ftrace trampoline with a companion "regs" version. * clear the _TIF_PATCH_PENDING on do_notify_resume() * took care of arch/arm64/kernel/time.c when changing stack unwinder semantics [TODO] * use more S_X* constants * run the full livepatch test suite, especially test apply_relocate_add() functionality late after module load. [Changes from v1]: * Missing compiler support is now a Makefile error, instead of a warning. This will keep the compile log shorter and it will thus be easier to spot the problem. * A separate ftrace_regs_caller. Only that one will write out a complete pt_regs, for efficiency. * Replace the use of X19 with X28 to remember the old PC during live patch detection, as only that is saved&restored now for non-regs ftrace. * CONFIG_DYNAMIC_FTRACE_WITH_REGS and CC_USING_PATCHABLE_FUNCTION_ENTRY are currently synonymous on arm64, but differentiate better for the future when this is no longer the case. * Clean up "old"/"new" insn value setting vs. #ifdefs. * #define a INSN_MOV_X9_X30 with suggested aarch64_insn_gen call and use that instead of an immediate hex value. Torsten