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=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 77883C433B4 for ; Tue, 4 May 2021 19:16:27 +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 E5EED610E9 for ; Tue, 4 May 2021 19:16:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5EED610E9 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=scEpSAAb0IFdJtU/FuLO4oHPiPo3zdW/NKOBpGs16W4=; b=FR9qFk9XqjhvHSDP8ZKi6p7BH UR+PG+hxxZByou/w97Ym/H8l2t9fiZx/RH6toDmOb5N+0OxNCNxhLSGHcj4A1LAN/QtiFkHzUx4xX 4pkgT/+DkTghb3zLWCfZki6RRvSSt0LPrO+db928dPR5AsF8IqwEasg0m9P3FM8gYbpxVDHjvR53p duCizn3Blx6qucWqfL7GbI1I2P2CN6CqcmMQv9sWHaxQSyAPq+JhmNhwYCKwni99uOX6/UNh6Cf7T ptG5JR/CRR9amOtNHlLNeGN5DY4ux7OhzQj/jPxu0f/f4c67m3LG001c5m2proz7MCk8axIShgz3p bbcrueZ1Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1le0V1-00GrwO-2U; Tue, 04 May 2021 19:14:27 +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 1le0Uy-00Grvl-5M for linux-arm-kernel@desiato.infradead.org; Tue, 04 May 2021 19:14:24 +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=NT93qR5y4vJEyN4TlNFBZ7epv4aqQ9wRwRPw+CZEeh0=; b=d1QrxMk5GF9EWMaBD8v+J1jLNp h65oMe8XTPR8Q5mWbPE6Zd0v9W/cnPe1Jf9H+tT9h+LMwG51bc4Wh5stbXA8+GG3PxTSQrqP/Fqv6 Zgfg9duev5hcXf2Dhm31c8dbMWoyj5Le/Tugshz2UNdyX3Y4qggNr+U+7JyyQDSEImg3gTL+KBn91 rPS4IlNvTDSIgsQg0D8oflOV4tgupJWmlnFU7SHsYz4unHV/Oa5Yhqy79PPkBj1HMRI1KACtl2A+Q fBrLS6v1WPuRO31Vwcs1P7Jxobkl6dOpEOkmZ9iJh6XGnd+DyydL3+IPSEpXO63bVhp9ZC6B6+JTZ v7TZy0PQ==; Received: from linux.microsoft.com ([13.77.154.182]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1le0Uv-004D48-Hk for linux-arm-kernel@lists.infradead.org; Tue, 04 May 2021 19:14:22 +0000 Received: from [192.168.254.32] (unknown [47.187.223.33]) by linux.microsoft.com (Postfix) with ESMTPSA id F1D5E20B7178; Tue, 4 May 2021 12:14:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F1D5E20B7178 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1620155660; bh=NT93qR5y4vJEyN4TlNFBZ7epv4aqQ9wRwRPw+CZEeh0=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=c4Tu84/wv4NIzOPdh8fTtWgwZHEwqPxQdHhJSjz1xd7HvjwI9ScVDcvHvbJF16QuD xacGTdmjxVwMCyloctrINa9KX9kO/eV0zszLDjgO71fR6lOUexVEiKp5niDkeBTGhY CIS7a8e2TaWWqVKaxS4Yv6x8082R2iAnK/a9pez8= Subject: Re: [RFC PATCH v3 1/4] arm64: Introduce stack trace reliability checks in the unwinder To: Mark Brown Cc: jpoimboe@redhat.com, mark.rutland@arm.com, 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: <65cf4dfbc439b010b50a0c46ec500432acde86d6> <20210503173615.21576-1-madvenka@linux.microsoft.com> <20210503173615.21576-2-madvenka@linux.microsoft.com> <20210504155056.GB7094@sirena.org.uk> From: "Madhavan T. Venkataraman" Message-ID: <66680284-8c80-1434-6c49-d86a47767168@linux.microsoft.com> Date: Tue, 4 May 2021 14:14:19 -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: <20210504155056.GB7094@sirena.org.uk> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210504_121421_646742_9003E5A8 X-CRM114-Status: GOOD ( 20.99 ) 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/4/21 10:50 AM, Mark Brown wrote: > On Mon, May 03, 2021 at 12:36:12PM -0500, madvenka@linux.microsoft.com wrote: > >> + /* >> + * First, make sure that the return address is a proper kernel text >> + * address. A NULL or invalid return address probably means there's >> + * some generated code which __kernel_text_address() doesn't know >> + * about. Mark the stack trace as not reliable. >> + */ >> + if (!__kernel_text_address(frame->pc)) { >> + frame->reliable = false; >> + return 0; >> + } > > Do we want the return here? It means that... > >> + >> #ifdef CONFIG_FUNCTION_GRAPH_TRACER >> if (tsk->ret_stack && >> - (ptrauth_strip_insn_pac(frame->pc) == (unsigned long)return_to_handler)) { >> + frame->pc == (unsigned long)return_to_handler) { >> struct ftrace_ret_stack *ret_stack; >> /* >> * This is a case where function graph tracer has >> @@ -103,11 +117,10 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame) >> if (WARN_ON_ONCE(!ret_stack)) >> return -EINVAL; >> frame->pc = ret_stack->ret; >> + frame->pc = ptrauth_strip_insn_pac(frame->pc); >> } > > ...we skip this handling in the case where we're not in kernel code. I > don't know off hand if that's a case that can happen right now but it > seems more robust to run through this and anything else we add later, > even if it's not relevant now changes either in the unwinder itself or > resulting from some future work elsewhere may mean it later becomes > important. Skipping futher reliability checks is obviously fine if > we've already decided things aren't reliable but this is more than just > a reliability check. > AFAICT, currently, all the functions that the unwinder checks do have valid kernel text addresses. However, I don't think there is any harm in letting it fall through and make all the checks. So, I will remove the return statement. Thanks! Madhavan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel