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=-14.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL 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 97E47C4707C for ; Fri, 21 May 2021 17:32:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 78EDB611AB for ; Fri, 21 May 2021 17:32:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234953AbhEUReS (ORCPT ); Fri, 21 May 2021 13:34:18 -0400 Received: from linux.microsoft.com ([13.77.154.182]:59448 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233220AbhEUReR (ORCPT ); Fri, 21 May 2021 13:34:17 -0400 Received: from [192.168.254.32] (unknown [47.187.214.213]) by linux.microsoft.com (Postfix) with ESMTPSA id 8C68120B7188; Fri, 21 May 2021 10:32:53 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8C68120B7188 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1621618374; bh=kx/ub+OL0PzoQ/hT2KpbKriy7vxNbuz0bztaoHmRMxA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=pY1l80FOiOGwYYaK4/exjyN+IR65hI3sJUmLEcnLo+vTzCDtaGAdxamRYNs8HlR6F 0lc0twNVrQJvOfgDoSx03OxrZ90ak643peCTp1xyrmDNHB2farqYT5Oaly2vFev1hH 4gMM8lSxEOHmv1ITHi/rDmUXK9laQMDpP2W/K0Uo= Subject: Re: [RFC PATCH v4 0/2] arm64: Stack trace reliability checks in the unwinder To: Mark Brown Cc: mark.rutland@arm.com, jpoimboe@redhat.com, ardb@kernel.org, jthierry@redhat.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, pasha.tatashin@soleen.com, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org References: <68eeda61b3e9579d65698a884b26c8632025e503> <20210516040018.128105-1-madvenka@linux.microsoft.com> <20210521171808.GC5825@sirena.org.uk> From: "Madhavan T. Venkataraman" Message-ID: <654dde25-e6a2-a1e7-c2d7-e2692bc11528@linux.microsoft.com> Date: Fri, 21 May 2021 12:32:52 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210521171808.GC5825@sirena.org.uk> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/21/21 12:18 PM, Mark Brown wrote: > On Sat, May 15, 2021 at 11:00:16PM -0500, madvenka@linux.microsoft.com wrote: > >> Special cases >> ============= >> >> Some special cases need to be mentioned: > > I think it'd be good if more of this cover letter, especially sections > like this which cover the tricky bits, ended up in the code somehow - > it's recorded here and will be in the list archive but that's not the > most discoverable place so increases the maintainance burden. It'd be > great to be able to compare the code directly with the reliable > stacktrace requirements document and see everything getting ticked off, > actually going all the way there might be too much and loose the code in > the comments but I think we can get closer to it than we are. Given > that a lot of this stuff rests on the denylist perhaps some comments > just before it's called would be a good place to start? > I will add more comments in the code to make it clear. >> - EL1 interrupt and exception handlers end up in sym_code_ranges[]. >> So, all EL1 interrupt and exception stack traces will be considered >> unreliable. This the correct behavior as interrupts and exceptions > > This stuff about exceptions and preemption is a big one, rejecting any > exceptions makes a whole host of things easier (eg, Mark Rutland raised > interactions between non-AAPCS code and PLTs as being an issue but if > we're able to reliably reject stacks featuring any kind of preemption > anyway that should sidestep the issue). > Yes. I will include this in the code comments. >> Performance >> =========== > >> Currently, unwinder_blacklisted() does a linear search through >> sym_code_functions[]. If reviewers prefer, I could sort the >> sym_code_functions[] array and perform a binary search for better >> performance. There are about 80 entries in the array. > > If people are trying to live patch a very busy/big system then this > could be an issue, equally there's probably more people focused on > getting boot times as fast as possible than live patching. Deferring > the initialisation to first use would help boot times with or without > sorting, without numbers I don't actually know that sorting is worth the > effort or needs doing immediately - obvious correctness is also a > benefit! My instinct is that for now it's probably OK leaving it as a > linear scan and then revisiting if it's not adequately performant, but > I'd defer to actual users there. I have followed the example in the Kprobe deny list. I place the section in initdata so it can be unloaded during boot. This means that I need to copy the information before that in early_initcall(). If the initialization must be performed on first use, I probably have to move SYM_CODE_FUNCTIONS from initdata to some other place where it will be retained. If you prefer this, I could do it this way. Thanks! Madhavan 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.6 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 18171C47076 for ; Fri, 21 May 2021 17:34:59 +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 9CA9E611AB for ; Fri, 21 May 2021 17:34:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9CA9E611AB 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=hdcuCunj/wtMWpsGRbNb0IMVs4zmY4L06K5JLpTP8ks=; b=PGj/qP//2NDzGMZ1B6jfZYbNNA ChSbflTOnJUlAzAF+X0/4dJQncjgRblJftevFOMpGY/f6YYF2y+/0ejMSaDEey2fe0M7F/WhvUSTs 33glgVuTkblgWiN6nEBpqpPkePUgyJImbThe7KLrH+lJOTguKvDiuL5+6nGFoi3mXl/dw4fEmOLxz WjKZKh8ahaiWvxUfIeTjLQhdyYMF8TGOUMp0h1h+pkPr/TvTQcWdH0N5XmM4ecNq1slU6/j/NyfsP SRJOaJShLNeubwMA0jflVeJgy8Z4o+uCTlF+Rol+pjN8Zkizhv7Tex+jdA+Q8azyc2rn4c+WO94Dp GZCDXVkw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk91H-000WkN-To; Fri, 21 May 2021 17:33:08 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk917-000WiQ-PJ for linux-arm-kernel@desiato.infradead.org; Fri, 21 May 2021 17:32:58 +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=kx/ub+OL0PzoQ/hT2KpbKriy7vxNbuz0bztaoHmRMxA=; b=GXDyccfF/d1K3XDUpcusMwOXAE yzwZEIZyh3n2SF+abtA0iyOPcnp/w22lCh2WMSpVXtxHlSxoz0lchp/10216pwnCcxa6xkx62EoRA 84S0qjpbuObQiSU9Dxyg4FKZvsAL8ePTojZzsMDAsn43/bzCC9joID7Q+LAGe2H7m8RWSoRQx8VIo nZ4ij0vNfQPLiK2qBa8fTFn0do+F5ZaWwu+6VG/a50kniGg1/CJ/gpEKm83GCKUyCaVDOlPtiWxBx k3emlRcuU8MtuHeynNLkejdyGwjf9TyQSto9UxyuPB9pMqP4SWFLeZxr4Cki+lxOl+nsUKXSJ8cAg hR4p59Aw==; Received: from linux.microsoft.com ([13.77.154.182]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lk914-00HJgS-Uu for linux-arm-kernel@lists.infradead.org; Fri, 21 May 2021 17:32:56 +0000 Received: from [192.168.254.32] (unknown [47.187.214.213]) by linux.microsoft.com (Postfix) with ESMTPSA id 8C68120B7188; Fri, 21 May 2021 10:32:53 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8C68120B7188 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1621618374; bh=kx/ub+OL0PzoQ/hT2KpbKriy7vxNbuz0bztaoHmRMxA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=pY1l80FOiOGwYYaK4/exjyN+IR65hI3sJUmLEcnLo+vTzCDtaGAdxamRYNs8HlR6F 0lc0twNVrQJvOfgDoSx03OxrZ90ak643peCTp1xyrmDNHB2farqYT5Oaly2vFev1hH 4gMM8lSxEOHmv1ITHi/rDmUXK9laQMDpP2W/K0Uo= Subject: Re: [RFC PATCH v4 0/2] arm64: Stack trace reliability checks in the unwinder To: Mark Brown Cc: mark.rutland@arm.com, jpoimboe@redhat.com, ardb@kernel.org, jthierry@redhat.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, pasha.tatashin@soleen.com, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org References: <68eeda61b3e9579d65698a884b26c8632025e503> <20210516040018.128105-1-madvenka@linux.microsoft.com> <20210521171808.GC5825@sirena.org.uk> From: "Madhavan T. Venkataraman" Message-ID: <654dde25-e6a2-a1e7-c2d7-e2692bc11528@linux.microsoft.com> Date: Fri, 21 May 2021 12:32:52 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210521171808.GC5825@sirena.org.uk> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210521_103255_075737_B9743DD7 X-CRM114-Status: GOOD ( 27.43 ) 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 5/21/21 12:18 PM, Mark Brown wrote: > On Sat, May 15, 2021 at 11:00:16PM -0500, madvenka@linux.microsoft.com wrote: > >> Special cases >> ============= >> >> Some special cases need to be mentioned: > > I think it'd be good if more of this cover letter, especially sections > like this which cover the tricky bits, ended up in the code somehow - > it's recorded here and will be in the list archive but that's not the > most discoverable place so increases the maintainance burden. It'd be > great to be able to compare the code directly with the reliable > stacktrace requirements document and see everything getting ticked off, > actually going all the way there might be too much and loose the code in > the comments but I think we can get closer to it than we are. Given > that a lot of this stuff rests on the denylist perhaps some comments > just before it's called would be a good place to start? > I will add more comments in the code to make it clear. >> - EL1 interrupt and exception handlers end up in sym_code_ranges[]. >> So, all EL1 interrupt and exception stack traces will be considered >> unreliable. This the correct behavior as interrupts and exceptions > > This stuff about exceptions and preemption is a big one, rejecting any > exceptions makes a whole host of things easier (eg, Mark Rutland raised > interactions between non-AAPCS code and PLTs as being an issue but if > we're able to reliably reject stacks featuring any kind of preemption > anyway that should sidestep the issue). > Yes. I will include this in the code comments. >> Performance >> =========== > >> Currently, unwinder_blacklisted() does a linear search through >> sym_code_functions[]. If reviewers prefer, I could sort the >> sym_code_functions[] array and perform a binary search for better >> performance. There are about 80 entries in the array. > > If people are trying to live patch a very busy/big system then this > could be an issue, equally there's probably more people focused on > getting boot times as fast as possible than live patching. Deferring > the initialisation to first use would help boot times with or without > sorting, without numbers I don't actually know that sorting is worth the > effort or needs doing immediately - obvious correctness is also a > benefit! My instinct is that for now it's probably OK leaving it as a > linear scan and then revisiting if it's not adequately performant, but > I'd defer to actual users there. I have followed the example in the Kprobe deny list. I place the section in initdata so it can be unloaded during boot. This means that I need to copy the information before that in early_initcall(). If the initialization must be performed on first use, I probably have to move SYM_CODE_FUNCTIONS from initdata to some other place where it will be retained. If you prefer this, I could do it this way. Thanks! Madhavan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel