Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp895337pxj; Thu, 17 Jun 2021 16:49:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwK09zSgV8BLvdqXdPvh851mbxQ2tt+1uXudBVjQjntPF18d1GCXShew7KtI2ziBsv4KASe X-Received: by 2002:a17:906:6ad3:: with SMTP id q19mr7959246ejs.11.1623973758146; Thu, 17 Jun 2021 16:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623973758; cv=none; d=google.com; s=arc-20160816; b=bPUvXp1Ugs7J/RlPh7Rl7LsAjbfNrgpYWHYSF3Wr7Vbh/sauB6qK2awZCpF7jKnv8P 7/R6/5Lfwx/diISc2Riv/QK/eQzclxj4ddt82iPgZdqmjPVi35ufq6kNaT8aZJ2C0BvR 52+D9vzREDDvQsRBxz40gqllGoaX1SgxumvL2Bfs27G4AWLHurJecBI6yH4s7qOrBEzh XyYGkDmsWrVm28ntRJBDmgOrGxeAhpiUgw6PeKr6mXC2CIz/V+eTN48FwHisgAqq8thB fXub1Htd3ABKYA174yvN0JiLMOR0OJbKPb/jLhaj6B9oHlZkFGXQfZoCTAP27tkDRHKI 40Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-filter; bh=LUzAs8YwcV9OEjtCvxPMYvniuVgxNyeebthHhcHDNUQ=; b=xh+QOydC1iMaJ64wHJKqNfJ3wqp5pWmKcKpeSAwpa1XqLSZjVgckPAYPZ5Fr0d0vLU D17gaKr5s3tU1xL4YpQfSfpaoxV4ZTCHye/HadMZEsPudjxz6OMiZpbeXUI98Pj8WUTD 3E0l5iMRr4U/RQ9oA5cq6U4Ch5gBz6mZaugmFYuG/Km8FRsJmGn4rOJA7HcBIw1Ht+1e cv87PzArXFGFkE92kJ8i7SOaHCYRZzLt3wIzGKaEqH8KU5q2MIWK5DmIprtL8ryA12Fc ThHAdyrEUNKY2EMViAHy8TQffrHAQ7MtxonElJkDfucND6Z9AGp91/U7I1bicmsMItYW 73aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=kD5E+KGp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c7si609517ejc.177.2021.06.17.16.48.55; Thu, 17 Jun 2021 16:49:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=kD5E+KGp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232554AbhFQSeV (ORCPT + 99 others); Thu, 17 Jun 2021 14:34:21 -0400 Received: from linux.microsoft.com ([13.77.154.182]:45086 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233686AbhFQSeS (ORCPT ); Thu, 17 Jun 2021 14:34:18 -0400 Received: from [192.168.254.32] (unknown [47.187.214.213]) by linux.microsoft.com (Postfix) with ESMTPSA id 596D320B83DE; Thu, 17 Jun 2021 11:32:09 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 596D320B83DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1623954730; bh=LUzAs8YwcV9OEjtCvxPMYvniuVgxNyeebthHhcHDNUQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=kD5E+KGp4yOxOp+fj4nhFGdWt11PntzW4A2NBd2U7SL9Wq6IYTKJGhJ2Llf3RGlH6 BUxM+DWFZ1d/2vXkeI7mU0HYUo1l0qw6abtjuebcP7c7ZP9BRSkYZk76H7PkkJQvil 0x+dEVwDwzioelIYxXPSSVJu8UuooGch59mPIrMI= Subject: Re: [RFC PATCH 1/1] arm64: implement live patching To: "nobuta.keiya@fujitsu.com" , Suraj Jitindar Singh Cc: "linux-kernel@vger.kernel.org" , "live-patching@vger.kernel.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "mark.rutland@arm.com" , "broonie@kernel.org" , "duwe@lst.de" , "sjitindarsingh@gmail.com" , "benh@kernel.crashing.org" , "linux-arm-kernel@lists.infradead.org" References: <20210604235930.603-1-surajjs@amazon.com> From: "Madhavan T. Venkataraman" Message-ID: <7080d2a9-6ec2-94e9-3577-e5f7233ad3ab@linux.microsoft.com> Date: Thu, 17 Jun 2021 13:32:08 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=iso-2022-jp Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/17/21 4:29 AM, nobuta.keiya@fujitsu.com wrote: > >> It's my understanding that the two pieces of work required to enable live >> patching on arm are in flight upstream; >> - Reliable stack traces as implemented by Madhavan T. Venkataraman [1] >> - Objtool as implemented by Julien Thierry [2] >> >> This is the remaining part required to enable live patching on arm. >> Based on work by Torsten Duwe [3] >> >> Allocate a task flag used to represent the patch pending state for the >> task. Also implement generic functions klp_arch_set_pc() & >> klp_get_ftrace_location(). >> >> In klp_arch_set_pc() it is sufficient to set regs->pc as in >> ftrace_common_return() the return address is loaded from the stack. >> >> ldr x9, [sp, #S_PC] >> >> ret x9 >> >> In klp_get_ftrace_location() it is necessary to advance the address by >> AARCH64_INSN_SIZE (4) to point to the BL in the callsite as 2 nops were >> placed at the start of the function, one to be patched to save the LR and >> another to be patched to branch to the ftrace call, and >> klp_get_ftrace_location() is expected to return the address of the BL. It >> may also be necessary to advance the address by another AARCH64_INSN_SIZE >> if CONFIG_ARM64_BTI_KERNEL is enabled due to the instruction placed at the >> branch target to satisfy BTI, >> >> Signed-off-by: Suraj Jitindar Singh >> >> [1] https://lkml.org/lkml/2021/5/26/1212 >> [2] https://lkml.org/lkml/2021/3/3/1135 >> [3] https://lkml.org/lkml/2018/10/26/536 >> --- > > AFAIU Madhavan's patch series linked in the above [1] is currently awaiting > review by Mark Rutland. It seems that not only this patch series but also the > implementation of arch_stack_walk_reliable() at the below link is required > to enable livepatch. > Yes. I have a patch ready for that. But I can submit that only after the previous series has been accepted. Thanks Madhavan