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=-5.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 49223C433ED for ; Sun, 11 Apr 2021 17:56:15 +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 C88DA6109F for ; Sun, 11 Apr 2021 17:56:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C88DA6109F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.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:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hannJ5upUeLGhOIFyE4Mb0iTE3oMjdmwUpc3PedFdYc=; b=M786lTsyxZPTxW7uanw+6mBT4 XBgnj4aQM5y1cb/uARQiepx+MpsEz+yc8gMTNScOoiAjvemmRYwuT5I9o1r4Sh9ZLHW22PefM5bzR MuR362wMjSAnqjnhC6vMCT00w6jc25zGvB2e9AalPQtRupm9VpBvTBDdCNBmy9dzUqxBu3hE0FPtw 6HBIp4wA2HHZcrN4wiKdUtM7j0CbT0E17A6qTaNonJkDuUZ3F5SoRu4WBQ+7l4J45pAzyFQFWhJo1 FDh4JgjPW98r0vdltuxkqyBemTEfQEYFa2gUum/jMl1xeY5+yChRtkKL5wvGPu0u3F6qX2+ixzAnX GxMXofonA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVeI0-004rVc-Ud; Sun, 11 Apr 2021 17:54:29 +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 1lVeHt-004rVE-Te for linux-arm-kernel@desiato.infradead.org; Sun, 11 Apr 2021 17:54:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=MLtBefkHmjSmdpfbhYpvt4YGwNCxEie/Zvb95gWk5ZE=; b=YJvWxeN0eNijFLPcbky+FnWxz5 1PBYVauwlOEbgRS6MiPSie7Km0cbmA2S3KibX9qA+lo3lwIMUHRwGHSwtha8gOfj3Q/VMWg5AVXmF hiEGA5SznOy85QQTKgh5al36Bt99DkMyVh8uH2c2RUBjMBe22PyYLTH750zBpkCGWme158rD84R3H Hap4Q1SH/FxC+dAgN2zXHiwsbcDMJlU/TkP4Jv51SYPs7GKDti++T9M/S4AxUifA6hIMNtRj3Q2XK kVkfKA+Q71EWt5FP7dYQ1znjbhA9PQvKJTkv9MyS/2Qw1NRf+1E/6Co6M/EYt2XsXJMD5f87pcpxj AM/s56BQ==; Received: from linux.microsoft.com ([13.77.154.182]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVeHr-005d1c-35 for linux-arm-kernel@lists.infradead.org; Sun, 11 Apr 2021 17:54:20 +0000 Received: from [192.168.254.32] (unknown [47.187.194.202]) by linux.microsoft.com (Postfix) with ESMTPSA id 3744A20BCFB3; Sun, 11 Apr 2021 10:54:16 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3744A20BCFB3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1618163656; bh=MLtBefkHmjSmdpfbhYpvt4YGwNCxEie/Zvb95gWk5ZE=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=fujDV8OeM1T22IT97/wOcNnL1wdw/Nw2777lmGyZsnTrOqwx8PoSG7U1cVCZh+/bn Au7ugxlJ/Dtl6Q4ax/hesnnUSBn4RB1jjp4rNQTwWIEzzfdsNudvnl/ISWCQ4bUINk 0O+skF0BuBp2lmR/elC8XNenrzRFlJRmJ2nRqQj4= Subject: Re: [RFC PATCH v2 0/4] arm64: Implement stack trace reliability checks To: Josh Poimboeuf 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 References: <705993ccb34a611c75cdae0a8cb1b40f9b218ebd> <20210405204313.21346-1-madvenka@linux.microsoft.com> <20210409120859.GA51636@C02TD0UTHF1T.local> <20210409213741.kqmwyajoppuqrkge@treble> <8c30ec5f-b51e-494f-5f6c-d2f012135f69@linux.microsoft.com> <20210409223227.rvf6tfhvgnpzmabn@treble> <20210409225321.2czbawz6p2aquf5m@treble> From: "Madhavan T. Venkataraman" Message-ID: <1be20ada-6b52-c6e8-508c-7572c438d2b7@linux.microsoft.com> Date: Sun, 11 Apr 2021 12:54:15 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210409225321.2czbawz6p2aquf5m@treble> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210411_105419_225138_F152FDCC X-CRM114-Status: GOOD ( 18.95 ) 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 4/9/21 5:53 PM, Josh Poimboeuf wrote: > On Fri, Apr 09, 2021 at 05:32:27PM -0500, Josh Poimboeuf wrote: >> 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. > > Oh yeah, I forgot to mention some more benefits of encoding the frame > pointer (or marking pt_regs in some other way): > > a) Stack addresses can be printed properly: '%pS' for printing regs->pc > and '%pB' for printing call returns. > > Using '%pS' for call returns (as arm64 seems to do today) will result > in printing the wrong function when you have tail calls to noreturn > functions on the stack (which is actually quite common for calls to > panic(), die(), etc). > > More details: > > https://lkml.kernel.org/r/20210403155948.ubbgtwmlsdyar7yp@treble > > b) Stack dumps to the console can dump the exception registers they find > along the way. This is actually quite nice for debugging. > > Great. I am preparing version 3 taking into account comments from yourself, Mark Rutland and Mark Brown. Stay tuned. Madhavan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel