From: Andrea della Porta <andrea.porta@suse.com>
To: Song Liu <song@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-toolchains@vger.kernel.org,
live-patching@vger.kernel.org, indu.bhagat@oracle.com,
puranjay@kernel.org, wnliu@google.com, irogers@google.com,
joe.lawrence@redhat.com, jpoimboe@kernel.org,
mark.rutland@arm.com, peterz@infradead.org,
roman.gushchin@linux.dev, rostedt@goodmis.org, will@kernel.org,
kernel-team@meta.com, Suraj Jitindar Singh <surajjs@amazon.com>,
Torsten Duwe <duwe@suse.de>, Miroslav Benes <mbenes@suse.cz>,
Breno Leitao <leitao@debian.org>
Subject: Re: [PATCH v3 2/2] arm64: Implement HAVE_LIVEPATCH
Date: Mon, 31 Mar 2025 11:07:12 +0200 [thread overview]
Message-ID: <Z-pbQJtwdAxyR0Fg@apocalypse> (raw)
In-Reply-To: <20250320171559.3423224-3-song@kernel.org>
On 10:15 Thu 20 Mar , Song Liu wrote:
> This is largely based on [1] by Suraj Jitindar Singh.
>
> Test coverage:
>
> - Passed manual tests with samples/livepatch.
> - Passed all but test-kprobe.sh in selftests/livepatch.
> test-kprobe.sh is expected to fail, because arm64 doesn't have
> KPROBES_ON_FTRACE.
> - Passed tests with kpatch-build [2]. (This version includes commits that
> are not merged to upstream kpatch yet).
>
> [1] https://lore.kernel.org/all/20210604235930.603-1-surajjs@amazon.com/
> [2] https://github.com/liu-song-6/kpatch/tree/fb-6.13
> Cc: Suraj Jitindar Singh <surajjs@amazon.com>
> Cc: Torsten Duwe <duwe@suse.de>
> Signed-off-by: Song Liu <song@kernel.org>
> Acked-by: Miroslav Benes <mbenes@suse.cz>
> Tested-by: Breno Leitao <leitao@debian.org>
> ---
> arch/arm64/Kconfig | 3 +++
> arch/arm64/include/asm/thread_info.h | 4 +++-
> arch/arm64/kernel/entry-common.c | 4 ++++
> 3 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 31d5e1ee6089..dbd237b13b21 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -277,6 +277,7 @@ config ARM64
> select USER_STACKTRACE_SUPPORT
> select VDSO_GETRANDOM
> select HAVE_RELIABLE_STACKTRACE
> + select HAVE_LIVEPATCH
> help
> ARM 64-bit (AArch64) Linux support.
>
> @@ -2501,3 +2502,5 @@ endmenu # "CPU Power Management"
> source "drivers/acpi/Kconfig"
>
> source "arch/arm64/kvm/Kconfig"
> +
> +source "kernel/livepatch/Kconfig"
> diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h
> index 1114c1c3300a..4ac42e13032b 100644
> --- a/arch/arm64/include/asm/thread_info.h
> +++ b/arch/arm64/include/asm/thread_info.h
> @@ -64,6 +64,7 @@ void arch_setup_new_exec(void);
> #define TIF_UPROBE 4 /* uprobe breakpoint or singlestep */
> #define TIF_MTE_ASYNC_FAULT 5 /* MTE Asynchronous Tag Check Fault */
> #define TIF_NOTIFY_SIGNAL 6 /* signal notifications exist */
> +#define TIF_PATCH_PENDING 7 /* pending live patching update */
> #define TIF_SYSCALL_TRACE 8 /* syscall trace active */
> #define TIF_SYSCALL_AUDIT 9 /* syscall auditing */
> #define TIF_SYSCALL_TRACEPOINT 10 /* syscall tracepoint for ftrace */
> @@ -92,6 +93,7 @@ void arch_setup_new_exec(void);
> #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
> #define _TIF_SECCOMP (1 << TIF_SECCOMP)
> #define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU)
> +#define _TIF_PATCH_PENDING (1 << TIF_PATCH_PENDING)
> #define _TIF_UPROBE (1 << TIF_UPROBE)
> #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
> #define _TIF_32BIT (1 << TIF_32BIT)
> @@ -103,7 +105,7 @@ void arch_setup_new_exec(void);
> #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
> _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \
> _TIF_UPROBE | _TIF_MTE_ASYNC_FAULT | \
> - _TIF_NOTIFY_SIGNAL)
> + _TIF_NOTIFY_SIGNAL | _TIF_PATCH_PENDING)
>
> #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
> _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \
> diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
> index b260ddc4d3e9..b537af333b42 100644
> --- a/arch/arm64/kernel/entry-common.c
> +++ b/arch/arm64/kernel/entry-common.c
> @@ -8,6 +8,7 @@
> #include <linux/context_tracking.h>
> #include <linux/kasan.h>
> #include <linux/linkage.h>
> +#include <linux/livepatch.h>
> #include <linux/lockdep.h>
> #include <linux/ptrace.h>
> #include <linux/resume_user_mode.h>
> @@ -144,6 +145,9 @@ static void do_notify_resume(struct pt_regs *regs, unsigned long thread_flags)
> (void __user *)NULL, current);
> }
>
> + if (thread_flags & _TIF_PATCH_PENDING)
> + klp_update_patch_state(current);
> +
> if (thread_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL))
> do_signal(regs);
>
> --
> 2.47.1
>
Tested-by: Andrea della Porta <andrea.porta@suse.com>
Thanks,
Andrea
next prev parent reply other threads:[~2025-03-31 9:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 17:15 [PATCH v3 0/2] arm64: livepatch: Enable livepatch without sframe Song Liu
2025-03-20 17:15 ` [PATCH v3 1/2] arm64: Implement arch_stack_walk_reliable Song Liu
2025-03-20 17:46 ` Weinan Liu
2025-03-20 17:54 ` Song Liu
2025-03-21 7:11 ` Josh Poimboeuf
2025-03-26 13:48 ` Miroslav Benes
2025-03-31 9:06 ` Andrea della Porta
2025-05-19 13:41 ` Mark Rutland
2025-05-19 16:57 ` Song Liu
2025-05-20 14:28 ` Will Deacon
2025-05-20 16:59 ` Mark Rutland
2025-03-20 17:15 ` [PATCH v3 2/2] arm64: Implement HAVE_LIVEPATCH Song Liu
2025-03-31 9:07 ` Andrea della Porta [this message]
2025-03-25 12:53 ` [PATCH v3 0/2] arm64: livepatch: Enable livepatch without sframe Petr Mladek
2025-03-25 13:37 ` Song Liu
2025-04-10 15:17 ` Petr Mladek
2025-05-16 16:53 ` Song Liu
2025-05-19 12:57 ` Mark Rutland
2025-05-19 14:22 ` Will Deacon
2025-05-19 16:40 ` Mark Rutland
2025-05-19 17:11 ` Dylan Hatch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z-pbQJtwdAxyR0Fg@apocalypse \
--to=andrea.porta@suse.com \
--cc=duwe@suse.de \
--cc=indu.bhagat@oracle.com \
--cc=irogers@google.com \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=kernel-team@meta.com \
--cc=leitao@debian.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-toolchains@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mbenes@suse.cz \
--cc=peterz@infradead.org \
--cc=puranjay@kernel.org \
--cc=roman.gushchin@linux.dev \
--cc=rostedt@goodmis.org \
--cc=song@kernel.org \
--cc=surajjs@amazon.com \
--cc=will@kernel.org \
--cc=wnliu@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).