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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 9AEB3C433ED for ; Fri, 9 Apr 2021 22:44:10 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 287BF611AE for ; Fri, 9 Apr 2021 22:44:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 287BF611AE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0Iz2jqcOwF5RjIbQYmXSu7CL2OQGpY8RuzduwVcZbDI=; b=nT/HoytiCE/ryrv02uGhLPM8H ujbZrx0XNXPfpjgBbkkYMoIICADPp5zdgS/8VDdGRIorggK3f1PdL9r69DsLA0bx+zg3ixmZNgyyk ku1qAOnlm6X3N/76TlqC/5B0i3YxC0pMI4El0Suu9F0eYAv9DPaLu3HAcl+12HVV+hExxAxYqvqeP 4rrFPM2+GpARpIV2COVQIg4hKUgVvRGaqn3cCmYiVwZGIt1ubgBYIEkkQ/TwMEm6WNRWzgEYVRMCj yo4JWXLV0wMoBjzfzl2ueMaHubwmyvX+FFPhRcOOYVpqlCP1G+EErwlstvXCLKLy3H7lTbWNGaEAI PCgL/92ng==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUzlG-001d3k-86; Fri, 09 Apr 2021 22:37:58 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUzgC-001cbQ-11 for linux-arm-kernel@desiato.infradead.org; Fri, 09 Apr 2021 22:33:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=yyr/6Ag1Vbeg1psngxfhYGjr6J2CEL/d4aEho0RnXho=; b=jU4b0bWpNuJbR4YlyifzswbQ5X GsDqv9qFup5xU+mEaXl7xyQLgqDt68UYeaVhUDZP+2cuW0wpd/JX47PpMJTgCzi19S5DK+8tNhJGh ymx5/C54zcoKyUh0MbZ6IKb6rHGflj2APfZo4ocPxj40xcgqc+HfR7nP3rQgfaf6F9tKs4L7x/OAF UvuJfHIPveHhJMTYwQChvF9K/+BB7jZFGMh799UlASebUGXDQn6SqNjgA/LW8jiXWUQF0YHXpjIRG 8zlEsXo5wtQAo6aLuQj/isE39w2cVmQqK5saFbCWIgfTeQegQeSTm1GWSQQQxVG9RoPSByZ3WPG1B Y3lVROfA==; Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUzg9-004phh-2g for linux-arm-kernel@lists.infradead.org; Fri, 09 Apr 2021 22:32:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618007560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yyr/6Ag1Vbeg1psngxfhYGjr6J2CEL/d4aEho0RnXho=; b=iY+X7/kmeEfNcuDuMLn7VsH2hGplppTe6eacnc4kt7tlBdjaCZkVviIt5WpurDVMtnOtCe mFdIZJL2FKQA0kjfhSLRgKdk1Vaywc08760Em+byxvcTYD3besSdctl8kMlGbd4HDuFz7I DYw/Lx4AZe2Ao9iFjfEFy/QTSWw8X9A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-241-0AUWjXB6OJWe5318dHN-_w-1; Fri, 09 Apr 2021 18:32:36 -0400 X-MC-Unique: 0AUWjXB6OJWe5318dHN-_w-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E0F5F10053E7; Fri, 9 Apr 2021 22:32:34 +0000 (UTC) Received: from treble (ovpn-112-2.rdu2.redhat.com [10.10.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A29605C1D5; Fri, 9 Apr 2021 22:32:29 +0000 (UTC) Date: Fri, 9 Apr 2021 17:32:27 -0500 From: Josh Poimboeuf To: "Madhavan T. Venkataraman" Cc: Mark Rutland , broonie@kernel.org, jthierry@redhat.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra Subject: Re: [RFC PATCH v2 0/4] arm64: Implement stack trace reliability checks Message-ID: <20210409223227.rvf6tfhvgnpzmabn@treble> References: <705993ccb34a611c75cdae0a8cb1b40f9b218ebd> <20210405204313.21346-1-madvenka@linux.microsoft.com> <20210409120859.GA51636@C02TD0UTHF1T.local> <20210409213741.kqmwyajoppuqrkge@treble> <8c30ec5f-b51e-494f-5f6c-d2f012135f69@linux.microsoft.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <8c30ec5f-b51e-494f-5f6c-d2f012135f69@linux.microsoft.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210409_153241_209388_579D0E65 X-CRM114-Status: GOOD ( 26.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Apr 09, 2021 at 05:05:58PM -0500, Madhavan T. Venkataraman wrote: > > FWIW, over the years we've had zero issues with encoding the frame > > pointer on x86. After you save pt_regs, you encode the frame pointer to > > point to it. Ideally in the same macro so it's hard to overlook. > > > > I had the same opinion. In fact, in my encoding scheme, I have additional > checks to make absolutely sure that it is a true encoding and not stack > corruption. The chances of all of those values accidentally matching are, > well, null. Right, stack corruption -- which is already exceedingly rare -- would have to be combined with a miracle or two in order to come out of the whole thing marked as 'reliable' :-) And really, we already take a similar risk today by "trusting" the frame pointer value on the stack to a certain extent. > >> I think there's a lot more code that we cannot unwind, e.g. KVM > >> exception code, or almost anything marked with SYM_CODE_END(). > > > > Just a reminder that livepatch only unwinds blocked tasks (plus the > > 'current' task which calls into livepatch). So practically speaking, it > > doesn't matter whether the 'unreliable' detection has full coverage. > > The only exceptions which really matter are those which end up calling > > schedule(), e.g. preemption or page faults. > > > > Being able to consistently detect *all* possible unreliable paths would > > be nice in theory, but it's unnecessary and may not be worth the extra > > complexity. > > > > You do have a point. I tried to think of arch_stack_walk_reliable() as > something that should be implemented independent of livepatching. But > I could not really come up with a single example of where else it would > really be useful. > > So, if we assume that the reliable stack trace is solely for the purpose > of livepatching, I agree with your earlier comments as well. One thought: if folks really view this as a problem, it might help to just rename things to reduce confusion. For example, instead of calling it 'reliable', we could call it something more precise, like 'klp_reliable', to indicate that its reliable enough for live patching. Then have a comment above 'klp_reliable' and/or stack_trace_save_tsk_klp_reliable() which describes what that means. Hm, for that matter, even without renaming things, a comment above stack_trace_save_tsk_reliable() describing the meaning of "reliable" would be a good idea. -- Josh _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel