| Message ID | 20240826105257.2669-1-steve.capper@arm.com |
|---|---|
| Headers |
Return-Path: <elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 18457385B82F for <patchwork@sourceware.org>; Mon, 26 Aug 2024 10:53:23 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 0A49C3858C3A for <elfutils-devel@sourceware.org>; Mon, 26 Aug 2024 10:53:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A49C3858C3A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0A49C3858C3A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724669591; cv=none; b=a7KV7CxbY3k8phq+fKPzzMGLZjGt9s9xpkW0c4wlePV9CZtwE2OAsZomo2GLNuhvDXxo5T0D4kMLeL4XYu8A9djgzbBZ4XY/N9Kf4toohCYaHH49SQBixnU57RfwNLTywUM+dS6/8M6P74iLkhZxSn5UYoTX/XwFPUcd/nidqBs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724669591; c=relaxed/simple; bh=DwQipizgl/PYYBt//B3RbveMUESAPa627lqrutEyT24=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=fmBF1s1P6mqif1P7JhLnXk99N3CAosS57MH5FtOycxG4ydQ+OTgXs5ObSBQthWeACrsX3NyJzAb+yZIvOuBWP9PcyV4PiL84NqoZNRU7yzrfgmdAajKWccP6weCI3FSajWAeQ6bDMt83oVR8PV8/7suvFIrJ6zv/hDtApWooSN4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 64B56DA7; Mon, 26 Aug 2024 03:53:35 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 832DA3F66E; Mon, 26 Aug 2024 03:53:08 -0700 (PDT) From: Steve Capper <steve.capper@arm.com> To: elfutils-devel@sourceware.org Cc: mark@klomp.org, german.gomez@arm.com, ema@debian.org, Steve Capper <steve.capper@arm.com> Subject: [PATCH v2 0/5] Enable PAC support in elfutils Date: Mon, 26 Aug 2024 11:52:52 +0100 Message-ID: <20240826105257.2669-1-steve.capper@arm.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list <elfutils-devel.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/elfutils-devel/> List-Post: <mailto:elfutils-devel@sourceware.org> List-Help: <mailto:elfutils-devel-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=subscribe> Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
Enable PAC support in elfutils
|
|
Message
Steve Capper
Aug. 26, 2024, 10:52 a.m. UTC
Hello, This series enables Pointer Authentication (PAC) support in elfutils. The first three patches were originally posted by German Gomez. I've rewritten a new patch to extend the dwfl_thread_state_registers function to handle the PAC mask and added an extra patch that was required to debug core dumps from PAC enabled applications. These patches were tested on Debian Testing and Fedora 40 running on an Apple M1 MacBook Pro (the CFLAG -mbranch-protection=standard needs to be supplied to the build). Without this series applied, the following tests failed: * run-backtrace-native.sh * run-backtrace-dwarf.sh * run-backtrace-native-core.sh * run-deleted.sh I am happy to chop/change bits as necessary. A guide to pointer authentication can be found here: https://developer.arm.com/-/media/Arm%20Developer%20Community/PDF/Learn%20the%20Architecture/Providing%20protection%20for%20complex%20software.pdf Changed in V2: * moved DW_AARCH64_RA_SIGN_STATE to cfi.h, * dwfl_thread_state_aarch64_pauth API dropped, (using dwfl_thread_state_registers instead) * AArch64 #ifdefs removed, ptrace logic for PAC consolidated into aarch64_initreg.c Cheers,
Comments
Hi Steve, On Mon, 2024-08-26 at 11:52 +0100, Steve Capper wrote: > Hello, > This series enables Pointer Authentication (PAC) support in elfutils. > > The first three patches were originally posted by German Gomez. I've > rewritten a new patch to extend the dwfl_thread_state_registers function > to handle the PAC mask and added an extra patch that was required to > debug core dumps from PAC enabled applications. > > These patches were tested on Debian Testing and Fedora 40 running on an > Apple M1 MacBook Pro (the CFLAG -mbranch-protection=standard needs to be > supplied to the build). > > Without this series applied, the following tests failed: > * run-backtrace-native.sh > * run-backtrace-dwarf.sh > * run-backtrace-native-core.sh > * run-deleted.sh > > I am happy to chop/change bits as necessary. > > A guide to pointer authentication can be found here: > https://developer.arm.com/-/media/Arm%20Developer%20Community/PDF/Learn%20the%20Architecture/Providing%20protection%20for%20complex%20software.pdf > > Changed in V2: > * moved DW_AARCH64_RA_SIGN_STATE to cfi.h, > * dwfl_thread_state_aarch64_pauth API dropped, > (using dwfl_thread_state_registers instead) > * AArch64 #ifdefs removed, ptrace logic for PAC consolidated into > aarch64_initreg.c Very nice. This addresses all my concerns. I looked over all 5 patches and pushed them. The only thing I am concerned about is the usage of struct user_pac_mask in aarch64_initreg.c. It might not be defined on older aarch64 systems. Hopefully the buildbot (or some aarch64 user) will catch that if it really is an issue. Thanks, Mark > Cheers, > -- > Steve > > German Gomez (3): > aarch64: Create definitions for AARCH64_RA_SIGN_STATE register > libdw, aarch64: Implement DW_CFA_AARCH64_negate_ra_state CFI > instruction > libdwfl, aarch64: Demangle return addresses using a PAC mask > > Steve Capper (2): > libdwfl, aarch64: extend dwfl_thread_state_registers to handle PAC > libdwfl, aarch64: Read PAC mask from core > > backends/aarch64_corenote.c | 17 +++++++++++++++-- > backends/aarch64_initreg.c | 12 ++++++++++++ > backends/aarch64_regs.c | 5 ++++- > libdw/cfi.c | 14 +++++++++++++- > libdw/cfi.h | 5 +++++ > libdwfl/dwfl_frame.c | 3 +++ > libdwfl/dwfl_frame_regs.c | 6 ++++++ > libdwfl/frame_unwind.c | 14 +++++++++++++- > libdwfl/libdwflP.h | 6 ++++++ > libdwfl/linux-core-attach.c | 34 ++++++++++++++++++++++++++++++++++ > libdwfl/linux-pid-attach.c | 9 +++++++-- > tests/run-addrcfi.sh | 1 + > tests/run-allregs.sh | 1 + > 13 files changed, 120 insertions(+), 7 deletions(-) >