From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (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 6DD3D2E8DE9 for ; Thu, 4 Sep 2025 22:39:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757025551; cv=none; b=Io/iV/Vi5FS1PAjxiy7LeRgC14/BBkJzxMoMUSzpBho8WGzjYM6xPSGAnwgAy9ptKVR4G/02UxQpMW+12dlzMCE80eik4hjlW1FB/yZnj11IJDuyM8hDcGgZkR0KUfVrBqbQ9s4c+uxOShy+Zd/gM5zC9cOMeeLylp/NNYzBDrI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757025551; c=relaxed/simple; bh=P0eL7lErTS8v56iUyRusaVLI0YisFizXJuWjCzEPVZw=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=qDqDt15evGH6QmvuZ5zc/dKo7hAcXWkU8GCYjlchM/BmACB5MtAbEIJJBo/wAXdKPh6SH4I1vHkMaTnxRQL+AvAi1GR2rWC9eXdRmRDTaJhYRZcqkaJX8d/EJOIbmuA0C2z03/CkHaz68PBJVPi6shVXI8DifJZjy2CrslbYHT4= 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=OZNhbHD5; arc=none smtp.client-ip=209.85.214.201 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="OZNhbHD5" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-24cc4458e89so23839205ad.1 for ; Thu, 04 Sep 2025 15:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1757025550; x=1757630350; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=kW9rn2v1iSXbjmMoTXUPRQjjdzpOebvUQxrfx5dfUSk=; b=OZNhbHD5U6Ht5AUONGMOWB9Dn3WEhFuXPM2rS77rAtFPjZjqZJm5IBN/Z0iuaG4tbL B+rsDCPa/8M9J/gwnFiIOsNzZzY44ZS+oeHwdQg+lEFBcHBDrIAPmaF9QLMBgrsadmtV 6ylFUNiHC5eZE4Mhyz0WpEKR9Y33jBsfZthFdlrw78nQ42hnA6klR/AVpACN5t42v7L9 LgMbEimr29DfawJok8uF+NL79FDxI5qvnxZioBObkHrdHbeaSv+QR2ZStKJTzvtoHulC MBeh9o8KAYjActyo6cfFR99TGWtwup+/ooN7vRgNNLGqxi2KXN+pAfCYmSyhk4Z+nMej moiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757025550; x=1757630350; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kW9rn2v1iSXbjmMoTXUPRQjjdzpOebvUQxrfx5dfUSk=; b=eTqf3fce5LsKaCTxrcQenCKiIBcLS67uIV4m2KFe/5+XeuIRY3YpOVcHdFUjj9Tpf+ yMMJnlpinr5p+BqV/q6j+TLMU0ni3T2dRptgA70/zFzBpjQSF8GA7PUKTNrptSe5xtE8 Fjsze8Ie0rzl1tLpA9hgqXrRGPzGN72Yw6FnoFQVp+Hw1SuyutjT40zxWyqfvUNbZQPk IDFAULxd31afglpVWuFkr1fOMGlnb5HhS2flWv8q5sgzpDvWDsIuCBNb+dmMG1i9ydas mKEvOnb3gGLUx90BDkZPvBrJ5lPC8m+6VmS7b0qeGWmFXnmhlRMUdPiEmmPuH0TSmVp3 +jrg== X-Forwarded-Encrypted: i=1; AJvYcCX3b/5I7z1z8lfm2FKfNvXStP376/AxXvMDxemOg6VatbgYadp4UYyKHOJUsS8c9oWdQdnYp4VoPYOYYDDIjz4M@vger.kernel.org X-Gm-Message-State: AOJu0Yw33uCniIwJCJeuw0/yFlezNY3z9EOrINJJv/PiKkegkAW0drl5 blHqfyXl3c9w2V77Mz4WTw186g64H/Sf164uzCUwAD+eAVtLlENCbddk+axgf0I3N7O/Zwu23t0 U4tRJE4O8Mi8gYTP0OPbwD/u/aA== X-Google-Smtp-Source: AGHT+IFFdPHEWVThnXTu0FfDT+ZcMytzRTpeJbytNNp+zdJruRZkojIgvG5+XM/y/gqjNUmQ/JwMhGivtKhPGWPRWg== X-Received: from pjbst4.prod.google.com ([2002:a17:90b:1fc4:b0:32b:5e07:ca10]) (user=dylanbhatch job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:e889:b0:24c:da3b:7379 with SMTP id d9443c01a7336-24cda3b7654mr38292825ad.16.1757025549629; Thu, 04 Sep 2025 15:39:09 -0700 (PDT) Date: Thu, 4 Sep 2025 22:38:44 +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.51.0.355.g5224444f11-goog Message-ID: <20250904223850.884188-1-dylanbhatch@google.com> Subject: [PATCH v2 0/6] unwind, arm64: add sframe unwinder for kernel From: Dylan Hatch To: Josh Poimboeuf , Steven Rostedt , Indu Bhagat , Peter Zijlstra , Will Deacon , Catalin Marinas , Jiri Kosina Cc: Dylan Hatch , Roman Gushchin , Weinan Liu , Mark Rutland , Ian Rogers , linux-toolchains@vger.kernel.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, joe.lawrence@redhat.com, Puranjay Mohan , Song Liu Content-Type: text/plain; charset="UTF-8" This patchset implements a generic kernel sframe-based [1] unwinder. The main goal is to support reliable stacktraces on arm64. On x86 orc unwinder provides reliable stacktraces. But arm64 misses the required support from objtool: it cannot generate orc unwind tables for arm64. Currently, there's already a sframe unwinder proposed for userspace: [2]. Since the sframe unwind table algorithm is similar, these two proposals could integrate common functionality in the future. Currently, only GCC supports sframe. These patches are based on v6.17-rc4 and are available on github [3]. Ref: [1]: https://sourceware.org/binutils/docs/sframe-spec.html [2]: https://lore.kernel.org/lkml/cover.1730150953.git.jpoimboe@kernel.org/ [3]: https://github.com/dylanbhatch/linux/tree/sframe-v2 Changes since v1: https://lore.kernel.org/live-patching/20250127213310.2496133-1-wnliu@google.com/ - Fixed detection of sframe support in compiler (Josh, Jens) - Adapt latest sframe v2 header definition from userspace patch series (Josh) - Folded together unwinder/stacktrace patches (Prasanna) - Fix "orphan section" warnings for .init.sframe sections (Puranjay, Indu, Josh) - Build VDSO without sframe (Dylan) - Added support for modules (Weinan) Dylan Hatch (2): unwind: build kernel with sframe info unwind: add sframe v2 header Weinan Liu (4): arm64: entry: add unwind info for various kernel entries unwind: Implement generic sframe unwinder library arm64/module, unwind: Add sframe support for modules. unwind: arm64: Add reliable stacktrace with sframe unwinder. Makefile | 8 + arch/Kconfig | 6 + arch/arm64/Kconfig.debug | 10 + arch/arm64/include/asm/module.h | 6 + arch/arm64/include/asm/stacktrace/common.h | 6 + arch/arm64/kernel/entry.S | 10 + arch/arm64/kernel/module.c | 5 + arch/arm64/kernel/setup.c | 2 + arch/arm64/kernel/stacktrace.c | 102 +++++++++ arch/arm64/kernel/vdso/Makefile | 2 +- include/asm-generic/vmlinux.lds.h | 15 ++ include/linux/sframe_lookup.h | 45 ++++ kernel/Makefile | 1 + kernel/sframe.h | 75 +++++++ kernel/sframe_lookup.c | 232 +++++++++++++++++++++ 15 files changed, 524 insertions(+), 1 deletion(-) create mode 100644 include/linux/sframe_lookup.h create mode 100644 kernel/sframe.h create mode 100644 kernel/sframe_lookup.c -- 2.51.0.355.g5224444f11-goog