From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EACD438B7C5 for ; Mon, 6 Apr 2026 18:50:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775501413; cv=none; b=iOsnCz5MzA99oZjl2p7j1Mf/FTi6X4riVIrKFD91GY7cSs7ZrGUnruhIWWhPTETQxB7Umrnn+V3ksQn9/u8WisvR+EZNPnRh2b3AtqJHa0rbblulusLXNbOwpF/JybEgk2dTwRTuuGOTHsn7PCfqExsyu/80/oMGQir/XnqGzEw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775501413; c=relaxed/simple; bh=riN6fr/MFnf3sOtrSsvZ6UMfTXrP253QR6mtbcn7vLM=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=jGKuErJLZXPDJv/wc0Aawuc7975h9bXKzcjWIcss0Ri3lGmxa3pndIVAFO3ZtALCG42rWjeFAjfmocAuMdgSVAI7FxUhwsEW3CwnaYbzBunCsU4R9lsoqbMt0y4/aFAUCjMO2Py1256eC16WaXMzb8TaZBwx0XyactGAdG/RJq4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--dylanbhatch.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=irq/aGum; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dylanbhatch.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="irq/aGum" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-82d42b6f2b0so538903b3a.1 for ; Mon, 06 Apr 2026 11:50:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775501411; x=1776106211; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=Tw0/fXAq4NvxlO+cgBvvlksUtU/q9839xS4Koaoen6E=; b=irq/aGumpjEHJDlp7egYPvKxA3X+PVl6w9pGTAia8bRsbkLRHfpMhiTjxnya1mWULY odP3qvejYt+ldqb2xWnjP72XGgWtir97ncYm2ArLYj2BiIH8JFqClWKCr6bYmshGe3WO nGjeEPF+8ExaDB0WRO2Y5oofWSJtphJnw5hbzReSOVzaApwI52AG+jToFMDfHWRMNqpp AC3N0hrAtqujzKP3MeZY6CtfCBwwjjfewZxn/5Ow2lszynSGKMXN5+C61GoFHJO6VYEc YxnTIKS0Mecq3yPTIl+hLLg5419FgkjDFObpC5We3mkke1oiL4LDWYOr/2Hz0WfT0hnB jaiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775501411; x=1776106211; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Tw0/fXAq4NvxlO+cgBvvlksUtU/q9839xS4Koaoen6E=; b=oJgVVHo16KRNrZF4LsgDpaNndNlAhriPqOU4tZf+DVW0AEIdLwxDDWvmuJHfAuM9Zo VIXmx+cEex6Wpizhkbqt9KTrItSfxVYmHwPG5qM3kAyyhssijz9+YLDZRqCEj9HQtnA8 g3aN9Gh9R1PgbKJzbYMZxtL4KcvnDiubokE1UyYO4fNR8OrgAsBsrjD8fp5fiV0xAby4 3wgq6Ivl67NT1kd+JWwDq4EKQ/fbqeyfBssWvoTep/kUn2sbKZzdlhz96BTepVi2LFSH 68FcdTSs4yZNzDP6i7CmpjvMMUt9yPPxNwACCGvDZ2XNX0MQ2CDyfks3sCJj8EjpWKmd 8C3g== X-Forwarded-Encrypted: i=1; AJvYcCX3VKRwPBd9ASDpF8FB0W1mYybtG+I8F2WSo0hbMW1j7c8iNezSdeBG13Vlr1x8KB+Nab/20MAFGXzyUb2QhDD9@vger.kernel.org X-Gm-Message-State: AOJu0YwMNIP0gLKT9hIjvroaAlBdy9TJ/kaE4YUR2HxNBgv2ibzxV0xY rlPCfMTpnefyITzSAOhqBfcBlDQcpTWlWif7frQuhch3pMSm0uZUTHPG6qgyDavSbmOoFmmf0kt 7DGgkh5rbR/heM95zfx6LgGbLxA== X-Received: from pfbeq2.prod.google.com ([2002:a05:6a00:37c2:b0:82c:63f8:59db]) (user=dylanbhatch job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:1950:b0:82a:1337:493c with SMTP id d2e1a72fcca58-82d0da4cd94mr13275110b3a.14.1775501411087; Mon, 06 Apr 2026 11:50:11 -0700 (PDT) Date: Mon, 6 Apr 2026 18:49:52 +0000 Precedence: bulk X-Mailing-List: linux-toolchains@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.53.0.1213.gd9a14994de-goog Message-ID: <20260406185000.1378082-1-dylanbhatch@google.com> Subject: [PATCH v3 0/8] unwind, arm64: add sframe unwinder for kernel From: Dylan Hatch To: Roman Gushchin , Weinan Liu , Will Deacon , Josh Poimboeuf , Indu Bhagat , Peter Zijlstra , Steven Rostedt , Catalin Marinas , Jiri Kosina Cc: Dylan Hatch , Mark Rutland , Prasanna Kumar T S M , Puranjay Mohan , Song Liu , joe.lawrence@redhat.com, linux-toolchains@vger.kernel.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Jens Remus , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Implement a generic kernel sframe-based [1] unwinder. The main goal is to improve reliable stacktrace on arm64 by unwinding across exception boundaries. On x86, the ORC unwinder provides reliable stacktrace through similar methodology, but arm64 lacks the necessary support from objtool to create ORC unwind tables. Currently, there's already a sframe unwinder proposed for userspace: [2]. To maintain common definitions and algorithms for sframe lookup, a substantial portion of this patch series aims to refactor the sframe lookup code to support both kernel and userspace sframe sections. Currently, only GNU Binutils support sframe. This series relies on the Sframe V3 format, which is supported in binutils 2.46. These patches are based on Steven Rostedt's sframe/core branch [3], which is and aggregation of existing work done for x86 sframe userspace unwind, and contains [2]. This branch is, in turn, based on Linux v7.0-rc3. This full series (applied to the sframe/core branch) is available on github: [4]. Ref: [1]: https://sourceware.org/binutils/docs/sframe-spec.html [2]: https://lore.kernel.org/lkml/20260127150554.2760964-1-jremus@linux.ibm.com/ [3]: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git/log/?h=sframe/core [4]: https://github.com/dylanbhatch/linux/tree/sframe-v3-with-v3 Changes since v2: The biggest change from v2 is the switch from adding a dedicated, in-kernel sframe-lookup library, to refactoring/using the existing library developed by Josh, Jens, and Steve. Consequently, this series now depends on Sframe V3, though this upgrade would likely have been necessary anyway. Below is a full accounting of the changes since v2. - (Josh) Add stricter reliability checks during unwind. - (Puranjay, Indu, Jens) Update to use a common sframe library with userpace unwind, thus resolving the need to support SFRAME_F_FDE_FUNC_START_PCREL, added in binutils 2.45. - (Jens) Add check for sframe V3, thus resolving the prior need for V2 and SFRAME_F_FDE_FUNC_START_PCREL support. - (Will) Add ARCH_SUPPORTS_SFRAME_UNWINDER, remove SFRAME_UNWIND_TABLE - (Indu) add support for unsorted FDE tables, allowing for module sframe lookups. - (Mark) Prefer frame-pointer unwind when possible, for better performance. - Simplify compile-time logic, adding stubbs when necessary. - Add support for in-kernel SFRAME_VALIDATION. - Rebase onto core/sframe (with v7.0-rc3 base) Dylan Hatch (7): sframe: Allow kernelspace sframe sections. arm64, unwind: build kernel with sframe V3 info sframe: Provide PC lookup for vmlinux .sframe section. sframe: Allow unsorted FDEs. arm64/module, sframe: Add sframe support for modules. sframe: Introduce in-kernel SFRAME_VALIDATION. unwind: arm64: Use sframe to unwind interrupt frames. Weinan Liu (1): arm64: entry: add unwind info for various kernel entries MAINTAINERS | 3 +- Makefile | 8 + arch/Kconfig | 13 +- arch/arm64/Kconfig | 1 + arch/arm64/Kconfig.debug | 13 + arch/arm64/include/asm/module.h | 6 + arch/arm64/include/asm/stacktrace/common.h | 6 + arch/arm64/include/asm/unwind_sframe.h | 12 + arch/arm64/kernel/entry.S | 10 + arch/arm64/kernel/module.c | 8 + arch/arm64/kernel/setup.c | 2 + arch/arm64/kernel/stacktrace.c | 242 ++++++++++- arch/arm64/kernel/vdso/Makefile | 2 +- .../{unwind_user_sframe.h => unwind_sframe.h} | 6 +- arch/x86/include/asm/unwind_user.h | 12 +- include/asm-generic/vmlinux.lds.h | 15 + include/linux/sframe.h | 105 ++++- include/linux/unwind_user_types.h | 41 -- kernel/unwind/Makefile | 2 +- kernel/unwind/sframe.c | 408 ++++++++++++++---- kernel/unwind/user.c | 40 +- 21 files changed, 749 insertions(+), 206 deletions(-) create mode 100644 arch/arm64/include/asm/unwind_sframe.h rename arch/x86/include/asm/{unwind_user_sframe.h => unwind_sframe.h} (50%) -- 2.53.0.1213.gd9a14994de-goog