Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp304975pxx; Thu, 29 Oct 2020 03:08:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyXwjCsiJL+u+UCbNaT6gKsLwWZoaxxYAZeLV+h30kM0igLSuHUvUhDq99yqnCQ6Cd32l+ X-Received: by 2002:a17:907:42a1:: with SMTP id nf1mr3375678ejb.135.1603966105799; Thu, 29 Oct 2020 03:08:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603966105; cv=none; d=google.com; s=arc-20160816; b=XKDk148u8i4M+w86YktsomggZAEVsrbt7lbEVKW31/nqBjpSpCgwM/S30L5R6LSEO7 X6SHBG37siippiSPFzeFCaqXAwqUETz2vg1lNjLVo7b3JjAQ8HmGJiw878B8CywBDd3O f64jUGAe95GHc+FSPMjBBFFwSAFQgbN+jweqZ7ceiLbXU5T1Id+Bg7g8BhtWfNocm/2z 1wdKN0kbe9bEdiTRJ/xukUfHLmGKZEk93+3roh/pLld1CzOsra+NMSVfxftDkuZzlB4o J8RwxLtgYtjUD9ic4l1OLOO0278W6o6n4IQWcHMimawDemrXJ2mwcC+bh4ee382l5a2y xKqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=k3R0XIMhVpO+krMK56dCX/QuURyntiARHIBADhunbDg=; b=lX7yTA5G6xBTJFGWn0JYoEc9iP4in1nLbVUd++Tc8ETGJXAv7x2oWxgR/zHdFwOEbW 8DRTFzut5+9rzrrd/jtBTIUrp+A4oX61f0dLpn0pPQdcvOCWOgPVDsjW2hv+UrHYvB19 I0xY5YdYfhWT46vJwN0XMROKYci9e0D+qa2vMywfBQiSFj2UdizGc6hAY7Eh+mrFBZqG u0HJ4n3K80Sc9XO1ZRH2tT33eQAvvk93p9IgIwuvnwCemk+2yTET2WJbQLbQOG1DMovA LJ5dbUlLN626LhtEXsUGidbbdCNJQ9BFhXcxmLczJYAaoan3xlqkLBfKLQllCtLpmubg gP/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si1443698eda.550.2020.10.29.03.08.03; Thu, 29 Oct 2020 03:08:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726171AbgJ2KEv (ORCPT + 99 others); Thu, 29 Oct 2020 06:04:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:59074 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726110AbgJ2KEu (ORCPT ); Thu, 29 Oct 2020 06:04:50 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9B12EAB0E; Thu, 29 Oct 2020 10:04:48 +0000 (UTC) Date: Thu, 29 Oct 2020 11:04:48 +0100 (CET) From: Miroslav Benes To: Mark Rutland cc: linux-kernel@vger.kernel.org, Jiri Kosina , Joe Lawrence , Jonathan Corbet , Josh Poimboeuf , Mark Brown , Petr Mladek , linux-doc@vger.kernel.org, live-patching@vger.kernel.org Subject: Re: [PATCH] Documentation: livepatch: document reliable stacktrace In-Reply-To: <20201023153527.36346-1-mark.rutland@arm.com> Message-ID: References: <20201023153527.36346-1-mark.rutland@arm.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, 23 Oct 2020, Mark Rutland wrote: > Add documentation for reliable stacktrace. This is intended to describe > the semantics and to be an aid for implementing architecture support for > HAVE_RELIABLE_STACKTRACE. thanks a lot for doing the work! > Unwinding is a subtle area, and architectures vary greatly in both > implementation and the set of concerns that affect them, so I've tried > to avoid making this too specific to any given architecture. I've used > examples from both x86_64 and arm64 to explain corner cases in more > detail, but I've tried to keep the descriptions sufficient for those who > are unfamiliar with the particular architecture. Yes, I think it is a good approach. We can always add more details later, but it would probably cause more confusion for those unfamiliar. > I've tried to give rationale for all the recommendations/requirements, > since that makes it easier to spot nearby issues, or when a check > happens to catch a few things at once. I believe what I have written is > sound, but as some of this was reverse-engineered I may have missed > things worth noting. > > I've made a few assumptions about preferred behaviour, notably: > > * If you can reliably unwind through exceptions, you should (as x86_64 > does). Yes, it does. I think (and Josh will correct me if I am wrong here), that even at the beginning the intention was to improve the reliability of unwinding in general. Both x86_64 and s390x are the case. _reliable() interface only takes an advantage of that. As you pointed out in the document, unwinding through exceptions is not necessary. It can be reported as unreliable and we can deal with that later. But it is always better to do it if possible. powerpc is an exception to the approach, because it implements its _reliable() API from the scratch. > * It's fine to omit ftrace_return_to_handler and other return > trampolines so long as these are not subject to patching and the > original return address is reported. Most architectures do this for > ftrace_return_handler, but not other return trampolines. Yes. Patching a trampoline is not something I can imagine, so that should not be a problem. But one never knows and we may run into a problem here easily. I don't remember if we even audited all the trampolines. And new ones are introduced all the time. > * For cases where link register unreliability could result in duplicate > entries in the trace or an inverted trace, I've assumed this should be > treated as unreliable. This specific case shouldn't matter to > livepatching, but I assume that that we want a reliable trace to have > the correct order. Agreed. Thanks Miroslav