From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F16DC433E7 for ; Tue, 20 Oct 2020 10:04:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22FFD223C6 for ; Tue, 20 Oct 2020 10:04:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731637AbgJTKEC (ORCPT ); Tue, 20 Oct 2020 06:04:02 -0400 Received: from foss.arm.com ([217.140.110.172]:49004 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727589AbgJTKEC (ORCPT ); Tue, 20 Oct 2020 06:04:02 -0400 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 111A3101E; Tue, 20 Oct 2020 03:04:02 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.53.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A730C3F66E; Tue, 20 Oct 2020 03:03:59 -0700 (PDT) Date: Tue, 20 Oct 2020 11:03:52 +0100 From: Mark Rutland To: Josh Poimboeuf Cc: Mark Brown , Miroslav Benes , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org Subject: Re: [RFC PATCH 0/3] arm64: Implement reliable stack trace Message-ID: <20201020100352.GA48360@C02TD0UTHF1T.local> References: <20201012172605.10715-1-broonie@kernel.org> <20201015141612.GC50416@C02TD0UTHF1T.local> <20201015154951.GD4390@sirena.org.uk> <20201015212931.mh4a5jt7pxqlzxsg@treble> <20201016111431.GB84361@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201016111431.GB84361@C02TD0UTHF1T.local> Precedence: bulk List-ID: X-Mailing-List: live-patching@vger.kernel.org On Fri, Oct 16, 2020 at 12:14:31PM +0100, Mark Rutland wrote: > Mark B's reply dropped this, but the next paragraph covered that: > > | I was planning to send a mail once I've finished writing a test, but > | IIUC there are some windows where ftrace/kretprobes > | detection/repainting may not work, e.g. if preempted after > | ftrace_return_to_handler() decrements curr_ret_stack, but before the > | arch trampoline asm restores the original return addr. So we might > | need something like an in_return_trampoline() to detect and report > | that reliably. > > ... so e.g. for a callchain A->B->C, where C is instrumented there are > windows where B might be missing from the trace, but the trace is > reported as reliable. I'd missed a couple of details, and I think I see how each existing architecture prevents this case now. Josh, just to confirm the x86 case, am I right in thinking that the ORC unwinder will refuse to unwind from the return_to_handler and kretprobe_trampoline asm? IIRC objtool shouldn't build unwind info for those as return_to_handler is marked with SYM_CODE_{START,END}() and kretprobe_trampoline is marked with STACK_FRAME_NON_STANDARD(). Both powerpc and s390 refuse to reliably unwind through exceptions, so they can rely on function call boundaries to keep the callchain in a sane state. Thanks, Mark.